diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index ea8d8514..cee5b129 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -3,9 +3,6 @@ on:
push:
tags: [ v* ]
-env:
- YAAK_PLUGINS_DIR: checkout/plugins
-
jobs:
build-artifacts:
permissions:
@@ -83,12 +80,6 @@ jobs:
- name: Run lint
run: npm run lint
- - name: Checkout yaakapp/plugins
- uses: actions/checkout@v4
- with:
- repository: yaakapp/plugins
- path: ${{ env.YAAK_PLUGINS_DIR }}
-
- name: Set version
run: npm run replace-version
env:
@@ -96,7 +87,6 @@ jobs:
- uses: tauri-apps/tauri-action@v0
env:
- YAAK_PLUGINS_DIR: ${{ env.YAAK_PLUGINS_DIR }}
YAAK_TARGET_ARCH: ${{ matrix.yaak_arch }}
ENABLE_CODE_SIGNING: ${{ secrets.APPLE_CERTIFICATE }}
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 00000000..7fff17ee
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,121 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 00000000..6e6eec11
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 00000000..c88ef5f1
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml
new file mode 100644
index 00000000..cc3da93f
--- /dev/null
+++ b/.idea/jsLibraryMappings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 00000000..639900d1
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 00000000..9aabe3f9
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/plugins.iml b/.idea/plugins.iml
new file mode 100644
index 00000000..095b5441
--- /dev/null
+++ b/.idea/plugins.iml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 00000000..35eb1ddf
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 00000000..a5108d61
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,1026 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {
+ "lastFilter": {
+ "state": "OPEN",
+ "assignee": "gschier"
+ }
+}
+ {
+ "selectedUrlAndAccountId": {
+ "url": "git@github.com:yaakapp/plugins.git",
+ "accountId": "71967edb-f3a0-49b0-a8bb-91c112bf4a62"
+ }
+}
+
+
+
+ {}
+ {
+ "isMigrated": true
+}
+
+
+
+
+
+
+ {
+ "associatedIndex": 0
+}
+
+
+
+
+
+
+
+
+
+ build.executor": "Run",
+ "npm.auth-jwt > dev.executor": "Debug",
+ "npm.auth-none > build.executor": "Run",
+ "npm.auth-oauth2 > dev.executor": "Run",
+ "npm.bootstrap.executor": "Run",
+ "npm.build (1).executor": "Run",
+ "npm.build (2).executor": "Run",
+ "npm.build.executor": "Run",
+ "npm.dev.executor": "Run",
+ "npm.exporter-curl > build.executor": "Run",
+ "npm.exporter-curl > dev.executor": "Run",
+ "npm.exporter-curl > watch.executor": "Run",
+ "npm.importer-openapi > dev.executor": "Run",
+ "npm.start.executor": "Run",
+ "npm.template-function-secure > dev.executor": "Run",
+ "org.rust.cargo.project.model.PROJECT_DISCOVERY": "true",
+ "org.rust.cargo.project.model.impl.CargoExternalSystemProjectAware.subscribe.first.balloon": "",
+ "org.rust.first.attach.projects": "true",
+ "prettierjs.PrettierConfiguration.Package": "/Users/gschier/Workspace/yaak/node_modules/prettier",
+ "settings.editor.selected.configurable": "preferences.pluginManager",
+ "ts.external.directory.path": "/Users/gschier/Applications/IntelliJ IDEA Ultimate.app/Contents/plugins/javascript-plugin/jsLanguageServicesImpl/external",
+ "typescript.add.unambiguous.imports.on.the.fly": "true"
+ },
+ "keyToStringList": {
+ "com.intellij.ide.scratch.ScratchImplUtil$2/New Scratch File": [
+ "TEXT",
+ "TypeScript",
+ "JSON"
+ ]
+ }
+}]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1715206870704
+
+
+ 1715206870704
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1747157702283
+
+
+
+ 1747157702283
+
+
+
+ 1747158341167
+
+
+
+ 1747158341167
+
+
+
+ 1747161482127
+
+
+
+ 1747161482127
+
+
+
+ 1747162426708
+
+
+
+ 1747162426708
+
+
+
+ 1747198681028
+
+
+
+ 1747198681030
+
+
+
+ 1747280639288
+
+
+
+ 1747280639288
+
+
+
+ 1747317625976
+
+
+
+ 1747317625976
+
+
+
+ 1747318208670
+
+
+
+ 1747318208670
+
+
+
+ 1747326495043
+
+
+
+ 1747326495043
+
+
+
+ 1747327025871
+
+
+
+ 1747327025871
+
+
+
+ 1747337385982
+
+
+
+ 1747337385982
+
+
+
+ 1747344569831
+
+
+
+ 1747344569831
+
+
+
+ 1747407202751
+
+
+
+ 1747407202751
+
+
+
+ 1747411956899
+
+
+
+ 1747411956899
+
+
+
+ 1747421258428
+
+
+
+ 1747421258428
+
+
+
+ 1747424528836
+
+
+
+ 1747424528836
+
+
+
+ 1747425650260
+
+
+
+ 1747425650260
+
+
+
+ 1747427509994
+
+
+
+ 1747427509995
+
+
+
+ 1747427626574
+
+
+
+ 1747427626574
+
+
+
+ 1747487196454
+
+
+
+ 1747487196454
+
+
+
+ 1747687032228
+
+
+
+ 1747687032228
+
+
+
+ 1747694479253
+
+
+
+ 1747694479253
+
+
+
+ 1747752092366
+
+
+
+ 1747752092366
+
+
+
+ 1747754037437
+
+
+
+ 1747754037437
+
+
+
+ 1747754119803
+
+
+
+ 1747754119803
+
+
+
+ 1747840689873
+
+
+
+ 1747840689873
+
+
+
+ 1747841112315
+
+
+
+ 1747841112315
+
+
+
+ 1747841175806
+
+
+
+ 1747841175806
+
+
+
+ 1747850697576
+
+
+
+ 1747850697576
+
+
+
+ 1747850720379
+
+
+
+ 1747850720379
+
+
+
+ 1747855032219
+
+
+
+ 1747855032219
+
+
+
+ 1747866788839
+
+
+
+ 1747866788839
+
+
+
+ 1747868893332
+
+
+
+ 1747868893332
+
+
+
+ 1747926570346
+
+
+
+ 1747926570346
+
+
+
+ 1748013114021
+
+
+
+ 1748013114021
+
+
+
+ 1748013509113
+
+
+
+ 1748013509113
+
+
+
+ 1748015032650
+
+
+
+ 1748015032650
+
+
+
+ 1748061874691
+
+
+
+ 1748061874691
+
+
+
+ 1748181880126
+
+
+
+ 1748181880126
+
+
+
+ 1748185356230
+
+
+
+ 1748185356230
+
+
+
+ 1748229913352
+
+
+
+ 1748229913352
+
+
+
+ 1748230754265
+
+
+
+ 1748230754265
+
+
+
+ 1748231112411
+
+
+
+ 1748231112411
+
+
+
+ 1748268878923
+
+
+
+ 1748268878923
+
+
+
+ 1748269069908
+
+
+
+ 1748269069908
+
+
+
+ 1748442979153
+
+
+
+ 1748442979153
+
+
+
+ 1748454177753
+
+
+
+ 1748454177753
+
+
+
+ 1748462923967
+
+
+
+ 1748462923967
+
+
+
+ 1748466421031
+
+
+
+ 1748466421031
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
\ No newline at end of file
diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md
index e4bedc06..e36ad3bc 100644
--- a/DEVELOPMENT.md
+++ b/DEVELOPMENT.md
@@ -34,8 +34,6 @@ Run the `bootstrap` command to do some initial setup:
npm run bootstrap
```
-_NOTE: Run with `YAAK_PLUGINS_DIR=` to re-build bundled plugins_
-
## Run the App
After bootstrapping, start the app in development mode:
@@ -44,8 +42,6 @@ After bootstrapping, start the app in development mode:
npm start
```
-_NOTE: If working on bundled plugins, run with `YAAK_PLUGINS_DIR=`_
-
## SQLite Migrations
New migrations can be created from the `src-tauri/` directory:
diff --git a/package-lock.json b/package-lock.json
index 83cb8d26..802340a0 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -11,6 +11,29 @@
"packages/plugin-runtime",
"packages/plugin-runtime-types",
"packages/common-lib",
+ "plugins/auth-basic",
+ "plugins/auth-bearer",
+ "plugins/auth-jwt",
+ "plugins/auth-oauth2",
+ "plugins/exporter-curl",
+ "plugins/filter-jsonpath",
+ "plugins/filter-xpath",
+ "plugins/importer-curl",
+ "plugins/importer-insomnia",
+ "plugins/importer-openapi",
+ "plugins/importer-postman",
+ "plugins/importer-yaak",
+ "plugins/template-function-cookie",
+ "plugins/template-function-encode",
+ "plugins/template-function-fs",
+ "plugins/template-function-hash",
+ "plugins/template-function-json",
+ "plugins/template-function-prompt",
+ "plugins/template-function-regex",
+ "plugins/template-function-request",
+ "plugins/template-function-response",
+ "plugins/template-function-uuid",
+ "plugins/template-function-xml",
"src-tauri/yaak-crypto",
"src-tauri/yaak-git",
"src-tauri/yaak-license",
@@ -39,7 +62,8 @@
"nodejs-file-downloader": "^4.13.0",
"npm-run-all": "^4.1.5",
"prettier": "^3.4.2",
- "typescript": "^5.8.2"
+ "typescript": "^5.8.2",
+ "workspaces-run": "^1.0.2"
}
},
"node_modules/@alloc/quick-lru": {
@@ -1200,6 +1224,19 @@
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
}
},
+ "node_modules/@exodus/schemasafe": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/@exodus/schemasafe/-/schemasafe-1.3.0.tgz",
+ "integrity": "sha512-5Aap/GaRupgNx/feGBwLLTVv8OQFfv3pq2lPRzPg9R+IOBnDgghTGW7l7EuVXOvg5cc/xSAlRW8rBrjIC3Nvqw==",
+ "license": "MIT"
+ },
+ "node_modules/@faker-js/faker": {
+ "version": "5.5.3",
+ "resolved": "https://registry.npmjs.org/@faker-js/faker/-/faker-5.5.3.tgz",
+ "integrity": "sha512-R11tGE6yIFwqpaIqcfkcg7AICXzFg14+5h5v0TfF/9+RMDL6jhzCy/pxHVOfbALGdtVYdt6JdR21tuxEgl34dw==",
+ "deprecated": "Please update to a newer version.",
+ "license": "MIT"
+ },
"node_modules/@gilbarbara/deep-equal": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/@gilbarbara/deep-equal/-/deep-equal-0.3.1.tgz",
@@ -1406,6 +1443,30 @@
"@jridgewell/sourcemap-codec": "^1.4.14"
}
},
+ "node_modules/@jsep-plugin/assignment": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/@jsep-plugin/assignment/-/assignment-1.3.0.tgz",
+ "integrity": "sha512-VVgV+CXrhbMI3aSusQyclHkenWSAm95WaiKrMxRFam3JSUiIaQjoMIw2sEs/OX4XifnqeQUN4DYbJjlA8EfktQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 10.16.0"
+ },
+ "peerDependencies": {
+ "jsep": "^0.4.0||^1.0.0"
+ }
+ },
+ "node_modules/@jsep-plugin/regex": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/@jsep-plugin/regex/-/regex-1.0.4.tgz",
+ "integrity": "sha512-q7qL4Mgjs1vByCaTnDFcBnV9HS7GVPJX5vyVoCgZHNSC9rjwIlmbXG5sUuorR5ndfHAIlJ8pVStxvjXHbNvtUg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 10.16.0"
+ },
+ "peerDependencies": {
+ "jsep": "^0.4.0||^1.0.0"
+ }
+ },
"node_modules/@lezer/common": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.2.2.tgz",
@@ -1556,6 +1617,20 @@
"semver": "bin/semver.js"
}
},
+ "node_modules/@mrmlnc/readdir-enhanced": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz",
+ "integrity": "sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-me-maybe": "^1.0.1",
+ "glob-to-regexp": "^0.3.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
"node_modules/@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@@ -3083,6 +3158,17 @@
"@types/estree": "*"
}
},
+ "node_modules/@types/glob": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz",
+ "integrity": "sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/minimatch": "*",
+ "@types/node": "*"
+ }
+ },
"node_modules/@types/hast": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz",
@@ -3111,6 +3197,24 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/@types/jsonpath": {
+ "version": "0.2.4",
+ "resolved": "https://registry.npmjs.org/@types/jsonpath/-/jsonpath-0.2.4.tgz",
+ "integrity": "sha512-K3hxB8Blw0qgW6ExKgMbXQv2UPZBoE2GqLpVY+yr7nMD2Pq86lsuIzyAaiQ7eMqFL5B6di6pxSkogLJEyEHoGA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/jsonwebtoken": {
+ "version": "9.0.9",
+ "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-9.0.9.tgz",
+ "integrity": "sha512-uoe+GxEuHbvy12OUQct2X9JenKM3qAscquYymuQN4fMWG9DBQtykrQEFcAbVACF7qaLw9BePSodUL0kquqBJpQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/ms": "*",
+ "@types/node": "*"
+ }
+ },
"node_modules/@types/mdast": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz",
@@ -3120,6 +3224,20 @@
"@types/unist": "*"
}
},
+ "node_modules/@types/minimatch": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-5.1.2.tgz",
+ "integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/minimist": {
+ "version": "1.2.5",
+ "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.5.tgz",
+ "integrity": "sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@types/ms": {
"version": "0.7.34",
"resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.34.tgz",
@@ -3135,6 +3253,23 @@
"undici-types": "~6.19.2"
}
},
+ "node_modules/@types/normalize-package-data": {
+ "version": "2.4.4",
+ "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz",
+ "integrity": "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/openapi-to-postmanv2": {
+ "version": "3.2.4",
+ "resolved": "https://registry.npmjs.org/@types/openapi-to-postmanv2/-/openapi-to-postmanv2-3.2.4.tgz",
+ "integrity": "sha512-5SMU3TY2gmQRs6Ri7WRlI7tF2QEK0K4GfL50ghAPOUv4NkxhG37Aq2qystytm9fcmUgHDfyrkwZyprRgp85mxg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/postman-collection": "*"
+ }
+ },
"node_modules/@types/papaparse": {
"version": "5.3.14",
"resolved": "https://registry.npmjs.org/@types/papaparse/-/papaparse-5.3.14.tgz",
@@ -3159,6 +3294,16 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/@types/postman-collection": {
+ "version": "3.5.11",
+ "resolved": "https://registry.npmjs.org/@types/postman-collection/-/postman-collection-3.5.11.tgz",
+ "integrity": "sha512-BZgBJDdX6jyy9hzSTIMRhCsxhF0IlzPr1i98q2wdkDo8rZrbNoBvs+3/Vw+LOIIAFH1G+FyXo5Fjf8qbawGeHg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/node": "*"
+ }
+ },
"node_modules/@types/prop-types": {
"version": "15.7.13",
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.13.tgz",
@@ -3185,6 +3330,13 @@
"@types/react": "*"
}
},
+ "node_modules/@types/shell-quote": {
+ "version": "1.7.5",
+ "resolved": "https://registry.npmjs.org/@types/shell-quote/-/shell-quote-1.7.5.tgz",
+ "integrity": "sha512-+UE8GAGRPbJVQDdxi16dgadcBfQ+KG2vgZhV1+3A1XmHbmwcdwhCUwIdy+d3pAGrbvgRoVSjeI9vOWyq376Yzw==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@types/unist": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz",
@@ -3434,6 +3586,15 @@
"vite": "^4.2.0 || ^5.0.0"
}
},
+ "node_modules/@xmldom/xmldom": {
+ "version": "0.8.10",
+ "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.10.tgz",
+ "integrity": "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=10.0.0"
+ }
+ },
"node_modules/@xobotyi/scrollbar-width": {
"version": "1.9.5",
"resolved": "https://registry.npmjs.org/@xobotyi/scrollbar-width/-/scrollbar-width-1.9.5.tgz",
@@ -3496,6 +3657,98 @@
"resolved": "src-web",
"link": true
},
+ "node_modules/@yaakapp/auth-basic": {
+ "resolved": "plugins/auth-basic",
+ "link": true
+ },
+ "node_modules/@yaakapp/auth-bearer": {
+ "resolved": "plugins/auth-bearer",
+ "link": true
+ },
+ "node_modules/@yaakapp/auth-jwt": {
+ "resolved": "plugins/auth-jwt",
+ "link": true
+ },
+ "node_modules/@yaakapp/auth-oauth2": {
+ "resolved": "plugins/auth-oauth2",
+ "link": true
+ },
+ "node_modules/@yaakapp/exporter-curl": {
+ "resolved": "plugins/exporter-curl",
+ "link": true
+ },
+ "node_modules/@yaakapp/filter-jsonpath": {
+ "resolved": "plugins/filter-jsonpath",
+ "link": true
+ },
+ "node_modules/@yaakapp/filter-xpath": {
+ "resolved": "plugins/filter-xpath",
+ "link": true
+ },
+ "node_modules/@yaakapp/importer-curl": {
+ "resolved": "plugins/importer-curl",
+ "link": true
+ },
+ "node_modules/@yaakapp/importer-insomnia": {
+ "resolved": "plugins/importer-insomnia",
+ "link": true
+ },
+ "node_modules/@yaakapp/importer-openapi": {
+ "resolved": "plugins/importer-openapi",
+ "link": true
+ },
+ "node_modules/@yaakapp/importer-postman": {
+ "resolved": "plugins/importer-postman",
+ "link": true
+ },
+ "node_modules/@yaakapp/importer-yaak": {
+ "resolved": "plugins/importer-yaak",
+ "link": true
+ },
+ "node_modules/@yaakapp/template-function-cookie": {
+ "resolved": "plugins/template-function-cookie",
+ "link": true
+ },
+ "node_modules/@yaakapp/template-function-encode": {
+ "resolved": "plugins/template-function-encode",
+ "link": true
+ },
+ "node_modules/@yaakapp/template-function-fs": {
+ "resolved": "plugins/template-function-fs",
+ "link": true
+ },
+ "node_modules/@yaakapp/template-function-hash": {
+ "resolved": "plugins/template-function-hash",
+ "link": true
+ },
+ "node_modules/@yaakapp/template-function-json": {
+ "resolved": "plugins/template-function-json",
+ "link": true
+ },
+ "node_modules/@yaakapp/template-function-prompt": {
+ "resolved": "plugins/template-function-prompt",
+ "link": true
+ },
+ "node_modules/@yaakapp/template-function-regex": {
+ "resolved": "plugins/template-function-regex",
+ "link": true
+ },
+ "node_modules/@yaakapp/template-function-request": {
+ "resolved": "plugins/template-function-request",
+ "link": true
+ },
+ "node_modules/@yaakapp/template-function-response": {
+ "resolved": "plugins/template-function-response",
+ "link": true
+ },
+ "node_modules/@yaakapp/template-function-uuid": {
+ "resolved": "plugins/template-function-uuid",
+ "link": true
+ },
+ "node_modules/@yaakapp/template-function-xml": {
+ "resolved": "plugins/template-function-xml",
+ "link": true
+ },
"node_modules/abbrev": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
@@ -3573,6 +3826,45 @@
"url": "https://github.com/sponsors/epoberezkin"
}
},
+ "node_modules/ajv-formats": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz",
+ "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==",
+ "license": "MIT",
+ "dependencies": {
+ "ajv": "^8.0.0"
+ },
+ "peerDependencies": {
+ "ajv": "^8.0.0"
+ },
+ "peerDependenciesMeta": {
+ "ajv": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/ajv-formats/node_modules/ajv": {
+ "version": "8.17.1",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz",
+ "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==",
+ "license": "MIT",
+ "dependencies": {
+ "fast-deep-equal": "^3.1.3",
+ "fast-uri": "^3.0.1",
+ "json-schema-traverse": "^1.0.0",
+ "require-from-string": "^2.0.2"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/epoberezkin"
+ }
+ },
+ "node_modules/ajv-formats/node_modules/json-schema-traverse": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
+ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
+ "license": "MIT"
+ },
"node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
@@ -3648,7 +3940,6 @@
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
- "dev": true,
"license": "Python-2.0"
},
"node_modules/aria-query": {
@@ -3661,6 +3952,36 @@
"node": ">= 0.4"
}
},
+ "node_modules/arr-diff": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz",
+ "integrity": "sha512-YVIQ82gZPGBebQV/a8dar4AitzCQs0jjXwMPZllpXMaGjXPYVUawSxQrRsjhjupyVxEvbHgUmIhKVlND+j02kA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/arr-flatten": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz",
+ "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/arr-union": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz",
+ "integrity": "sha512-sKpyeERZ02v1FeCZT8lrfJq5u6goHCtpTAzPwJYe7c8SPFOboNjNg1vz2L4VTn9T4PQxEx13TbXLmYUcS6Ug7Q==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/array-buffer-byte-length": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.1.tgz",
@@ -3698,6 +4019,39 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/array-union": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz",
+ "integrity": "sha512-Dxr6QJj/RdU/hCaBjOfxW+q6lyuVE6JFWIrAUpuOOhoJJoQ99cUn3igRaHVB5P9WrgFVN0FfArM3x0cueOU8ng==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "array-uniq": "^1.0.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/array-uniq": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz",
+ "integrity": "sha512-MNha4BWQ6JbwhFhj03YK552f7cb3AzoE8SzeljgChvL1dl3IcvggXVz1DilzySZkCja+CXuZbdW7yATchWn8/Q==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/array-unique": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz",
+ "integrity": "sha512-SleRWjh9JUud2wH1hPs9rZBZ33H6T9HOiL0uwGnGx9FpE6wKGyfWugmbkEOIs6qWrZhg0LWeLziLrEwQJhs5mQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/array.prototype.findlast": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/array.prototype.findlast/-/array.prototype.findlast-1.2.5.tgz",
@@ -3831,6 +4185,16 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/assign-symbols": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz",
+ "integrity": "sha512-Q+JC7Whu8HhmTdBph/Tq59IoRtoy6KAm5zzPv00WdujX82lbAL8K7WVjne7vdCsAmbF4AYaDOPyO3k0kl8qIrw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/ast-types-flow": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.8.tgz",
@@ -3838,6 +4202,25 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/async": {
+ "version": "3.2.4",
+ "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz",
+ "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==",
+ "license": "MIT"
+ },
+ "node_modules/atob": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz",
+ "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==",
+ "dev": true,
+ "license": "(MIT OR Apache-2.0)",
+ "bin": {
+ "atob": "bin/atob.js"
+ },
+ "engines": {
+ "node": ">= 4.5.0"
+ }
+ },
"node_modules/autoprefixer": {
"version": "10.4.20",
"resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.20.tgz",
@@ -3950,6 +4333,38 @@
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"license": "MIT"
},
+ "node_modules/base": {
+ "version": "0.11.2",
+ "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz",
+ "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "cache-base": "^1.0.1",
+ "class-utils": "^0.3.5",
+ "component-emitter": "^1.2.1",
+ "define-property": "^1.0.0",
+ "isobject": "^3.0.1",
+ "mixin-deep": "^1.2.0",
+ "pascalcase": "^0.1.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/base/node_modules/define-property": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz",
+ "integrity": "sha512-cZTYKFWspt9jZsMscWo8sc/5lbPC9Q0N5nBLgb+Yd915iL3udB1uFgS3B8YCx66UVHq018DAVFoee7x+gxggeA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-descriptor": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/base64-js": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
@@ -4154,6 +4569,12 @@
"node": "*"
}
},
+ "node_modules/buffer-equal-constant-time": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz",
+ "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==",
+ "license": "BSD-3-Clause"
+ },
"node_modules/buffer-fill": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz",
@@ -4161,6 +4582,27 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/cache-base": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz",
+ "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "collection-visit": "^1.0.0",
+ "component-emitter": "^1.2.1",
+ "get-value": "^2.0.6",
+ "has-value": "^1.0.0",
+ "isobject": "^3.0.1",
+ "set-value": "^2.0.0",
+ "to-object-path": "^0.3.0",
+ "union-value": "^1.0.0",
+ "unset-value": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/call-bind": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz",
@@ -4209,6 +4651,12 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/call-me-maybe": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.2.tgz",
+ "integrity": "sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==",
+ "license": "MIT"
+ },
"node_modules/callsites": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
@@ -4219,6 +4667,15 @@
"node": ">=6"
}
},
+ "node_modules/camelcase": {
+ "version": "5.3.1",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
+ "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/camelcase-css": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/camelcase-css/-/camelcase-css-2.0.1.tgz",
@@ -4228,6 +4685,24 @@
"node": ">= 6"
}
},
+ "node_modules/camelcase-keys": {
+ "version": "6.2.2",
+ "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz",
+ "integrity": "sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "camelcase": "^5.3.1",
+ "map-obj": "^4.0.0",
+ "quick-lru": "^4.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/caniuse-lite": {
"version": "1.0.30001712",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001712.tgz",
@@ -4332,6 +4807,15 @@
"url": "https://github.com/sponsors/wooorm"
}
},
+ "node_modules/charset": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/charset/-/charset-1.0.1.tgz",
+ "integrity": "sha512-6dVyOOYjpfFcL1Y4qChrAoQLRHvj2ziyhcm0QJlhOcAhykL/k1kTUPbeo+87MNRTRdk2OIIsIXbuF3x2wi5EXg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=4.0.0"
+ }
+ },
"node_modules/chokidar": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
@@ -4378,6 +4862,13 @@
"node": ">=10"
}
},
+ "node_modules/chunkd": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/chunkd/-/chunkd-2.0.1.tgz",
+ "integrity": "sha512-7d58XsFmOq0j6el67Ug9mHf9ELUXsQXYJBkyxhH/k+6Ke0qXRnv0kbemx+Twc6fRJ07C49lcbdgm9FL1Ei/6SQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/cidr-regex": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/cidr-regex/-/cidr-regex-4.0.3.tgz",
@@ -4407,6 +4898,49 @@
"node": ">=16"
}
},
+ "node_modules/class-utils": {
+ "version": "0.3.6",
+ "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz",
+ "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "arr-union": "^3.1.0",
+ "define-property": "^0.2.5",
+ "isobject": "^3.0.0",
+ "static-extend": "^0.1.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/class-utils/node_modules/define-property": {
+ "version": "0.2.5",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
+ "integrity": "sha512-Rr7ADjQZenceVOAKop6ALkkRAmH1A4Gx9hV/7ZujPUN2rkATqFO0JZLZInbAjpZYoJ1gUx8MRMQVkYemcbMSTA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-descriptor": "^0.1.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/class-utils/node_modules/is-descriptor": {
+ "version": "0.1.7",
+ "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.7.tgz",
+ "integrity": "sha512-C3grZTvObeN1xud4cRWl366OMXZTj0+HGyk4hvfpx4ZHt1Pb60ANSXqCK7pdOTeUQpRzECBSTphqvD7U+l22Eg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-accessor-descriptor": "^1.0.1",
+ "is-data-descriptor": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/classnames": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/classnames/-/classnames-2.5.1.tgz",
@@ -4525,6 +5059,20 @@
"node": ">=6"
}
},
+ "node_modules/collection-visit": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz",
+ "integrity": "sha512-lNkKvzEeMBBjUGHZ+q6z9pSJla0KWAQPvtzhEV9+iGyQYG+pBpl7xKDhxoNSOZH2hhv0v5k0y2yAM4o4SjoSkw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "map-visit": "^1.0.0",
+ "object-visit": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
@@ -4569,6 +5117,37 @@
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"license": "MIT"
},
+ "node_modules/component-emitter": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.1.tgz",
+ "integrity": "sha512-T0+barUSQRTUQASh8bx02dl+DhF54GtIDY13Y3m9oWTklKbb3Wv974meRpeZ3lp1JpLVECWWNHC4vaG2XHXouQ==",
+ "dev": true,
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/compute-gcd": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/compute-gcd/-/compute-gcd-1.2.1.tgz",
+ "integrity": "sha512-TwMbxBNz0l71+8Sc4czv13h4kEqnchV9igQZBi6QUaz09dnz13juGnnaWWJTRsP3brxOoxeB4SA2WELLw1hCtg==",
+ "dependencies": {
+ "validate.io-array": "^1.0.3",
+ "validate.io-function": "^1.0.2",
+ "validate.io-integer-array": "^1.0.0"
+ }
+ },
+ "node_modules/compute-lcm": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/compute-lcm/-/compute-lcm-1.1.2.tgz",
+ "integrity": "sha512-OFNPdQAXnQhDSKioX8/XYT6sdUlXwpeMjfd6ApxMJfyZ4GxmLR1xvMERctlYhlHwIiz6CSpBc2+qYKjHGZw4TQ==",
+ "dependencies": {
+ "compute-gcd": "^1.2.1",
+ "validate.io-array": "^1.0.3",
+ "validate.io-function": "^1.0.2",
+ "validate.io-integer-array": "^1.0.0"
+ }
+ },
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@@ -4603,6 +5182,16 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/copy-descriptor": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz",
+ "integrity": "sha512-XgZ0pFcakEUlbwQEVNg3+QAis1FyTL3Qel9FYy8pSkQqoG3PNoT0bOCQtOXcOkur21r2Eq2kI+IE+gsmAEVlYw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/copy-to-clipboard": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/copy-to-clipboard/-/copy-to-clipboard-3.3.3.tgz",
@@ -4904,6 +5493,33 @@
"node": ">=0.10.0"
}
},
+ "node_modules/decamelize-keys": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.1.tgz",
+ "integrity": "sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "decamelize": "^1.1.0",
+ "map-obj": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/decamelize-keys/node_modules/map-obj": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz",
+ "integrity": "sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/decode-named-character-reference": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.0.2.tgz",
@@ -4917,6 +5533,16 @@
"url": "https://github.com/sponsors/wooorm"
}
},
+ "node_modules/decode-uri-component": {
+ "version": "0.2.2",
+ "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz",
+ "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10"
+ }
+ },
"node_modules/decompress": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/decompress/-/decompress-4.2.1.tgz",
@@ -5135,6 +5761,20 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/define-property": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz",
+ "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-descriptor": "^1.0.2",
+ "isobject": "^3.0.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/delegates": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
@@ -5273,6 +5913,43 @@
"node": ">= 0.4"
}
},
+ "node_modules/duplexer2": {
+ "version": "0.0.2",
+ "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.0.2.tgz",
+ "integrity": "sha512-+AWBwjGadtksxjOQSFDhPNQbed7icNXApT4+2BNpsXzcCBiInq2H9XW0O8sfHFaPmnQRs7cg/P0fAr2IWQSW0g==",
+ "dev": true,
+ "license": "BSD",
+ "dependencies": {
+ "readable-stream": "~1.1.9"
+ }
+ },
+ "node_modules/duplexer2/node_modules/isarray": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
+ "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/duplexer2/node_modules/readable-stream": {
+ "version": "1.1.14",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
+ "integrity": "sha512-+MeVjFf4L44XUkhM1eYbD8fyEsxcV81pqMSR5gblfcLCHfZvbrqy4/qYHE+/R5HoBUT11WV5O08Cr1n3YXkWVQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "core-util-is": "~1.0.0",
+ "inherits": "~2.0.1",
+ "isarray": "0.0.1",
+ "string_decoder": "~0.10.x"
+ }
+ },
+ "node_modules/duplexer2/node_modules/string_decoder": {
+ "version": "0.10.31",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
+ "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/eastasianwidth": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
@@ -5288,6 +5965,15 @@
"ebnf": "dist/bin.js"
}
},
+ "node_modules/ecdsa-sig-formatter": {
+ "version": "1.0.11",
+ "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",
+ "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "safe-buffer": "^5.0.1"
+ }
+ },
"node_modules/electron-to-chromium": {
"version": "1.5.34",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.34.tgz",
@@ -5523,6 +6209,12 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/es6-promise": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz",
+ "integrity": "sha512-SOp9Phqvqn7jtEUxPWdWfWoLmyt2VaJ6MpvP9Comy1MceMXqE6bxvaTu4iaxpYYPzhny28Lc+M87/c2cPK6lDg==",
+ "license": "MIT"
+ },
"node_modules/esbuild": {
"version": "0.24.2",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.24.2.tgz",
@@ -5587,7 +6279,6 @@
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",
"integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
- "dev": true,
"license": "MIT",
"engines": {
"node": ">=6"
@@ -6183,12 +6874,168 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/expand-brackets": {
+ "version": "2.1.4",
+ "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz",
+ "integrity": "sha512-w/ozOKR9Obk3qoWeY/WDi6MFta9AoMR+zud60mdnbniMcBxRuFJyDt2LdX/14A1UABeqk+Uk+LDfUpvoGKppZA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "debug": "^2.3.3",
+ "define-property": "^0.2.5",
+ "extend-shallow": "^2.0.1",
+ "posix-character-classes": "^0.1.0",
+ "regex-not": "^1.0.0",
+ "snapdragon": "^0.8.1",
+ "to-regex": "^3.0.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/expand-brackets/node_modules/debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ms": "2.0.0"
+ }
+ },
+ "node_modules/expand-brackets/node_modules/define-property": {
+ "version": "0.2.5",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
+ "integrity": "sha512-Rr7ADjQZenceVOAKop6ALkkRAmH1A4Gx9hV/7ZujPUN2rkATqFO0JZLZInbAjpZYoJ1gUx8MRMQVkYemcbMSTA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-descriptor": "^0.1.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/expand-brackets/node_modules/extend-shallow": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
+ "integrity": "sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-extendable": "^0.1.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/expand-brackets/node_modules/is-descriptor": {
+ "version": "0.1.7",
+ "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.7.tgz",
+ "integrity": "sha512-C3grZTvObeN1xud4cRWl366OMXZTj0+HGyk4hvfpx4ZHt1Pb60ANSXqCK7pdOTeUQpRzECBSTphqvD7U+l22Eg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-accessor-descriptor": "^1.0.1",
+ "is-data-descriptor": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/expand-brackets/node_modules/is-extendable": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz",
+ "integrity": "sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/expand-brackets/node_modules/ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/extend": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
"integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==",
"license": "MIT"
},
+ "node_modules/extend-shallow": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz",
+ "integrity": "sha512-BwY5b5Ql4+qZoefgMj2NUmx+tehVTH/Kf4k1ZEtOHNFcm2wSxMRo992l6X3TIgni2eZVTZ85xMOjF31fwZAj6Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "assign-symbols": "^1.0.0",
+ "is-extendable": "^1.0.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/extglob": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz",
+ "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "array-unique": "^0.3.2",
+ "define-property": "^1.0.0",
+ "expand-brackets": "^2.1.4",
+ "extend-shallow": "^2.0.1",
+ "fragment-cache": "^0.2.1",
+ "regex-not": "^1.0.0",
+ "snapdragon": "^0.8.1",
+ "to-regex": "^3.0.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/extglob/node_modules/define-property": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz",
+ "integrity": "sha512-cZTYKFWspt9jZsMscWo8sc/5lbPC9Q0N5nBLgb+Yd915iL3udB1uFgS3B8YCx66UVHq018DAVFoee7x+gxggeA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-descriptor": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/extglob/node_modules/extend-shallow": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
+ "integrity": "sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-extendable": "^0.1.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/extglob/node_modules/is-extendable": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz",
+ "integrity": "sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/fast-copy": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/fast-copy/-/fast-copy-3.0.2.tgz",
@@ -6243,11 +7090,33 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/fast-safe-stringify": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz",
+ "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==",
+ "license": "MIT"
+ },
"node_modules/fast-shallow-equal": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fast-shallow-equal/-/fast-shallow-equal-1.0.0.tgz",
"integrity": "sha512-HPtaa38cPgWvaCFmRNhlc6NG7pv6NUHqjPgVAkWGoB9mQMwYB27/K0CvOM5Czy+qpT3e8XJ6Q4aPAnzpNpzNaw=="
},
+ "node_modules/fast-uri": {
+ "version": "3.0.6",
+ "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.6.tgz",
+ "integrity": "sha512-Atfo14OibSv5wAp4VWNsFYE1AchQRTv9cBGWET4pZWHzYshFSS9NQI6I57rdKn9croWVMbYFbLhJ+yJvmZIIHw==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/fastify"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/fastify"
+ }
+ ],
+ "license": "BSD-3-Clause"
+ },
"node_modules/fastest-stable-stringify": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/fastest-stable-stringify/-/fastest-stable-stringify-2.0.2.tgz",
@@ -6401,6 +7270,22 @@
"is-callable": "^1.1.3"
}
},
+ "node_modules/for-in": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz",
+ "integrity": "sha512-7EwmXrOjyL+ChxMhmG5lnW9MPt1aIeZEwKhQzoBUdTV0N3zuwWDZYVJatDvZ2OyzPUvdIAZDsCetk3coyMfcnQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/foreach": {
+ "version": "2.0.6",
+ "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.6.tgz",
+ "integrity": "sha512-k6GAGDyqLe9JaebCsFCoudPPWfihKu8pylYXRlqP1J7ms39iPoTtk2fviNglIeQEwdh0bQeKJ01ZPyuyQvKzwg==",
+ "license": "MIT"
+ },
"node_modules/foreground-child": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz",
@@ -6467,6 +7352,19 @@
"url": "https://github.com/sponsors/rawify"
}
},
+ "node_modules/fragment-cache": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz",
+ "integrity": "sha512-GMBAbW9antB8iZRHLoGw0b3HANt57diZYFO/HL1JGIC1MjKrdmhxvrJbupnVvpys0zsz7yBApXdQyfepKly2kA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "map-cache": "^0.2.2"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/framer-motion": {
"version": "12.4.7",
"resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-12.4.7.tgz",
@@ -6501,6 +7399,21 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/fs-extra": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz",
+ "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "graceful-fs": "^4.1.2",
+ "jsonfile": "^4.0.0",
+ "universalify": "^0.1.0"
+ },
+ "engines": {
+ "node": ">=6 <7 || >=8"
+ }
+ },
"node_modules/fs-minipass": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz",
@@ -6734,6 +7647,289 @@
"url": "https://github.com/privatenumber/get-tsconfig?sponsor=1"
}
},
+ "node_modules/get-value": {
+ "version": "2.0.6",
+ "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz",
+ "integrity": "sha512-Ln0UQDlxH1BapMu3GPtf7CuYNwRZf2gwCuPqbyG6pB8WfmFpzqcy4xtAaAMUhnNqjMKTiCPZG2oMT3YSx8U2NA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/get-workspaces": {
+ "version": "0.5.2",
+ "resolved": "https://registry.npmjs.org/get-workspaces/-/get-workspaces-0.5.2.tgz",
+ "integrity": "sha512-99x72taQ9OUHhCmBS0B2WI/zwOtBOBPoyVNGs9+B0ag2GGhCjl/EaU9VQ8Zorx64TyVj1Am7bO+0J1KwDqo7OA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@changesets/types": "^0.4.0",
+ "fs-extra": "^7.0.1",
+ "globby": "^9.2.0"
+ }
+ },
+ "node_modules/get-workspaces/node_modules/@changesets/types": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/@changesets/types/-/types-0.4.0.tgz",
+ "integrity": "sha512-TclHHKDVYQ8rJGZgVeWiF7c91yWzTTWdPagltgutelGu/Psup5PQlUq6svx7S8suj+jXcaE34yEEsfIvzXXB2Q==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/get-workspaces/node_modules/@nodelib/fs.stat": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz",
+ "integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/get-workspaces/node_modules/braces": {
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz",
+ "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "arr-flatten": "^1.1.0",
+ "array-unique": "^0.3.2",
+ "extend-shallow": "^2.0.1",
+ "fill-range": "^4.0.0",
+ "isobject": "^3.0.1",
+ "repeat-element": "^1.1.2",
+ "snapdragon": "^0.8.1",
+ "snapdragon-node": "^2.0.1",
+ "split-string": "^3.0.2",
+ "to-regex": "^3.0.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/get-workspaces/node_modules/braces/node_modules/extend-shallow": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
+ "integrity": "sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-extendable": "^0.1.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/get-workspaces/node_modules/dir-glob": {
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.2.2.tgz",
+ "integrity": "sha512-f9LBi5QWzIW3I6e//uxZoLBlUt9kcp66qo0sSCxL6YZKc75R1c4MFCoe/LaZiBGmgujvQdxc5Bn3QhfyvK5Hsw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "path-type": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/get-workspaces/node_modules/fast-glob": {
+ "version": "2.2.7",
+ "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-2.2.7.tgz",
+ "integrity": "sha512-g1KuQwHOZAmOZMuBtHdxDtju+T2RT8jgCC9aANsbpdiDDTSnjgfuVsIBNKbUeJI3oKMRExcfNDtJl4OhbffMsw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@mrmlnc/readdir-enhanced": "^2.2.1",
+ "@nodelib/fs.stat": "^1.1.2",
+ "glob-parent": "^3.1.0",
+ "is-glob": "^4.0.0",
+ "merge2": "^1.2.3",
+ "micromatch": "^3.1.10"
+ },
+ "engines": {
+ "node": ">=4.0.0"
+ }
+ },
+ "node_modules/get-workspaces/node_modules/fill-range": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz",
+ "integrity": "sha512-VcpLTWqWDiTerugjj8e3+esbg+skS3M9e54UuR3iCeIDMXCLTsAH8hTSzDQU/X6/6t3eYkOKoZSef2PlU6U1XQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "extend-shallow": "^2.0.1",
+ "is-number": "^3.0.0",
+ "repeat-string": "^1.6.1",
+ "to-regex-range": "^2.1.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/get-workspaces/node_modules/fill-range/node_modules/extend-shallow": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
+ "integrity": "sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-extendable": "^0.1.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/get-workspaces/node_modules/glob-parent": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz",
+ "integrity": "sha512-E8Ak/2+dZY6fnzlR7+ueWvhsH1SjHr4jjss4YS/h4py44jY9MhK/VFdaZJAWDz6BbL21KeteKxFSFpq8OS5gVA==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "is-glob": "^3.1.0",
+ "path-dirname": "^1.0.0"
+ }
+ },
+ "node_modules/get-workspaces/node_modules/glob-parent/node_modules/is-glob": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz",
+ "integrity": "sha512-UFpDDrPgM6qpnFNI+rh/p3bUaq9hKLZN8bMUWzxmcnZVS3omf4IPK+BrewlnWjO1WmUsMYuSjKh4UJuV4+Lqmw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-extglob": "^2.1.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/get-workspaces/node_modules/globby": {
+ "version": "9.2.0",
+ "resolved": "https://registry.npmjs.org/globby/-/globby-9.2.0.tgz",
+ "integrity": "sha512-ollPHROa5mcxDEkwg6bPt3QbEf4pDQSNtd6JPL1YvOvAo/7/0VAm9TccUeoTmarjPw4pfUthSCqcyfNB1I3ZSg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/glob": "^7.1.1",
+ "array-union": "^1.0.2",
+ "dir-glob": "^2.2.2",
+ "fast-glob": "^2.2.6",
+ "glob": "^7.1.3",
+ "ignore": "^4.0.3",
+ "pify": "^4.0.1",
+ "slash": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/get-workspaces/node_modules/ignore": {
+ "version": "4.0.6",
+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz",
+ "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 4"
+ }
+ },
+ "node_modules/get-workspaces/node_modules/is-extendable": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz",
+ "integrity": "sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/get-workspaces/node_modules/is-number": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz",
+ "integrity": "sha512-4cboCqIpliH+mAvFNegjZQ4kgKc3ZUhQVr3HvWbSh5q3WH2v82ct+T2Y1hdU5Gdtorx/cLifQjqCbL7bpznLTg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "kind-of": "^3.0.2"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/get-workspaces/node_modules/is-number/node_modules/kind-of": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+ "integrity": "sha512-NOW9QQXMoZGg/oqnVNoNTTIFEIid1627WCffUBJEdMxYApq7mNE7CpzucIPc+ZQg25Phej7IJSmX3hO+oblOtQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-buffer": "^1.1.5"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/get-workspaces/node_modules/micromatch": {
+ "version": "3.1.10",
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz",
+ "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "arr-diff": "^4.0.0",
+ "array-unique": "^0.3.2",
+ "braces": "^2.3.1",
+ "define-property": "^2.0.2",
+ "extend-shallow": "^3.0.2",
+ "extglob": "^2.0.4",
+ "fragment-cache": "^0.2.1",
+ "kind-of": "^6.0.2",
+ "nanomatch": "^1.2.9",
+ "object.pick": "^1.3.0",
+ "regex-not": "^1.0.0",
+ "snapdragon": "^0.8.1",
+ "to-regex": "^3.0.2"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/get-workspaces/node_modules/pify": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz",
+ "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/get-workspaces/node_modules/slash": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz",
+ "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/get-workspaces/node_modules/to-regex-range": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz",
+ "integrity": "sha512-ZZWNfCjUokXXDGXFpZehJIkZqq91BcULFq/Pi7M5i4JnxXdhMKAK682z8bCW3o8Hj1wuuzoKcW3DfVzaP6VuNg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-number": "^3.0.0",
+ "repeat-string": "^1.6.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/glob": {
"version": "7.2.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
@@ -6768,6 +7964,13 @@
"node": ">=10.13.0"
}
},
+ "node_modules/glob-to-regexp": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz",
+ "integrity": "sha512-Iozmtbqv0noj0uDDqoL0zNq0VBEfK2YFoMAZoxJe4cwphvLR+JskfF30QhXHOR4m3KrE6NLRYw+U9MRXvifyig==",
+ "dev": true,
+ "license": "BSD"
+ },
"node_modules/glob/node_modules/brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
@@ -6871,6 +8074,15 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/graphlib": {
+ "version": "2.1.8",
+ "resolved": "https://registry.npmjs.org/graphlib/-/graphlib-2.1.8.tgz",
+ "integrity": "sha512-jcLLfkpoVGmH7/InMC/1hIvOPSUh38oJtGhvrOFGzioE1DZ+0YW16RgmOJhHiuWTvGiJQ9Z1Ik43JvkRPRvE+A==",
+ "license": "MIT",
+ "dependencies": {
+ "lodash": "^4.17.15"
+ }
+ },
"node_modules/graphql": {
"version": "16.9.0",
"resolved": "https://registry.npmjs.org/graphql/-/graphql-16.9.0.tgz",
@@ -6898,6 +8110,16 @@
"graphql": "^15.5.0 || ^16.0.0 || ^17.0.0-alpha.2"
}
},
+ "node_modules/hard-rejection": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz",
+ "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/has-bigints": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz",
@@ -6976,6 +8198,74 @@
"license": "ISC",
"optional": true
},
+ "node_modules/has-value": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz",
+ "integrity": "sha512-IBXk4GTsLYdQ7Rvt+GRBrFSVEkmuOUy4re0Xjd9kJSUQpnTrWR4/y9RpfexN9vkAPMFuQoeWKwqzPozRTlasGw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "get-value": "^2.0.6",
+ "has-values": "^1.0.0",
+ "isobject": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/has-values": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz",
+ "integrity": "sha512-ODYZC64uqzmtfGMEAX/FvZiRyWLpAC3vYnNunURUnkGVTS+mI0smVsWaPydRBsE3g+ok7h960jChO8mFcWlHaQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-number": "^3.0.0",
+ "kind-of": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/has-values/node_modules/is-number": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz",
+ "integrity": "sha512-4cboCqIpliH+mAvFNegjZQ4kgKc3ZUhQVr3HvWbSh5q3WH2v82ct+T2Y1hdU5Gdtorx/cLifQjqCbL7bpznLTg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "kind-of": "^3.0.2"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/has-values/node_modules/is-number/node_modules/kind-of": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+ "integrity": "sha512-NOW9QQXMoZGg/oqnVNoNTTIFEIid1627WCffUBJEdMxYApq7mNE7CpzucIPc+ZQg25Phej7IJSmX3hO+oblOtQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-buffer": "^1.1.5"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/has-values/node_modules/kind-of": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz",
+ "integrity": "sha512-24XsCxmEbRwEDbz/qz3stgin8TTzZ1ESR56OMCN0ujYg+vRutNSiOj9bHH9u85DKgXguraugV5sFuvbD4FW/hw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-buffer": "^1.1.5"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/hasown": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
@@ -7075,6 +8365,18 @@
"url": "https://opencollective.com/unified"
}
},
+ "node_modules/http-reasons": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/http-reasons/-/http-reasons-0.1.0.tgz",
+ "integrity": "sha512-P6kYh0lKZ+y29T2Gqz+RlC9WBLhKe8kDmcJ+A+611jFfxdPsbMRQ5aNmFRM3lENqFkK+HTTL+tlQviAiv0AbLQ==",
+ "license": "Apache-2.0"
+ },
+ "node_modules/http2-client": {
+ "version": "1.3.5",
+ "resolved": "https://registry.npmjs.org/http2-client/-/http2-client-1.3.5.tgz",
+ "integrity": "sha512-EC2utToWl4RKfs5zd36Mxq7nzHHBuomZboI0yYL6Y0RmBgT7Sgkq4rQ0ezFTYoIsSs7Tm9SJe+o2FcAg6GBhGA==",
+ "license": "MIT"
+ },
"node_modules/https-proxy-agent": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz",
@@ -7105,6 +8407,18 @@
"integrity": "sha512-WDC/ui2VVRrz3jOVi+XtjqkDjiVjTtFaAGiW37k6b+ohyQ5wYDOGkvCZa8+H0nx3gyvv0+BST9xuOgIyGQ00gw==",
"license": "BSD-3-Clause"
},
+ "node_modules/iconv-lite": {
+ "version": "0.6.3",
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
+ "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
+ "license": "MIT",
+ "dependencies": {
+ "safer-buffer": ">= 2.1.2 < 3.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/ieee754": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
@@ -7274,6 +8588,19 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/is-accessor-descriptor": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.1.tgz",
+ "integrity": "sha512-YBUanLI8Yoihw923YeFUS5fs0fF2f5TSFTNiYAAzhhDscDa3lEqYuz1pDOEP5KvX94I9ey3vsqjJcLVFVU+3QA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "hasown": "^2.0.0"
+ },
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
"node_modules/is-alphabetical": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz",
@@ -7393,6 +8720,13 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/is-buffer": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
+ "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/is-callable": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz",
@@ -7420,6 +8754,19 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/is-data-descriptor": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.1.tgz",
+ "integrity": "sha512-bc4NlCDiCr28U4aEsQ3Qs2491gVq4V8G7MQyws968ImqjKuYtTJXrl7Vq7jsN7Ly/C3xj5KWFrY7sHNeDkAzXw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "hasown": "^2.0.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/is-data-view": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.1.tgz",
@@ -7461,6 +8808,33 @@
"url": "https://github.com/sponsors/wooorm"
}
},
+ "node_modules/is-descriptor": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.3.tgz",
+ "integrity": "sha512-JCNNGbwWZEVaSPtS45mdtrneRWJFp07LLmykxeFV5F6oBvNF8vHSfJuJgoT472pSfk+Mf8VnlrspaFBHWM8JAw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-accessor-descriptor": "^1.0.1",
+ "is-data-descriptor": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/is-extendable": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz",
+ "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-plain-object": "^2.0.4"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/is-extglob": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
@@ -7625,6 +8999,19 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/is-plain-object": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
+ "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "isobject": "^3.0.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/is-regex": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz",
@@ -7778,6 +9165,16 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/is-windows": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz",
+ "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/isarray": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz",
@@ -7790,6 +9187,16 @@
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
"license": "ISC"
},
+ "node_modules/isobject": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
+ "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/iterator.prototype": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/iterator.prototype/-/iterator.prototype-1.1.3.tgz",
@@ -7874,7 +9281,6 @@
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
- "dev": true,
"license": "MIT",
"dependencies": {
"argparse": "^2.0.1"
@@ -7883,6 +9289,15 @@
"js-yaml": "bin/js-yaml.js"
}
},
+ "node_modules/jsep": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/jsep/-/jsep-1.4.0.tgz",
+ "integrity": "sha512-B7qPcEVE3NVkmSJbaYxvv4cHkVW7DQsZz13pUMrfS8z8Q/BuShN+gcTXrUlPiGqM2/t/EEaI030bpxMqY8gMlw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 10.16.0"
+ }
+ },
"node_modules/jsesc": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz",
@@ -7916,12 +9331,30 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/json-pointer": {
+ "version": "0.6.2",
+ "resolved": "https://registry.npmjs.org/json-pointer/-/json-pointer-0.6.2.tgz",
+ "integrity": "sha512-vLWcKbOaXlO+jvRy4qNd+TI1QUPZzfJj1tpJ3vAXDych5XJf93ftpUKe5pKCrzyIIwgBJcOcCVRUfqQP25afBw==",
+ "license": "MIT",
+ "dependencies": {
+ "foreach": "^2.0.4"
+ }
+ },
"node_modules/json-schema": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz",
"integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==",
"license": "(AFL-2.1 OR BSD-3-Clause)"
},
+ "node_modules/json-schema-compare": {
+ "version": "0.2.2",
+ "resolved": "https://registry.npmjs.org/json-schema-compare/-/json-schema-compare-0.2.2.tgz",
+ "integrity": "sha512-c4WYmDKyJXhs7WWvAWm3uIYnfyWFoIp+JEoX34rctVvEkMYCPGhXtvmFFXiffBbxfZsvQ0RNnV5H7GvDF5HCqQ==",
+ "license": "MIT",
+ "dependencies": {
+ "lodash": "^4.17.4"
+ }
+ },
"node_modules/json-schema-library": {
"version": "9.3.5",
"resolved": "https://registry.npmjs.org/json-schema-library/-/json-schema-library-9.3.5.tgz",
@@ -7937,6 +9370,20 @@
"valid-url": "^1.0.9"
}
},
+ "node_modules/json-schema-merge-allof": {
+ "version": "0.8.1",
+ "resolved": "https://registry.npmjs.org/json-schema-merge-allof/-/json-schema-merge-allof-0.8.1.tgz",
+ "integrity": "sha512-CTUKmIlPJbsWfzRRnOXz+0MjIqvnleIXwFTzz+t9T86HnYX/Rozria6ZVGLktAU9e+NygNljveP+yxqtQp/Q4w==",
+ "license": "MIT",
+ "dependencies": {
+ "compute-lcm": "^1.1.2",
+ "json-schema-compare": "^0.2.2",
+ "lodash": "^4.17.20"
+ },
+ "engines": {
+ "node": ">=12.0.0"
+ }
+ },
"node_modules/json-schema-traverse": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
@@ -7964,6 +9411,56 @@
"json5": "lib/cli.js"
}
},
+ "node_modules/jsonfile": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
+ "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==",
+ "dev": true,
+ "license": "MIT",
+ "optionalDependencies": {
+ "graceful-fs": "^4.1.6"
+ }
+ },
+ "node_modules/jsonpath-plus": {
+ "version": "10.3.0",
+ "resolved": "https://registry.npmjs.org/jsonpath-plus/-/jsonpath-plus-10.3.0.tgz",
+ "integrity": "sha512-8TNmfeTCk2Le33A3vRRwtuworG/L5RrgMvdjhKZxvyShO+mBu2fP50OWUjRLNtvw344DdDarFh9buFAZs5ujeA==",
+ "license": "MIT",
+ "dependencies": {
+ "@jsep-plugin/assignment": "^1.3.0",
+ "@jsep-plugin/regex": "^1.0.4",
+ "jsep": "^1.4.0"
+ },
+ "bin": {
+ "jsonpath": "bin/jsonpath-cli.js",
+ "jsonpath-plus": "bin/jsonpath-cli.js"
+ },
+ "engines": {
+ "node": ">=18.0.0"
+ }
+ },
+ "node_modules/jsonwebtoken": {
+ "version": "9.0.2",
+ "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz",
+ "integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==",
+ "license": "MIT",
+ "dependencies": {
+ "jws": "^3.2.2",
+ "lodash.includes": "^4.3.0",
+ "lodash.isboolean": "^3.0.3",
+ "lodash.isinteger": "^4.0.4",
+ "lodash.isnumber": "^3.0.3",
+ "lodash.isplainobject": "^4.0.6",
+ "lodash.isstring": "^4.0.1",
+ "lodash.once": "^4.0.0",
+ "ms": "^2.1.1",
+ "semver": "^7.5.4"
+ },
+ "engines": {
+ "node": ">=12",
+ "npm": ">=6"
+ }
+ },
"node_modules/jsx-ast-utils": {
"version": "3.3.5",
"resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz",
@@ -7993,6 +9490,27 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/jwa": {
+ "version": "1.4.2",
+ "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.2.tgz",
+ "integrity": "sha512-eeH5JO+21J78qMvTIDdBXidBd6nG2kZjg5Ohz/1fpa28Z4CcsWUzJ1ZZyFq/3z3N17aZy+ZuBoHljASbL1WfOw==",
+ "license": "MIT",
+ "dependencies": {
+ "buffer-equal-constant-time": "^1.0.1",
+ "ecdsa-sig-formatter": "1.0.11",
+ "safe-buffer": "^5.0.1"
+ }
+ },
+ "node_modules/jws": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz",
+ "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==",
+ "license": "MIT",
+ "dependencies": {
+ "jwa": "^1.4.1",
+ "safe-buffer": "^5.0.1"
+ }
+ },
"node_modules/keyv": {
"version": "4.5.4",
"resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",
@@ -8003,6 +9521,16 @@
"json-buffer": "3.0.1"
}
},
+ "node_modules/kind-of": {
+ "version": "6.0.3",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
+ "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/language-subtag-registry": {
"version": "0.3.23",
"resolved": "https://registry.npmjs.org/language-subtag-registry/-/language-subtag-registry-0.3.23.tgz",
@@ -8062,6 +9590,15 @@
"integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==",
"license": "MIT"
},
+ "node_modules/liquid-json": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/liquid-json/-/liquid-json-0.3.1.tgz",
+ "integrity": "sha512-wUayTU8MS827Dam6MxgD72Ui+KOSF+u/eIqpatOtjnvgJ0+mnDq33uC2M7J0tPK+upe/DpUAuK4JUU89iBoNKQ==",
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=4"
+ }
+ },
"node_modules/load-json-file": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz",
@@ -8094,6 +9631,48 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/lodash": {
+ "version": "4.17.21",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
+ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
+ "license": "MIT"
+ },
+ "node_modules/lodash.includes": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
+ "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==",
+ "license": "MIT"
+ },
+ "node_modules/lodash.isboolean": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz",
+ "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==",
+ "license": "MIT"
+ },
+ "node_modules/lodash.isinteger": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz",
+ "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==",
+ "license": "MIT"
+ },
+ "node_modules/lodash.isnumber": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz",
+ "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==",
+ "license": "MIT"
+ },
+ "node_modules/lodash.isplainobject": {
+ "version": "4.0.6",
+ "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz",
+ "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==",
+ "license": "MIT"
+ },
+ "node_modules/lodash.isstring": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz",
+ "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==",
+ "license": "MIT"
+ },
"node_modules/lodash.merge": {
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
@@ -8101,6 +9680,12 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/lodash.once": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz",
+ "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==",
+ "license": "MIT"
+ },
"node_modules/longest-streak": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-3.1.0.tgz",
@@ -8183,6 +9768,42 @@
"url": "https://github.com/wojtekmaj/make-event-props?sponsor=1"
}
},
+ "node_modules/map-cache": {
+ "version": "0.2.2",
+ "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz",
+ "integrity": "sha512-8y/eV9QQZCiyn1SprXSrCmqJN0yNRATe+PO8ztwqrvrbdRLA3eYJF0yaR0YayLWkMbsQSKWS9N2gPcGEc4UsZg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/map-obj": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz",
+ "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/map-visit": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz",
+ "integrity": "sha512-4y7uGv8bd2WdM9vpQsiQNo41Ln1NvhvDRuVt0k2JZQ+ezN2uaQes7lZeZ+QQUHOLQAtDaBJ+7wCbi+ab/KFs+w==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "object-visit": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/markdown-table": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.0.4.tgz",
@@ -9140,17 +10761,24 @@
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
- "dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
+ "node_modules/mime-format": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/mime-format/-/mime-format-2.0.2.tgz",
+ "integrity": "sha512-Y5ERWVcyh3sby9Fx2U5F1yatiTFjNsqF5NltihTWI9QgNtr5o3dbCZdcKa1l2wyfhnwwoP9HGNxga7LqZLA6gw==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "charset": "^1.0.0"
+ }
+ },
"node_modules/mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
- "dev": true,
"license": "MIT",
"dependencies": {
"mime-db": "1.52.0"
@@ -9172,6 +10800,16 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/min-indent": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz",
+ "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=4"
+ }
+ },
"node_modules/minimatch": {
"version": "9.0.5",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
@@ -9197,6 +10835,41 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/minimist-options": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz",
+ "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "arrify": "^1.0.1",
+ "is-plain-obj": "^1.1.0",
+ "kind-of": "^6.0.3"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/minimist-options/node_modules/arrify": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz",
+ "integrity": "sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/minimist-options/node_modules/is-plain-obj": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz",
+ "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/minipass": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",
@@ -9240,6 +10913,20 @@
"devOptional": true,
"license": "ISC"
},
+ "node_modules/mixin-deep": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz",
+ "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "for-in": "^1.0.2",
+ "is-extendable": "^1.0.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/mkdirp": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
@@ -9362,6 +11049,29 @@
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
}
},
+ "node_modules/nanomatch": {
+ "version": "1.2.13",
+ "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz",
+ "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "arr-diff": "^4.0.0",
+ "array-unique": "^0.3.2",
+ "define-property": "^2.0.2",
+ "extend-shallow": "^3.0.2",
+ "fragment-cache": "^0.2.1",
+ "is-windows": "^1.0.2",
+ "kind-of": "^6.0.2",
+ "object.pick": "^1.3.0",
+ "regex-not": "^1.0.0",
+ "snapdragon": "^0.8.1",
+ "to-regex": "^3.0.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/natural-compare": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
@@ -9391,6 +11101,15 @@
"url": "https://nearley.js.org/#give-to-nearley"
}
},
+ "node_modules/neotraverse": {
+ "version": "0.6.15",
+ "resolved": "https://registry.npmjs.org/neotraverse/-/neotraverse-0.6.15.tgz",
+ "integrity": "sha512-HZpdkco+JeXq0G+WWpMJ4NsX3pqb5O7eR9uGz3FfoFt+LYzU8iRWp49nJtud6hsDoywM8tIrDo3gjgmOqJA8LA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 10"
+ }
+ },
"node_modules/nested-error-stacks": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/nested-error-stacks/-/nested-error-stacks-2.1.1.tgz",
@@ -9436,6 +11155,27 @@
}
}
},
+ "node_modules/node-fetch-h2": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/node-fetch-h2/-/node-fetch-h2-2.3.0.tgz",
+ "integrity": "sha512-ofRW94Ab0T4AOh5Fk8t0h8OBWrmjb0SSB20xh1H8YnPV9EJ+f5AMoYSUQ2zgJ4Iq2HAK0I2l5/Nequ8YzFS3Hg==",
+ "license": "MIT",
+ "dependencies": {
+ "http2-client": "^1.2.5"
+ },
+ "engines": {
+ "node": "4.x || >=6.0.0"
+ }
+ },
+ "node_modules/node-readfiles": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/node-readfiles/-/node-readfiles-0.2.0.tgz",
+ "integrity": "sha512-SU00ZarexNlE4Rjdm83vglt5Y9yiQ+XI1XpflWlb7q7UTN1JUItm69xMeiQCTxtTfnzt+83T8Cx+vI2ED++VDA==",
+ "license": "MIT",
+ "dependencies": {
+ "es6-promise": "^3.2.1"
+ }
+ },
"node_modules/node-releases": {
"version": "2.0.18",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz",
@@ -9763,6 +11503,266 @@
"integrity": "sha512-2vPPEi+Z7WqML2jZYddDIfy5Dqb0r2fze2zTxNNknZaFpVHU3mFB3R+DWeJWGVx0ecvttSGlJTI+WG+8Z4cDWw==",
"license": "MIT"
},
+ "node_modules/oas-kit-common": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/oas-kit-common/-/oas-kit-common-1.0.8.tgz",
+ "integrity": "sha512-pJTS2+T0oGIwgjGpw7sIRU8RQMcUoKCDWFLdBqKB2BNmGpbBMH2sdqAaOXUg8OzonZHU0L7vfJu1mJFEiYDWOQ==",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "fast-safe-stringify": "^2.0.7"
+ }
+ },
+ "node_modules/oas-linter": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/oas-linter/-/oas-linter-3.2.2.tgz",
+ "integrity": "sha512-KEGjPDVoU5K6swgo9hJVA/qYGlwfbFx+Kg2QB/kd7rzV5N8N5Mg6PlsoCMohVnQmo+pzJap/F610qTodKzecGQ==",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "@exodus/schemasafe": "^1.0.0-rc.2",
+ "should": "^13.2.1",
+ "yaml": "^1.10.0"
+ },
+ "funding": {
+ "url": "https://github.com/Mermade/oas-kit?sponsor=1"
+ }
+ },
+ "node_modules/oas-linter/node_modules/yaml": {
+ "version": "1.10.2",
+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz",
+ "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==",
+ "license": "ISC",
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/oas-resolver": {
+ "version": "2.5.6",
+ "resolved": "https://registry.npmjs.org/oas-resolver/-/oas-resolver-2.5.6.tgz",
+ "integrity": "sha512-Yx5PWQNZomfEhPPOphFbZKi9W93CocQj18NlD2Pa4GWZzdZpSJvYwoiuurRI7m3SpcChrnO08hkuQDL3FGsVFQ==",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "node-fetch-h2": "^2.3.0",
+ "oas-kit-common": "^1.0.8",
+ "reftools": "^1.1.9",
+ "yaml": "^1.10.0",
+ "yargs": "^17.0.1"
+ },
+ "bin": {
+ "resolve": "resolve.js"
+ },
+ "funding": {
+ "url": "https://github.com/Mermade/oas-kit?sponsor=1"
+ }
+ },
+ "node_modules/oas-resolver-browser": {
+ "version": "2.5.6",
+ "resolved": "https://registry.npmjs.org/oas-resolver-browser/-/oas-resolver-browser-2.5.6.tgz",
+ "integrity": "sha512-Jw5elT/kwUJrnGaVuRWe1D7hmnYWB8rfDDjBnpQ+RYY/dzAewGXeTexXzt4fGEo6PUE4eqKqPWF79MZxxvMppA==",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "node-fetch-h2": "^2.3.0",
+ "oas-kit-common": "^1.0.8",
+ "path-browserify": "^1.0.1",
+ "reftools": "^1.1.9",
+ "yaml": "^1.10.0",
+ "yargs": "^17.0.1"
+ },
+ "bin": {
+ "resolve": "resolve.js"
+ },
+ "funding": {
+ "url": "https://github.com/Mermade/oas-kit?sponsor=1"
+ }
+ },
+ "node_modules/oas-resolver-browser/node_modules/cliui": {
+ "version": "8.0.1",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz",
+ "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==",
+ "license": "ISC",
+ "dependencies": {
+ "string-width": "^4.2.0",
+ "strip-ansi": "^6.0.1",
+ "wrap-ansi": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/oas-resolver-browser/node_modules/wrap-ansi": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
+ "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.0.0",
+ "string-width": "^4.1.0",
+ "strip-ansi": "^6.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
+ }
+ },
+ "node_modules/oas-resolver-browser/node_modules/y18n": {
+ "version": "5.0.8",
+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
+ "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
+ "license": "ISC",
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/oas-resolver-browser/node_modules/yaml": {
+ "version": "1.10.2",
+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz",
+ "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==",
+ "license": "ISC",
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/oas-resolver-browser/node_modules/yargs": {
+ "version": "17.7.2",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
+ "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==",
+ "license": "MIT",
+ "dependencies": {
+ "cliui": "^8.0.1",
+ "escalade": "^3.1.1",
+ "get-caller-file": "^2.0.5",
+ "require-directory": "^2.1.1",
+ "string-width": "^4.2.3",
+ "y18n": "^5.0.5",
+ "yargs-parser": "^21.1.1"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/oas-resolver-browser/node_modules/yargs-parser": {
+ "version": "21.1.1",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz",
+ "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==",
+ "license": "ISC",
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/oas-resolver/node_modules/cliui": {
+ "version": "8.0.1",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz",
+ "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==",
+ "license": "ISC",
+ "dependencies": {
+ "string-width": "^4.2.0",
+ "strip-ansi": "^6.0.1",
+ "wrap-ansi": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/oas-resolver/node_modules/wrap-ansi": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
+ "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.0.0",
+ "string-width": "^4.1.0",
+ "strip-ansi": "^6.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
+ }
+ },
+ "node_modules/oas-resolver/node_modules/y18n": {
+ "version": "5.0.8",
+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
+ "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
+ "license": "ISC",
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/oas-resolver/node_modules/yaml": {
+ "version": "1.10.2",
+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz",
+ "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==",
+ "license": "ISC",
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/oas-resolver/node_modules/yargs": {
+ "version": "17.7.2",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
+ "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==",
+ "license": "MIT",
+ "dependencies": {
+ "cliui": "^8.0.1",
+ "escalade": "^3.1.1",
+ "get-caller-file": "^2.0.5",
+ "require-directory": "^2.1.1",
+ "string-width": "^4.2.3",
+ "y18n": "^5.0.5",
+ "yargs-parser": "^21.1.1"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/oas-resolver/node_modules/yargs-parser": {
+ "version": "21.1.1",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz",
+ "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==",
+ "license": "ISC",
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/oas-schema-walker": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/oas-schema-walker/-/oas-schema-walker-1.1.5.tgz",
+ "integrity": "sha512-2yucenq1a9YPmeNExoUa9Qwrt9RFkjqaMAA1X+U7sbb0AqBeTIdMHky9SQQ6iN94bO5NW0W4TRYXerG+BdAvAQ==",
+ "license": "BSD-3-Clause",
+ "funding": {
+ "url": "https://github.com/Mermade/oas-kit?sponsor=1"
+ }
+ },
+ "node_modules/oas-validator": {
+ "version": "5.0.8",
+ "resolved": "https://registry.npmjs.org/oas-validator/-/oas-validator-5.0.8.tgz",
+ "integrity": "sha512-cu20/HE5N5HKqVygs3dt94eYJfBi0TsZvPVXDhbXQHiEityDN+RROTleefoKRKKJ9dFAF2JBkDHgvWj0sjKGmw==",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "call-me-maybe": "^1.0.1",
+ "oas-kit-common": "^1.0.8",
+ "oas-linter": "^3.2.2",
+ "oas-resolver": "^2.5.6",
+ "oas-schema-walker": "^1.1.5",
+ "reftools": "^1.1.9",
+ "should": "^13.2.1",
+ "yaml": "^1.10.0"
+ },
+ "funding": {
+ "url": "https://github.com/Mermade/oas-kit?sponsor=1"
+ }
+ },
+ "node_modules/oas-validator/node_modules/yaml": {
+ "version": "1.10.2",
+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz",
+ "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==",
+ "license": "ISC",
+ "engines": {
+ "node": ">= 6"
+ }
+ },
"node_modules/object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
@@ -9772,6 +11772,61 @@
"node": ">=0.10.0"
}
},
+ "node_modules/object-copy": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz",
+ "integrity": "sha512-79LYn6VAb63zgtmAteVOWo9Vdj71ZVBy3Pbse+VqxDpEP83XuujMrGqHIwAXJ5I/aM0zU7dIyIAhifVTPrNItQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "copy-descriptor": "^0.1.0",
+ "define-property": "^0.2.5",
+ "kind-of": "^3.0.3"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/object-copy/node_modules/define-property": {
+ "version": "0.2.5",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
+ "integrity": "sha512-Rr7ADjQZenceVOAKop6ALkkRAmH1A4Gx9hV/7ZujPUN2rkATqFO0JZLZInbAjpZYoJ1gUx8MRMQVkYemcbMSTA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-descriptor": "^0.1.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/object-copy/node_modules/is-descriptor": {
+ "version": "0.1.7",
+ "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.7.tgz",
+ "integrity": "sha512-C3grZTvObeN1xud4cRWl366OMXZTj0+HGyk4hvfpx4ZHt1Pb60ANSXqCK7pdOTeUQpRzECBSTphqvD7U+l22Eg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-accessor-descriptor": "^1.0.1",
+ "is-data-descriptor": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/object-copy/node_modules/kind-of": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+ "integrity": "sha512-NOW9QQXMoZGg/oqnVNoNTTIFEIid1627WCffUBJEdMxYApq7mNE7CpzucIPc+ZQg25Phej7IJSmX3hO+oblOtQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-buffer": "^1.1.5"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/object-hash": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz",
@@ -9818,6 +11873,19 @@
"node": ">= 0.4"
}
},
+ "node_modules/object-visit": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz",
+ "integrity": "sha512-GBaMwwAVK9qbQN3Scdo0OyvgPW7l3lnaVMj84uTOZlswkX0KpF6fyDBJhtTthf7pymztoN36/KEr1DyhF96zEA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "isobject": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/object.assign": {
"version": "4.1.5",
"resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.5.tgz",
@@ -9885,6 +11953,19 @@
"node": ">= 0.4"
}
},
+ "node_modules/object.pick": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz",
+ "integrity": "sha512-tqa/UMy/CCoYmj+H5qc07qvSL9dqcs/WZENZ1JbtWBlATP+iVOe778gE6MSijnyCnORzDuX6hU+LA4SZ09YjFQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "isobject": "^3.0.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/object.values": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.0.tgz",
@@ -9929,6 +12010,82 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/openapi-to-postmanv2": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/openapi-to-postmanv2/-/openapi-to-postmanv2-5.0.0.tgz",
+ "integrity": "sha512-ousMf9rXKen9tscJQ0H8BE+hfgOvFRb2SspYwGnQTmnjzkPNejHUQpNmRUIK/gZ6ZwiNWAnQCKWNogaZXUlFew==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "ajv": "8.11.0",
+ "ajv-draft-04": "1.0.0",
+ "ajv-formats": "2.1.1",
+ "async": "3.2.4",
+ "commander": "2.20.3",
+ "graphlib": "2.1.8",
+ "js-yaml": "4.1.0",
+ "json-pointer": "0.6.2",
+ "json-schema-merge-allof": "0.8.1",
+ "lodash": "4.17.21",
+ "neotraverse": "0.6.15",
+ "oas-resolver-browser": "2.5.6",
+ "object-hash": "3.0.0",
+ "path-browserify": "1.0.1",
+ "postman-collection": "^5.0.0",
+ "swagger2openapi": "7.0.8",
+ "yaml": "1.10.2"
+ },
+ "bin": {
+ "openapi2postmanv2": "bin/openapi2postmanv2.js"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/openapi-to-postmanv2/node_modules/ajv": {
+ "version": "8.11.0",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz",
+ "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==",
+ "license": "MIT",
+ "dependencies": {
+ "fast-deep-equal": "^3.1.1",
+ "json-schema-traverse": "^1.0.0",
+ "require-from-string": "^2.0.2",
+ "uri-js": "^4.2.2"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/epoberezkin"
+ }
+ },
+ "node_modules/openapi-to-postmanv2/node_modules/ajv-draft-04": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/ajv-draft-04/-/ajv-draft-04-1.0.0.tgz",
+ "integrity": "sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw==",
+ "license": "MIT",
+ "peerDependencies": {
+ "ajv": "^8.5.0"
+ },
+ "peerDependenciesMeta": {
+ "ajv": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/openapi-to-postmanv2/node_modules/json-schema-traverse": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
+ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
+ "license": "MIT"
+ },
+ "node_modules/openapi-to-postmanv2/node_modules/yaml": {
+ "version": "1.10.2",
+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz",
+ "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==",
+ "license": "ISC",
+ "engines": {
+ "node": ">= 6"
+ }
+ },
"node_modules/optionator": {
"version": "0.9.4",
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz",
@@ -10140,6 +12297,29 @@
"node": ">=4"
}
},
+ "node_modules/pascalcase": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz",
+ "integrity": "sha512-XHXfu/yOQRy9vYOtUDVMN60OEJjW013GoObG1o+xwQTpB9eYJX/BjXMsdW13ZDPruFhYYn0AG22w0xgQMwl3Nw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/path-browserify": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz",
+ "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==",
+ "license": "MIT"
+ },
+ "node_modules/path-dirname": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz",
+ "integrity": "sha512-ALzNPpyNq9AqXMBjeymIjFDAkAFH06mHJH/cSBHAgU0s4vfpBn6b2nf8tiRLvagKD8RbTpq2FKTBg7cl9l3c7Q==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/path-exists": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
@@ -10239,6 +12419,13 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/physical-cpu-count": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/physical-cpu-count/-/physical-cpu-count-2.0.0.tgz",
+ "integrity": "sha512-rxJOljMuWtYlvREBmd6TZYanfcPhNUKtGDZBjBBS8WG1dpN2iwPsRJZgQqN/OtJuiQckdRFOfzogqJClTrsi7g==",
+ "dev": true,
+ "license": "ISC"
+ },
"node_modules/picocolors": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
@@ -10312,6 +12499,16 @@
"node": ">= 6"
}
},
+ "node_modules/posix-character-classes": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz",
+ "integrity": "sha512-xTgYBc3fuo7Yt7JbiuFxSYGToMoz8fLoE6TC9Wx1P/u+LfeThMOAqmuyECnlBaaJb+u1m9hHiXUEtwW4OzfUJg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/possible-typed-array-names": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz",
@@ -10499,6 +12696,58 @@
"integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==",
"license": "MIT"
},
+ "node_modules/postman-collection": {
+ "version": "5.0.2",
+ "resolved": "https://registry.npmjs.org/postman-collection/-/postman-collection-5.0.2.tgz",
+ "integrity": "sha512-6nq0D1n4TyCcw8XEQ57e/IiSDWhkFuwiSqNMxKCbRlVN2xRsJEkBtX2qtaNqlp+wFQW/2WsyYJA1R21HBAAllg==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@faker-js/faker": "5.5.3",
+ "file-type": "3.9.0",
+ "http-reasons": "0.1.0",
+ "iconv-lite": "0.6.3",
+ "liquid-json": "0.3.1",
+ "lodash": "4.17.21",
+ "mime-format": "2.0.2",
+ "mime-types": "2.1.35",
+ "postman-url-encoder": "3.0.7",
+ "semver": "7.7.1",
+ "uuid": "8.3.2"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/postman-collection/node_modules/file-type": {
+ "version": "3.9.0",
+ "resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz",
+ "integrity": "sha512-RLoqTXE8/vPmMuTI88DAzhMYC99I8BWv7zYP4A1puo5HIjEJ5EX48ighy4ZyKMG9EDXxBgW6e++cn7d1xuFghA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/postman-collection/node_modules/uuid": {
+ "version": "8.3.2",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
+ "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
+ "license": "MIT",
+ "bin": {
+ "uuid": "dist/bin/uuid"
+ }
+ },
+ "node_modules/postman-url-encoder": {
+ "version": "3.0.7",
+ "resolved": "https://registry.npmjs.org/postman-url-encoder/-/postman-url-encoder-3.0.7.tgz",
+ "integrity": "sha512-JlWT4yLtL01ogxL+PSzs89++2sKdxsJrk5QrWken/VzKx5b+UMQ646/glZA3MbqfL3KtsUqanLhL0PQtkmcUyg==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "punycode": "^2.3.1"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
"node_modules/prelude-ls": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
@@ -10557,7 +12806,6 @@
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
- "dev": true,
"license": "MIT",
"engines": {
"node": ">=6"
@@ -10583,6 +12831,16 @@
],
"license": "MIT"
},
+ "node_modules/quick-lru": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz",
+ "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/railroad-diagrams": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/railroad-diagrams/-/railroad-diagrams-1.0.0.tgz",
@@ -10825,6 +13083,135 @@
"node": ">=4"
}
},
+ "node_modules/read-pkg-up": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz",
+ "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "find-up": "^4.1.0",
+ "read-pkg": "^5.2.0",
+ "type-fest": "^0.8.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/read-pkg-up/node_modules/find-up": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
+ "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "locate-path": "^5.0.0",
+ "path-exists": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/read-pkg-up/node_modules/locate-path": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
+ "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "p-locate": "^4.1.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/read-pkg-up/node_modules/p-limit": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
+ "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "p-try": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/read-pkg-up/node_modules/p-locate": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
+ "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "p-limit": "^2.2.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/read-pkg-up/node_modules/parse-json": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz",
+ "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/code-frame": "^7.0.0",
+ "error-ex": "^1.3.1",
+ "json-parse-even-better-errors": "^2.3.0",
+ "lines-and-columns": "^1.1.6"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/read-pkg-up/node_modules/read-pkg": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz",
+ "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/normalize-package-data": "^2.4.0",
+ "normalize-package-data": "^2.5.0",
+ "parse-json": "^5.0.0",
+ "type-fest": "^0.6.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/read-pkg-up/node_modules/read-pkg/node_modules/type-fest": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz",
+ "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==",
+ "dev": true,
+ "license": "(MIT OR CC0-1.0)",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/read-pkg-up/node_modules/type-fest": {
+ "version": "0.8.1",
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz",
+ "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==",
+ "dev": true,
+ "license": "(MIT OR CC0-1.0)",
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/readable-stream": {
"version": "3.6.2",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
@@ -10852,6 +13239,30 @@
"node": ">=8.10.0"
}
},
+ "node_modules/redent": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz",
+ "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "indent-string": "^4.0.0",
+ "strip-indent": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/redent/node_modules/indent-string": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz",
+ "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/redux": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/redux/-/redux-4.2.1.tgz",
@@ -10883,12 +13294,35 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/reftools": {
+ "version": "1.1.9",
+ "resolved": "https://registry.npmjs.org/reftools/-/reftools-1.1.9.tgz",
+ "integrity": "sha512-OVede/NQE13xBQ+ob5CKd5KyeJYU2YInb1bmV4nRoOfquZPkAkxuOXicSe1PvqIuZZ4kD13sPKBbR7UFDmli6w==",
+ "license": "BSD-3-Clause",
+ "funding": {
+ "url": "https://github.com/Mermade/oas-kit?sponsor=1"
+ }
+ },
"node_modules/regenerator-runtime": {
"version": "0.14.1",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
"integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==",
"license": "MIT"
},
+ "node_modules/regex-not": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz",
+ "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "extend-shallow": "^3.0.2",
+ "safe-regex": "^1.1.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/regexp.prototype.flags": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.3.tgz",
@@ -10973,6 +13407,26 @@
"url": "https://opencollective.com/unified"
}
},
+ "node_modules/repeat-element": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.4.tgz",
+ "integrity": "sha512-LFiNfRcSu7KK3evMyYOuCzv3L10TW7yC1G2/+StMjK8Y6Vqd2MG7r/Qjw4ghtuCOjFvlnms/iMmLqpvW/ES/WQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/repeat-string": {
+ "version": "1.6.1",
+ "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz",
+ "integrity": "sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10"
+ }
+ },
"node_modules/require-directory": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
@@ -10982,6 +13436,15 @@
"node": ">=0.10.0"
}
},
+ "node_modules/require-from-string": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
+ "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/require-main-filename": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
@@ -11031,6 +13494,14 @@
"url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1"
}
},
+ "node_modules/resolve-url": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz",
+ "integrity": "sha512-ZuF55hVUQaaczgOIwqWzkEcEidmlD/xl44x1UZnhOXcYuFN2S6+rcxpG+C1N3So0wvNI3DmJICUFfu2SxhBmvg==",
+ "deprecated": "https://github.com/lydell/resolve-url#deprecated",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/ret": {
"version": "0.1.15",
"resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz",
@@ -11176,8 +13647,17 @@
"url": "https://feross.org/support"
}
],
+ "license": "MIT"
+ },
+ "node_modules/safe-regex": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz",
+ "integrity": "sha512-aJXcif4xnaNUzvUuC5gcb46oTS7zvg4jpMTnuqtrEPlR3vFr4pxtdTwaF1Qs3Enjn9HK+ZlwQui+a7z0SywIzg==",
+ "dev": true,
"license": "MIT",
- "optional": true
+ "dependencies": {
+ "ret": "~0.1.10"
+ }
},
"node_modules/safe-regex-test": {
"version": "1.0.3",
@@ -11197,6 +13677,12 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/safer-buffer": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
+ "license": "MIT"
+ },
"node_modules/sanitize-filename": {
"version": "1.6.3",
"resolved": "https://registry.npmjs.org/sanitize-filename/-/sanitize-filename-1.6.3.tgz",
@@ -11243,10 +13729,9 @@
}
},
"node_modules/semver": {
- "version": "7.6.3",
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz",
- "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==",
- "devOptional": true,
+ "version": "7.7.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz",
+ "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==",
"license": "ISC",
"bin": {
"semver": "bin/semver.js"
@@ -11302,6 +13787,45 @@
"node": ">=6.9"
}
},
+ "node_modules/set-value": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz",
+ "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "extend-shallow": "^2.0.1",
+ "is-extendable": "^0.1.1",
+ "is-plain-object": "^2.0.3",
+ "split-string": "^3.0.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/set-value/node_modules/extend-shallow": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
+ "integrity": "sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-extendable": "^0.1.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/set-value/node_modules/is-extendable": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz",
+ "integrity": "sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/shallowequal": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/shallowequal/-/shallowequal-1.1.0.tgz",
@@ -11333,12 +13857,65 @@
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.1.tgz",
"integrity": "sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==",
- "dev": true,
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/should": {
+ "version": "13.2.3",
+ "resolved": "https://registry.npmjs.org/should/-/should-13.2.3.tgz",
+ "integrity": "sha512-ggLesLtu2xp+ZxI+ysJTmNjh2U0TsC+rQ/pfED9bUZZ4DKefP27D+7YJVVTvKsmjLpIi9jAa7itwDGkDDmt1GQ==",
+ "license": "MIT",
+ "dependencies": {
+ "should-equal": "^2.0.0",
+ "should-format": "^3.0.3",
+ "should-type": "^1.4.0",
+ "should-type-adaptors": "^1.0.1",
+ "should-util": "^1.0.0"
+ }
+ },
+ "node_modules/should-equal": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/should-equal/-/should-equal-2.0.0.tgz",
+ "integrity": "sha512-ZP36TMrK9euEuWQYBig9W55WPC7uo37qzAEmbjHz4gfyuXrEUgF8cUvQVO+w+d3OMfPvSRQJ22lSm8MQJ43LTA==",
+ "license": "MIT",
+ "dependencies": {
+ "should-type": "^1.4.0"
+ }
+ },
+ "node_modules/should-format": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/should-format/-/should-format-3.0.3.tgz",
+ "integrity": "sha512-hZ58adtulAk0gKtua7QxevgUaXTTXxIi8t41L3zo9AHvjXO1/7sdLECuHeIN2SRtYXpNkmhoUP2pdeWgricQ+Q==",
+ "license": "MIT",
+ "dependencies": {
+ "should-type": "^1.3.0",
+ "should-type-adaptors": "^1.0.1"
+ }
+ },
+ "node_modules/should-type": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/should-type/-/should-type-1.4.0.tgz",
+ "integrity": "sha512-MdAsTu3n25yDbIe1NeN69G4n6mUnJGtSJHygX3+oN0ZbO3DTiATnf7XnYJdGT42JCXurTb1JI0qOBR65shvhPQ==",
+ "license": "MIT"
+ },
+ "node_modules/should-type-adaptors": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/should-type-adaptors/-/should-type-adaptors-1.1.0.tgz",
+ "integrity": "sha512-JA4hdoLnN+kebEp2Vs8eBe9g7uy0zbRo+RMcU0EsNy+R+k049Ki+N5tT5Jagst2g7EAja+euFuoXFCa8vIklfA==",
+ "license": "MIT",
+ "dependencies": {
+ "should-type": "^1.3.0",
+ "should-util": "^1.0.0"
+ }
+ },
+ "node_modules/should-util": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/should-util/-/should-util-1.0.1.tgz",
+ "integrity": "sha512-oXF8tfxx5cDk8r2kYqlkUJzZpDBqVY/II2WhvU0n9Y3XYvAYRmeaf1PvvIvTgPnv4KJ+ES5M0PyDq5Jp+Ygy2g==",
+ "license": "MIT"
+ },
"node_modules/side-channel": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz",
@@ -11522,6 +14099,157 @@
"tslib": "^2.0.3"
}
},
+ "node_modules/snapdragon": {
+ "version": "0.8.2",
+ "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz",
+ "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "base": "^0.11.1",
+ "debug": "^2.2.0",
+ "define-property": "^0.2.5",
+ "extend-shallow": "^2.0.1",
+ "map-cache": "^0.2.2",
+ "source-map": "^0.5.6",
+ "source-map-resolve": "^0.5.0",
+ "use": "^3.1.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/snapdragon-node": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz",
+ "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "define-property": "^1.0.0",
+ "isobject": "^3.0.0",
+ "snapdragon-util": "^3.0.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/snapdragon-node/node_modules/define-property": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz",
+ "integrity": "sha512-cZTYKFWspt9jZsMscWo8sc/5lbPC9Q0N5nBLgb+Yd915iL3udB1uFgS3B8YCx66UVHq018DAVFoee7x+gxggeA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-descriptor": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/snapdragon-util": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz",
+ "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "kind-of": "^3.2.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/snapdragon-util/node_modules/kind-of": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+ "integrity": "sha512-NOW9QQXMoZGg/oqnVNoNTTIFEIid1627WCffUBJEdMxYApq7mNE7CpzucIPc+ZQg25Phej7IJSmX3hO+oblOtQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-buffer": "^1.1.5"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/snapdragon/node_modules/debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ms": "2.0.0"
+ }
+ },
+ "node_modules/snapdragon/node_modules/define-property": {
+ "version": "0.2.5",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
+ "integrity": "sha512-Rr7ADjQZenceVOAKop6ALkkRAmH1A4Gx9hV/7ZujPUN2rkATqFO0JZLZInbAjpZYoJ1gUx8MRMQVkYemcbMSTA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-descriptor": "^0.1.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/snapdragon/node_modules/extend-shallow": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
+ "integrity": "sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-extendable": "^0.1.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/snapdragon/node_modules/is-descriptor": {
+ "version": "0.1.7",
+ "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.7.tgz",
+ "integrity": "sha512-C3grZTvObeN1xud4cRWl366OMXZTj0+HGyk4hvfpx4ZHt1Pb60ANSXqCK7pdOTeUQpRzECBSTphqvD7U+l22Eg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-accessor-descriptor": "^1.0.1",
+ "is-data-descriptor": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/snapdragon/node_modules/is-extendable": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz",
+ "integrity": "sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/snapdragon/node_modules/ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/snapdragon/node_modules/source-map": {
+ "version": "0.5.7",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
+ "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
@@ -11540,6 +14268,29 @@
"node": ">=0.10.0"
}
},
+ "node_modules/source-map-resolve": {
+ "version": "0.5.3",
+ "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.3.tgz",
+ "integrity": "sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw==",
+ "deprecated": "See https://github.com/lydell/source-map-resolve#deprecated",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "atob": "^2.1.2",
+ "decode-uri-component": "^0.2.0",
+ "resolve-url": "^0.2.1",
+ "source-map-url": "^0.4.0",
+ "urix": "^0.1.0"
+ }
+ },
+ "node_modules/source-map-url": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.1.tgz",
+ "integrity": "sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw==",
+ "deprecated": "See https://github.com/lydell/source-map-url#deprecated",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/space-separated-tokens": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz",
@@ -11586,6 +14337,86 @@
"dev": true,
"license": "CC0-1.0"
},
+ "node_modules/split-string": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz",
+ "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "extend-shallow": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/split2": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/split2/-/split2-0.1.2.tgz",
+ "integrity": "sha512-t6JTeWbon5yYazpiZN1Fn0ehh5h/FBH9iuoQBAaEHUp+uFxLKFrmMQF3ElmzoScD9OQn+gb8Ut+NOuQYZ1aBfA==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "through2": "~0.4.1"
+ }
+ },
+ "node_modules/split2/node_modules/isarray": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
+ "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/split2/node_modules/object-keys": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-0.4.0.tgz",
+ "integrity": "sha512-ncrLw+X55z7bkl5PnUvHwFK9FcGuFYo9gtjws2XtSzL+aZ8tm830P60WJ0dSmFVaSalWieW5MD7kEdnXda9yJw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/split2/node_modules/readable-stream": {
+ "version": "1.0.34",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz",
+ "integrity": "sha512-ok1qVCJuRkNmvebYikljxJA/UEsKwLl2nI1OmaqAu4/UE+h0wKCHok4XkL/gvi39OacXvw59RJUOFUkDib2rHg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "core-util-is": "~1.0.0",
+ "inherits": "~2.0.1",
+ "isarray": "0.0.1",
+ "string_decoder": "~0.10.x"
+ }
+ },
+ "node_modules/split2/node_modules/string_decoder": {
+ "version": "0.10.31",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
+ "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/split2/node_modules/through2": {
+ "version": "0.4.2",
+ "resolved": "https://registry.npmjs.org/through2/-/through2-0.4.2.tgz",
+ "integrity": "sha512-45Llu+EwHKtAZYTPPVn3XZHBgakWMN3rokhEv5hu596XP+cNgplMg+Gj+1nmAvj+L0K7+N49zBKx5rah5u0QIQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "readable-stream": "~1.0.17",
+ "xtend": "~2.1.1"
+ }
+ },
+ "node_modules/split2/node_modules/xtend": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/xtend/-/xtend-2.1.2.tgz",
+ "integrity": "sha512-vMNKzr2rHP9Dp/e1NQFnLQlwlhp9L/LfvnsVdHxN1f+uggyVI3i08uD14GPvCToPkdsRfyPqIyYGmIk58V98ZQ==",
+ "dev": true,
+ "dependencies": {
+ "object-keys": "~0.4.0"
+ },
+ "engines": {
+ "node": ">=0.4"
+ }
+ },
"node_modules/stack-generator": {
"version": "2.0.10",
"resolved": "https://registry.npmjs.org/stack-generator/-/stack-generator-2.0.10.tgz",
@@ -11631,6 +14462,47 @@
"stacktrace-gps": "^3.0.4"
}
},
+ "node_modules/static-extend": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz",
+ "integrity": "sha512-72E9+uLc27Mt718pMHt9VMNiAL4LMsmDbBva8mxWUCkT07fSzEGMYUCk0XWY6lp0j6RBAG4cJ3mWuZv2OE3s0g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "define-property": "^0.2.5",
+ "object-copy": "^0.1.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/static-extend/node_modules/define-property": {
+ "version": "0.2.5",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
+ "integrity": "sha512-Rr7ADjQZenceVOAKop6ALkkRAmH1A4Gx9hV/7ZujPUN2rkATqFO0JZLZInbAjpZYoJ1gUx8MRMQVkYemcbMSTA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-descriptor": "^0.1.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/static-extend/node_modules/is-descriptor": {
+ "version": "0.1.7",
+ "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.7.tgz",
+ "integrity": "sha512-C3grZTvObeN1xud4cRWl366OMXZTj0+HGyk4hvfpx4ZHt1Pb60ANSXqCK7pdOTeUQpRzECBSTphqvD7U+l22Eg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-accessor-descriptor": "^1.0.1",
+ "is-data-descriptor": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/stop-iteration-iterator": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz",
@@ -11898,6 +14770,19 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/strip-indent": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz",
+ "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "min-indent": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/strip-json-comments": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
@@ -12042,6 +14927,109 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/swagger2openapi": {
+ "version": "7.0.8",
+ "resolved": "https://registry.npmjs.org/swagger2openapi/-/swagger2openapi-7.0.8.tgz",
+ "integrity": "sha512-upi/0ZGkYgEcLeGieoz8gT74oWHA0E7JivX7aN9mAf+Tc7BQoRBvnIGHoPDw+f9TXTW4s6kGYCZJtauP6OYp7g==",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "call-me-maybe": "^1.0.1",
+ "node-fetch": "^2.6.1",
+ "node-fetch-h2": "^2.3.0",
+ "node-readfiles": "^0.2.0",
+ "oas-kit-common": "^1.0.8",
+ "oas-resolver": "^2.5.6",
+ "oas-schema-walker": "^1.1.5",
+ "oas-validator": "^5.0.8",
+ "reftools": "^1.1.9",
+ "yaml": "^1.10.0",
+ "yargs": "^17.0.1"
+ },
+ "bin": {
+ "boast": "boast.js",
+ "oas-validate": "oas-validate.js",
+ "swagger2openapi": "swagger2openapi.js"
+ },
+ "funding": {
+ "url": "https://github.com/Mermade/oas-kit?sponsor=1"
+ }
+ },
+ "node_modules/swagger2openapi/node_modules/cliui": {
+ "version": "8.0.1",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz",
+ "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==",
+ "license": "ISC",
+ "dependencies": {
+ "string-width": "^4.2.0",
+ "strip-ansi": "^6.0.1",
+ "wrap-ansi": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/swagger2openapi/node_modules/wrap-ansi": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
+ "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.0.0",
+ "string-width": "^4.1.0",
+ "strip-ansi": "^6.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
+ }
+ },
+ "node_modules/swagger2openapi/node_modules/y18n": {
+ "version": "5.0.8",
+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
+ "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
+ "license": "ISC",
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/swagger2openapi/node_modules/yaml": {
+ "version": "1.10.2",
+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz",
+ "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==",
+ "license": "ISC",
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/swagger2openapi/node_modules/yargs": {
+ "version": "17.7.2",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
+ "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==",
+ "license": "MIT",
+ "dependencies": {
+ "cliui": "^8.0.1",
+ "escalade": "^3.1.1",
+ "get-caller-file": "^2.0.5",
+ "require-directory": "^2.1.1",
+ "string-width": "^4.2.3",
+ "y18n": "^5.0.5",
+ "yargs-parser": "^21.1.1"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/swagger2openapi/node_modules/yargs-parser": {
+ "version": "21.1.1",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz",
+ "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==",
+ "license": "ISC",
+ "engines": {
+ "node": ">=12"
+ }
+ },
"node_modules/tabbable": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.2.0.tgz",
@@ -12194,6 +15182,16 @@
"devOptional": true,
"license": "ISC"
},
+ "node_modules/task-graph-runner": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/task-graph-runner/-/task-graph-runner-1.0.3.tgz",
+ "integrity": "sha512-aC70bepv1j9jXX70nzolNvnHJvD4A3WtU4lQ1HEjgTS8rgnRXoUUq+xl9hZ1hKYXxVwElZXmUUMxpzDC6R0mRg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "array-includes": "^3.0.3"
+ }
+ },
"node_modules/text-table": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
@@ -12238,6 +15236,53 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/through2": {
+ "version": "0.5.1",
+ "resolved": "https://registry.npmjs.org/through2/-/through2-0.5.1.tgz",
+ "integrity": "sha512-zexCrAOTbjkBCXGyozn7hhS3aEaqdrc59mAD2E3dKYzV1vFuEGQ1hEDJN2oQMQFwy4he2zyLqPZV+AlfS8ZWJA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "readable-stream": "~1.0.17",
+ "xtend": "~3.0.0"
+ }
+ },
+ "node_modules/through2/node_modules/isarray": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
+ "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/through2/node_modules/readable-stream": {
+ "version": "1.0.34",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz",
+ "integrity": "sha512-ok1qVCJuRkNmvebYikljxJA/UEsKwLl2nI1OmaqAu4/UE+h0wKCHok4XkL/gvi39OacXvw59RJUOFUkDib2rHg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "core-util-is": "~1.0.0",
+ "inherits": "~2.0.1",
+ "isarray": "0.0.1",
+ "string_decoder": "~0.10.x"
+ }
+ },
+ "node_modules/through2/node_modules/string_decoder": {
+ "version": "0.10.31",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
+ "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/through2/node_modules/xtend": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/xtend/-/xtend-3.0.0.tgz",
+ "integrity": "sha512-sp/sT9OALMjRW1fKDlPeuSZlDQpkqReA0pyJukniWbTGoEKefHxhGJynE3PNhUMlcM8qWIjPwecwCw4LArS5Eg==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.4"
+ }
+ },
"node_modules/time-span": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/time-span/-/time-span-5.1.0.tgz",
@@ -12273,6 +15318,48 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/to-object-path": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz",
+ "integrity": "sha512-9mWHdnGRuh3onocaHzukyvCZhzvr6tiflAy/JRFXcJX0TjgfWA9pk9t8CMbzmBE4Jfw58pXbkngtBtqYxzNEyg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "kind-of": "^3.0.2"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/to-object-path/node_modules/kind-of": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+ "integrity": "sha512-NOW9QQXMoZGg/oqnVNoNTTIFEIid1627WCffUBJEdMxYApq7mNE7CpzucIPc+ZQg25Phej7IJSmX3hO+oblOtQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-buffer": "^1.1.5"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/to-regex": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz",
+ "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "define-property": "^2.0.2",
+ "extend-shallow": "^3.0.2",
+ "regex-not": "^1.0.2",
+ "safe-regex": "^1.1.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
@@ -12307,6 +15394,16 @@
"url": "https://github.com/sponsors/wooorm"
}
},
+ "node_modules/trim-newlines": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz",
+ "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/trough": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/trough/-/trough-2.2.0.tgz",
@@ -13016,6 +16113,32 @@
"url": "https://opencollective.com/unified"
}
},
+ "node_modules/union-value": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz",
+ "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "arr-union": "^3.1.0",
+ "get-value": "^2.0.6",
+ "is-extendable": "^0.1.1",
+ "set-value": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/union-value/node_modules/is-extendable": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz",
+ "integrity": "sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/unist-util-is": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz",
@@ -13084,6 +16207,16 @@
"url": "https://opencollective.com/unified"
}
},
+ "node_modules/universalify": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
+ "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 4.0.0"
+ }
+ },
"node_modules/unplugin": {
"version": "1.16.0",
"resolved": "https://registry.npmjs.org/unplugin/-/unplugin-1.16.0.tgz",
@@ -13098,6 +16231,65 @@
"node": ">=14.0.0"
}
},
+ "node_modules/unset-value": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz",
+ "integrity": "sha512-PcA2tsuGSF9cnySLHTLSh2qrQiJ70mn+r+Glzxv2TWZblxsxCC52BDlZoPCsz7STd9pN7EZetkWZBAvk4cgZdQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-value": "^0.3.1",
+ "isobject": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/unset-value/node_modules/has-value": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz",
+ "integrity": "sha512-gpG936j8/MzaeID5Yif+577c17TxaDmhuyVgSwtnL/q8UUTySg8Mecb+8Cf1otgLoD7DDH75axp86ER7LFsf3Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "get-value": "^2.0.3",
+ "has-values": "^0.1.4",
+ "isobject": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/unset-value/node_modules/has-value/node_modules/isobject": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz",
+ "integrity": "sha512-+OUdGJlgjOBZDfxnDjYYG6zp487z0JGNQq3cYQYg5f5hKR+syHMsaztzGeml/4kGG55CSpKSpWTY+jYGgsHLgA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "isarray": "1.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/unset-value/node_modules/has-values": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz",
+ "integrity": "sha512-J8S0cEdWuQbqD9//tlZxiMuMNmxB8PlEwvYwuxsTmR1G5RXUePEX/SJn7aD0GMLieuZYSwNH0cQuJGwnYunXRQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/unset-value/node_modules/isarray": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
+ "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/update-browserslist-db": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz",
@@ -13133,12 +16325,29 @@
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
"integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
- "dev": true,
"license": "BSD-2-Clause",
"dependencies": {
"punycode": "^2.1.0"
}
},
+ "node_modules/urix": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz",
+ "integrity": "sha512-Am1ousAhSLBeB9cG/7k7r2R0zj50uDRlZHPGbazid5s9rlF1F/QKYObEKSIunSjIOkJZqwRRLpvewjEkM7pSqg==",
+ "deprecated": "Please see https://github.com/lydell/urix#deprecated",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/use": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz",
+ "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/use-sync-external-store": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.4.0.tgz",
@@ -13190,6 +16399,39 @@
"spdx-expression-parse": "^3.0.0"
}
},
+ "node_modules/validate.io-array": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/validate.io-array/-/validate.io-array-1.0.6.tgz",
+ "integrity": "sha512-DeOy7CnPEziggrOO5CZhVKJw6S3Yi7e9e65R1Nl/RTN1vTQKnzjfvks0/8kQ40FP/dsjRAOd4hxmJ7uLa6vxkg==",
+ "license": "MIT"
+ },
+ "node_modules/validate.io-function": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/validate.io-function/-/validate.io-function-1.0.2.tgz",
+ "integrity": "sha512-LlFybRJEriSuBnUhQyG5bwglhh50EpTL2ul23MPIuR1odjO7XaMLFV8vHGwp7AZciFxtYOeiSCT5st+XSPONiQ=="
+ },
+ "node_modules/validate.io-integer": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/validate.io-integer/-/validate.io-integer-1.0.5.tgz",
+ "integrity": "sha512-22izsYSLojN/P6bppBqhgUDjCkr5RY2jd+N2a3DCAUey8ydvrZ/OkGvFPR7qfOpwR2LC5p4Ngzxz36g5Vgr/hQ==",
+ "dependencies": {
+ "validate.io-number": "^1.0.3"
+ }
+ },
+ "node_modules/validate.io-integer-array": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/validate.io-integer-array/-/validate.io-integer-array-1.0.0.tgz",
+ "integrity": "sha512-mTrMk/1ytQHtCY0oNO3dztafHYyGU88KL+jRxWuzfOmQb+4qqnWmI+gykvGp8usKZOM0H7keJHEbRaFiYA0VrA==",
+ "dependencies": {
+ "validate.io-array": "^1.0.3",
+ "validate.io-integer": "^1.0.4"
+ }
+ },
+ "node_modules/validate.io-number": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/validate.io-number/-/validate.io-number-1.0.3.tgz",
+ "integrity": "sha512-kRAyotcbNaSYoDnXvb4MHg/0a1egJdLwS6oJ38TJY7aw9n93Fl/3blIXdyYvPOp55CNxywooG/3BcrwNrBpcSg=="
+ },
"node_modules/vfile": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz",
@@ -13576,6 +16818,136 @@
"node": ">=0.10.0"
}
},
+ "node_modules/workspaces-run": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/workspaces-run/-/workspaces-run-1.0.2.tgz",
+ "integrity": "sha512-VJO+ZcefRGjH81hxGOpS/bpelW+l6PfjUlA8cqtSq/hbIlTC+oG9TWUJTo1xKIyRSg/W+Snu2g9V0lyWGbpCgw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "aggregate-error": "^3.0.1",
+ "chalk": "^3.0.0",
+ "chunkd": "^2.0.1",
+ "cross-spawn": "^7.0.1",
+ "get-workspaces": "^0.5.2",
+ "meow": "^6.0.0",
+ "micromatch": "^4.0.2",
+ "p-limit": "^2.2.1",
+ "physical-cpu-count": "^2.0.0",
+ "redent": "^3.0.0",
+ "semver": "^7.1.1",
+ "signal-exit": "^3.0.2",
+ "task-graph-runner": "^1.0.3",
+ "trim-newlines": "^3.0.0",
+ "wrapline": "^2.0.1"
+ },
+ "bin": {
+ "workspaces-run": "bin.js"
+ }
+ },
+ "node_modules/workspaces-run/node_modules/aggregate-error": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz",
+ "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "clean-stack": "^2.0.0",
+ "indent-string": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/workspaces-run/node_modules/chalk": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
+ "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/workspaces-run/node_modules/clean-stack": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz",
+ "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/workspaces-run/node_modules/indent-string": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz",
+ "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/workspaces-run/node_modules/meow": {
+ "version": "6.1.1",
+ "resolved": "https://registry.npmjs.org/meow/-/meow-6.1.1.tgz",
+ "integrity": "sha512-3YffViIt2QWgTy6Pale5QpopX/IvU3LPL03jOTqp6pGj3VjesdO/U8CuHMKpnQr4shCNCM5fd5XFFvIIl6JBHg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/minimist": "^1.2.0",
+ "camelcase-keys": "^6.2.2",
+ "decamelize-keys": "^1.1.0",
+ "hard-rejection": "^2.1.0",
+ "minimist-options": "^4.0.2",
+ "normalize-package-data": "^2.5.0",
+ "read-pkg-up": "^7.0.1",
+ "redent": "^3.0.0",
+ "trim-newlines": "^3.0.0",
+ "type-fest": "^0.13.1",
+ "yargs-parser": "^18.1.3"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/workspaces-run/node_modules/p-limit": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
+ "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "p-try": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/workspaces-run/node_modules/type-fest": {
+ "version": "0.13.1",
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz",
+ "integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==",
+ "dev": true,
+ "license": "(MIT OR CC0-1.0)",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/wrap-ansi": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
@@ -13608,6 +16980,18 @@
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
}
},
+ "node_modules/wrapline": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/wrapline/-/wrapline-2.0.1.tgz",
+ "integrity": "sha512-WmC0Dk43usmD+shMS8dr06Znblx3nAWHWR+BMecQEClNq/NTBPKIA6JHSX+cv8TRG7w4H6/nLGUmFt56rHkFow==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "duplexer2": "~0.0.2",
+ "split2": "^0.1.2",
+ "through2": "^0.5.1"
+ }
+ },
"node_modules/wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
@@ -13636,6 +17020,15 @@
"node": ">= 16"
}
},
+ "node_modules/xpath": {
+ "version": "0.0.34",
+ "resolved": "https://registry.npmjs.org/xpath/-/xpath-0.0.34.tgz",
+ "integrity": "sha512-FxF6+rkr1rNSQrhUNYrAFJpRXNzlDoMxeXN5qI84939ylEv3qqPFKa85Oxr6tDaJKqwW6KKyo2v26TSv3k6LeA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.6.0"
+ }
+ },
"node_modules/xtend": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
@@ -13706,15 +17099,6 @@
"node": ">=6"
}
},
- "node_modules/yargs-parser/node_modules/camelcase": {
- "version": "5.3.1",
- "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
- "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
- "license": "MIT",
- "engines": {
- "node": ">=6"
- }
- },
"node_modules/yargs/node_modules/find-up": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
@@ -13826,7 +17210,7 @@
},
"packages/plugin-runtime-types": {
"name": "@yaakapp/api",
- "version": "0.5.3",
+ "version": "0.6.0",
"dependencies": {
"@types/node": "^22.5.4"
},
@@ -13883,6 +17267,182 @@
"typescript": "^5.6.2"
}
},
+ "plugins/auth-basic": {
+ "name": "@yaakapp/auth-basic",
+ "version": "0.0.1"
+ },
+ "plugins/auth-bearer": {
+ "name": "@yaakapp/auth-bearer",
+ "version": "0.0.1"
+ },
+ "plugins/auth-jwt": {
+ "name": "@yaakapp/auth-jwt",
+ "version": "0.0.1",
+ "dependencies": {
+ "jsonwebtoken": "^9.0.2"
+ },
+ "devDependencies": {
+ "@types/jsonwebtoken": "^9.0.7"
+ }
+ },
+ "plugins/auth-oauth2": {
+ "name": "@yaakapp/auth-oauth2",
+ "version": "0.0.1"
+ },
+ "plugins/exporter-curl": {
+ "name": "@yaakapp/exporter-curl",
+ "version": "0.0.1"
+ },
+ "plugins/filter-jsonpath": {
+ "name": "@yaakapp/filter-jsonpath",
+ "version": "0.0.1",
+ "dependencies": {
+ "jsonpath-plus": "^10.3.0"
+ },
+ "devDependencies": {
+ "@types/jsonpath": "^0.2.4"
+ }
+ },
+ "plugins/filter-xpath": {
+ "name": "@yaakapp/filter-xpath",
+ "version": "0.0.1",
+ "dependencies": {
+ "@xmldom/xmldom": "^0.8.10",
+ "xpath": "^0.0.34"
+ }
+ },
+ "plugins/importer-curl": {
+ "name": "@yaakapp/importer-curl",
+ "version": "0.0.1",
+ "dependencies": {
+ "shell-quote": "^1.8.1"
+ },
+ "devDependencies": {
+ "@types/shell-quote": "^1.7.5"
+ }
+ },
+ "plugins/importer-insomnia": {
+ "name": "@yaakapp/importer-insomnia",
+ "version": "0.0.1",
+ "dependencies": {
+ "yaml": "^2.4.2"
+ }
+ },
+ "plugins/importer-openapi": {
+ "name": "@yaakapp/importer-openapi",
+ "version": "0.0.1",
+ "dependencies": {
+ "openapi-to-postmanv2": "^5.0.0",
+ "yaml": "^2.4.2"
+ },
+ "devDependencies": {
+ "@types/openapi-to-postmanv2": "^3.2.4"
+ }
+ },
+ "plugins/importer-postman": {
+ "name": "@yaakapp/importer-postman",
+ "version": "0.0.1"
+ },
+ "plugins/importer-yaak": {
+ "name": "@yaakapp/importer-yaak",
+ "version": "0.0.1"
+ },
+ "plugins/template-function-cookie": {
+ "name": "@yaakapp/template-function-cookie",
+ "version": "0.0.1"
+ },
+ "plugins/template-function-encode": {
+ "name": "@yaakapp/template-function-encode",
+ "version": "0.0.1"
+ },
+ "plugins/template-function-fs": {
+ "name": "@yaakapp/template-function-fs",
+ "version": "0.0.1"
+ },
+ "plugins/template-function-hash": {
+ "name": "@yaakapp/template-function-hash",
+ "version": "0.0.1"
+ },
+ "plugins/template-function-json": {
+ "name": "@yaakapp/template-function-json",
+ "version": "0.0.1",
+ "dependencies": {
+ "jsonpath-plus": "^10.3.0"
+ },
+ "devDependencies": {
+ "@types/jsonpath": "^0.2.4"
+ }
+ },
+ "plugins/template-function-prompt": {
+ "name": "@yaakapp/template-function-prompt",
+ "version": "0.0.1"
+ },
+ "plugins/template-function-regex": {
+ "name": "@yaakapp/template-function-regex",
+ "version": "0.0.1"
+ },
+ "plugins/template-function-request": {
+ "name": "@yaakapp/template-function-request",
+ "version": "0.0.1"
+ },
+ "plugins/template-function-response": {
+ "name": "@yaakapp/template-function-response",
+ "version": "0.0.1",
+ "dependencies": {
+ "@xmldom/xmldom": "^0.8.10",
+ "jsonpath-plus": "^9.0.0",
+ "xpath": "^0.0.34"
+ },
+ "devDependencies": {
+ "@types/jsonpath": "^0.2.4"
+ }
+ },
+ "plugins/template-function-response/node_modules/jsonpath-plus": {
+ "version": "9.0.0",
+ "resolved": "https://registry.npmjs.org/jsonpath-plus/-/jsonpath-plus-9.0.0.tgz",
+ "integrity": "sha512-bqE77VIDStrOTV/czspZhTn+o27Xx9ZJRGVkdVShEtPoqsIx5yALv3lWVU6y+PqYvWPJNWE7ORCQheQkEe0DDA==",
+ "license": "MIT",
+ "dependencies": {
+ "@jsep-plugin/assignment": "^1.2.1",
+ "@jsep-plugin/regex": "^1.0.3",
+ "jsep": "^1.3.8"
+ },
+ "bin": {
+ "jsonpath": "bin/jsonpath-cli.js",
+ "jsonpath-plus": "bin/jsonpath-cli.js"
+ },
+ "engines": {
+ "node": ">=14.0.0"
+ }
+ },
+ "plugins/template-function-uuid": {
+ "name": "@yaakapp/template-function-uuid",
+ "version": "0.0.1",
+ "dependencies": {
+ "uuid": "^11.1.0"
+ }
+ },
+ "plugins/template-function-uuid/node_modules/uuid": {
+ "version": "11.1.0",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz",
+ "integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==",
+ "funding": [
+ "https://github.com/sponsors/broofa",
+ "https://github.com/sponsors/ctavan"
+ ],
+ "license": "MIT",
+ "bin": {
+ "uuid": "dist/esm/bin/uuid"
+ }
+ },
+ "plugins/template-function-xml": {
+ "name": "@yaakapp/template-function-xml",
+ "version": "0.0.1",
+ "dependencies": {
+ "@xmldom/xmldom": "^0.8.10",
+ "xpath": "^0.0.34"
+ }
+ },
"src-tauri/yaak_git": {
"name": "@yaakapp-internal/git",
"version": "1.0.0",
diff --git a/package.json b/package.json
index d050d104..25fd371a 100644
--- a/package.json
+++ b/package.json
@@ -10,6 +10,29 @@
"packages/plugin-runtime",
"packages/plugin-runtime-types",
"packages/common-lib",
+ "plugins/auth-basic",
+ "plugins/auth-bearer",
+ "plugins/auth-jwt",
+ "plugins/auth-oauth2",
+ "plugins/exporter-curl",
+ "plugins/filter-jsonpath",
+ "plugins/filter-xpath",
+ "plugins/importer-curl",
+ "plugins/importer-insomnia",
+ "plugins/importer-openapi",
+ "plugins/importer-postman",
+ "plugins/importer-yaak",
+ "plugins/template-function-cookie",
+ "plugins/template-function-encode",
+ "plugins/template-function-fs",
+ "plugins/template-function-hash",
+ "plugins/template-function-json",
+ "plugins/template-function-prompt",
+ "plugins/template-function-regex",
+ "plugins/template-function-request",
+ "plugins/template-function-response",
+ "plugins/template-function-uuid",
+ "plugins/template-function-xml",
"src-tauri/yaak-crypto",
"src-tauri/yaak-git",
"src-tauri/yaak-license",
@@ -27,6 +50,7 @@
"app-build": "tauri build",
"app-dev": "tauri dev --no-watch --config ./src-tauri/tauri-dev.conf.json",
"build": "npm run --workspaces --if-present build",
+ "build-plugins": "npm run --workspaces --if-present build",
"bootstrap": "run-p bootstrap:* && npm run --workspaces --if-present bootstrap",
"bootstrap:vendor-node": "node scripts/vendor-node.cjs",
"bootstrap:vendor-plugins": "node scripts/vendor-plugins.cjs",
@@ -35,7 +59,7 @@
"replace-version": "node scripts/replace-version.cjs",
"tauri": "tauri",
"tauri-before-build": "npm run bootstrap && npm run --workspaces --if-present build",
- "tauri-before-dev": "npm run --workspaces --if-present dev"
+ "tauri-before-dev": "workspaces-run --parallel -- npm run --workspaces --if-present dev"
},
"dependencies": {
"jotai": "^2.12.2"
@@ -53,6 +77,7 @@
"nodejs-file-downloader": "^4.13.0",
"npm-run-all": "^4.1.5",
"prettier": "^3.4.2",
- "typescript": "^5.8.2"
+ "typescript": "^5.8.2",
+ "workspaces-run": "^1.0.2"
}
}
diff --git a/plugins/.gitignore b/plugins/.gitignore
new file mode 100644
index 00000000..5c644e17
--- /dev/null
+++ b/plugins/.gitignore
@@ -0,0 +1 @@
+*/build
diff --git a/src-tauri/vendored/plugins/auth-basic/package.json b/plugins/auth-basic/package.json
similarity index 100%
rename from src-tauri/vendored/plugins/auth-basic/package.json
rename to plugins/auth-basic/package.json
diff --git a/plugins/auth-basic/src/index.ts b/plugins/auth-basic/src/index.ts
new file mode 100644
index 00000000..12f99a36
--- /dev/null
+++ b/plugins/auth-basic/src/index.ts
@@ -0,0 +1,26 @@
+import { PluginDefinition } from '@yaakapp/api';
+
+export const plugin: PluginDefinition = {
+ authentication: {
+ name: 'basic',
+ label: 'Basic Auth',
+ shortLabel: 'Basic',
+ args: [{
+ type: 'text',
+ name: 'username',
+ label: 'Username',
+ optional: true,
+ }, {
+ type: 'text',
+ name: 'password',
+ label: 'Password',
+ optional: true,
+ password: true,
+ }],
+ async onApply(_ctx, { values }) {
+ const { username, password } = values;
+ const value = 'Basic ' + Buffer.from(`${username}:${password}`).toString('base64');
+ return { setHeaders: [{ name: 'Authorization', value }] };
+ },
+ },
+};
diff --git a/src-tauri/vendored/plugins/auth-bearer/package.json b/plugins/auth-bearer/package.json
similarity index 100%
rename from src-tauri/vendored/plugins/auth-bearer/package.json
rename to plugins/auth-bearer/package.json
diff --git a/plugins/auth-bearer/src/index.ts b/plugins/auth-bearer/src/index.ts
new file mode 100644
index 00000000..6c6ec6b4
--- /dev/null
+++ b/plugins/auth-bearer/src/index.ts
@@ -0,0 +1,21 @@
+import { PluginDefinition } from '@yaakapp/api';
+
+export const plugin: PluginDefinition = {
+ authentication: {
+ name: 'bearer',
+ label: 'Bearer Token',
+ shortLabel: 'Bearer',
+ args: [{
+ type: 'text',
+ name: 'token',
+ label: 'Token',
+ optional: true,
+ password: true,
+ }],
+ async onApply(_ctx, { values }) {
+ const { token } = values;
+ const value = `Bearer ${token}`.trim();
+ return { setHeaders: [{ name: 'Authorization', value }] };
+ },
+ },
+};
diff --git a/src-tauri/vendored/plugins/auth-jwt/package.json b/plugins/auth-jwt/package.json
similarity index 100%
rename from src-tauri/vendored/plugins/auth-jwt/package.json
rename to plugins/auth-jwt/package.json
diff --git a/plugins/auth-jwt/src/index.ts b/plugins/auth-jwt/src/index.ts
new file mode 100644
index 00000000..45b20a53
--- /dev/null
+++ b/plugins/auth-jwt/src/index.ts
@@ -0,0 +1,68 @@
+import { PluginDefinition } from '@yaakapp/api';
+import jwt from 'jsonwebtoken';
+
+const algorithms = [
+ 'HS256',
+ 'HS384',
+ 'HS512',
+ 'RS256',
+ 'RS384',
+ 'RS512',
+ 'PS256',
+ 'PS384',
+ 'PS512',
+ 'ES256',
+ 'ES384',
+ 'ES512',
+ 'none',
+] as const;
+
+const defaultAlgorithm = algorithms[0];
+
+export const plugin: PluginDefinition = {
+ authentication: {
+ name: 'jwt',
+ label: 'JWT Bearer',
+ shortLabel: 'JWT',
+ args: [
+ {
+ type: 'select',
+ name: 'algorithm',
+ label: 'Algorithm',
+ hideLabel: true,
+ defaultValue: defaultAlgorithm,
+ options: algorithms.map(value => ({ label: value === 'none' ? 'None' : value, value })),
+ },
+ {
+ type: 'text',
+ name: 'secret',
+ label: 'Secret or Private Key',
+ password: true,
+ optional: true,
+ multiLine: true,
+ },
+ {
+ type: 'checkbox',
+ name: 'secretBase64',
+ label: 'Secret is base64 encoded',
+ },
+ {
+ type: 'editor',
+ name: 'payload',
+ label: 'Payload',
+ language: 'json',
+ defaultValue: '{\n "foo": "bar"\n}',
+ placeholder: '{ }',
+ },
+ ],
+ async onApply(_ctx, { values }) {
+ const { algorithm, secret: _secret, secretBase64, payload } = values;
+ const secret = secretBase64 ? Buffer.from(`${_secret}`, 'base64') : `${_secret}`;
+ const token = jwt.sign(`${payload}`, secret, { algorithm: algorithm as any });
+ const value = `Bearer ${token}`;
+ return { setHeaders: [{ name: 'Authorization', value }] };
+ }
+ ,
+ },
+ }
+;
diff --git a/src-tauri/vendored/plugins/auth-oauth2/package.json b/plugins/auth-oauth2/package.json
similarity index 100%
rename from src-tauri/vendored/plugins/auth-oauth2/package.json
rename to plugins/auth-oauth2/package.json
diff --git a/plugins/auth-oauth2/src/getAccessToken.ts b/plugins/auth-oauth2/src/getAccessToken.ts
new file mode 100644
index 00000000..5651c8cb
--- /dev/null
+++ b/plugins/auth-oauth2/src/getAccessToken.ts
@@ -0,0 +1,74 @@
+import { Context, HttpRequest, HttpUrlParameter } from '@yaakapp/api';
+import { readFileSync } from 'node:fs';
+import { AccessTokenRawResponse } from './store';
+
+export async function getAccessToken(
+ ctx: Context, {
+ accessTokenUrl,
+ scope,
+ audience,
+ params,
+ grantType,
+ credentialsInBody,
+ clientId,
+ clientSecret,
+ }: {
+ clientId: string;
+ clientSecret: string;
+ grantType: string;
+ accessTokenUrl: string;
+ scope: string | null;
+ audience: string | null;
+ credentialsInBody: boolean;
+ params: HttpUrlParameter[];
+ }): Promise {
+ console.log('Getting access token', accessTokenUrl);
+ const httpRequest: Partial = {
+ method: 'POST',
+ url: accessTokenUrl,
+ bodyType: 'application/x-www-form-urlencoded',
+ body: {
+ form: [
+ { name: 'grant_type', value: grantType },
+ ...params,
+ ],
+ },
+ headers: [
+ { name: 'User-Agent', value: 'yaak' },
+ { name: 'Accept', value: 'application/x-www-form-urlencoded, application/json' },
+ { name: 'Content-Type', value: 'application/x-www-form-urlencoded' },
+ ],
+ };
+
+ if (scope) httpRequest.body!.form.push({ name: 'scope', value: scope });
+ if (audience) httpRequest.body!.form.push({ name: 'audience', value: audience });
+
+ if (credentialsInBody) {
+ httpRequest.body!.form.push({ name: 'client_id', value: clientId });
+ httpRequest.body!.form.push({ name: 'client_secret', value: clientSecret });
+ } else {
+ const value = 'Basic ' + Buffer.from(`${clientId}:${clientSecret}`).toString('base64');
+ httpRequest.headers!.push({ name: 'Authorization', value });
+ }
+
+ const resp = await ctx.httpRequest.send({ httpRequest });
+
+ const body = resp.bodyPath ? readFileSync(resp.bodyPath, 'utf8') : '';
+
+ if (resp.status < 200 || resp.status >= 300) {
+ throw new Error('Failed to fetch access token with status=' + resp.status + ' and body=' + body);
+ }
+
+ let response;
+ try {
+ response = JSON.parse(body);
+ } catch {
+ response = Object.fromEntries(new URLSearchParams(body));
+ }
+
+ if (response.error) {
+ throw new Error('Failed to fetch access token with ' + response.error);
+ }
+
+ return response;
+}
diff --git a/plugins/auth-oauth2/src/getOrRefreshAccessToken.ts b/plugins/auth-oauth2/src/getOrRefreshAccessToken.ts
new file mode 100644
index 00000000..43df1402
--- /dev/null
+++ b/plugins/auth-oauth2/src/getOrRefreshAccessToken.ts
@@ -0,0 +1,99 @@
+import { Context, HttpRequest } from '@yaakapp/api';
+import { readFileSync } from 'node:fs';
+import { AccessToken, AccessTokenRawResponse, deleteToken, getToken, storeToken } from './store';
+
+export async function getOrRefreshAccessToken(ctx: Context, contextId: string, {
+ scope,
+ accessTokenUrl,
+ credentialsInBody,
+ clientId,
+ clientSecret,
+ forceRefresh,
+}: {
+ scope: string | null;
+ accessTokenUrl: string;
+ credentialsInBody: boolean;
+ clientId: string;
+ clientSecret: string;
+ forceRefresh?: boolean;
+}): Promise {
+ const token = await getToken(ctx, contextId);
+ if (token == null) {
+ return null;
+ }
+
+ const now = Date.now();
+ const isExpired = token.expiresAt && now > token.expiresAt;
+
+ // Return the current access token if it's still valid
+ if (!isExpired && !forceRefresh) {
+ return token;
+ }
+
+ // Token is expired, but there's no refresh token :(
+ if (!token.response.refresh_token) {
+ return null;
+ }
+
+ // Access token is expired, so get a new one
+ const httpRequest: Partial = {
+ method: 'POST',
+ url: accessTokenUrl,
+ bodyType: 'application/x-www-form-urlencoded',
+ body: {
+ form: [
+ { name: 'grant_type', value: 'refresh_token' },
+ { name: 'refresh_token', value: token.response.refresh_token },
+ ],
+ },
+ headers: [
+ { name: 'User-Agent', value: 'yaak' },
+ { name: 'Accept', value: 'application/x-www-form-urlencoded, application/json' },
+ { name: 'Content-Type', value: 'application/x-www-form-urlencoded' },
+ ],
+ };
+
+ if (scope) httpRequest.body!.form.push({ name: 'scope', value: scope });
+
+ if (credentialsInBody) {
+ httpRequest.body!.form.push({ name: 'client_id', value: clientId });
+ httpRequest.body!.form.push({ name: 'client_secret', value: clientSecret });
+ } else {
+ const value = 'Basic ' + Buffer.from(`${clientId}:${clientSecret}`).toString('base64');
+ httpRequest.headers!.push({ name: 'Authorization', value });
+ }
+
+ const resp = await ctx.httpRequest.send({ httpRequest });
+
+ if (resp.status === 401) {
+ // Bad refresh token, so we'll force it to fetch a fresh access token by deleting
+ // and returning null;
+ console.log('Unauthorized refresh_token request');
+ await deleteToken(ctx, contextId);
+ return null;
+ }
+
+ const body = resp.bodyPath ? readFileSync(resp.bodyPath, 'utf8') : '';
+
+ if (resp.status < 200 || resp.status >= 300) {
+ throw new Error('Failed to refresh access token with status=' + resp.status + ' and body=' + body);
+ }
+
+ let response;
+ try {
+ response = JSON.parse(body);
+ } catch {
+ response = Object.fromEntries(new URLSearchParams(body));
+ }
+
+ if (response.error) {
+ throw new Error(`Failed to fetch access token with ${response.error} -> ${response.error_description}`);
+ }
+
+ const newResponse: AccessTokenRawResponse = {
+ ...response,
+ // Assign a new one or keep the old one,
+ refresh_token: response.refresh_token ?? token.response.refresh_token,
+ };
+ return storeToken(ctx, contextId, newResponse);
+}
diff --git a/plugins/auth-oauth2/src/grants/authorizationCode.ts b/plugins/auth-oauth2/src/grants/authorizationCode.ts
new file mode 100644
index 00000000..c9400d6b
--- /dev/null
+++ b/plugins/auth-oauth2/src/grants/authorizationCode.ts
@@ -0,0 +1,140 @@
+import { Context } from '@yaakapp/api';
+import { createHash, randomBytes } from 'node:crypto';
+import { getAccessToken } from '../getAccessToken';
+import { getOrRefreshAccessToken } from '../getOrRefreshAccessToken';
+import { AccessToken, getDataDirKey, storeToken } from '../store';
+
+export const PKCE_SHA256 = 'S256';
+export const PKCE_PLAIN = 'plain';
+export const DEFAULT_PKCE_METHOD = PKCE_SHA256;
+
+export async function getAuthorizationCode(
+ ctx: Context,
+ contextId: string,
+ {
+ authorizationUrl: authorizationUrlRaw,
+ accessTokenUrl,
+ clientId,
+ clientSecret,
+ redirectUri,
+ scope,
+ state,
+ audience,
+ credentialsInBody,
+ pkce,
+ }: {
+ authorizationUrl: string;
+ accessTokenUrl: string;
+ clientId: string;
+ clientSecret: string;
+ redirectUri: string | null;
+ scope: string | null;
+ state: string | null;
+ audience: string | null;
+ credentialsInBody: boolean;
+ pkce: {
+ challengeMethod: string | null;
+ codeVerifier: string | null;
+ } | null;
+ },
+): Promise {
+ const token = await getOrRefreshAccessToken(ctx, contextId, {
+ accessTokenUrl,
+ scope,
+ clientId,
+ clientSecret,
+ credentialsInBody,
+ });
+ if (token != null) {
+ return token;
+ }
+
+ const authorizationUrl = new URL(`${authorizationUrlRaw ?? ''}`);
+ authorizationUrl.searchParams.set('response_type', 'code');
+ authorizationUrl.searchParams.set('client_id', clientId);
+ if (redirectUri) authorizationUrl.searchParams.set('redirect_uri', redirectUri);
+ if (scope) authorizationUrl.searchParams.set('scope', scope);
+ if (state) authorizationUrl.searchParams.set('state', state);
+ if (audience) authorizationUrl.searchParams.set('audience', audience);
+ if (pkce) {
+ const verifier = pkce.codeVerifier || createPkceCodeVerifier();
+ const challengeMethod = pkce.challengeMethod || DEFAULT_PKCE_METHOD;
+ authorizationUrl.searchParams.set('code_challenge', createPkceCodeChallenge(verifier, challengeMethod));
+ authorizationUrl.searchParams.set('code_challenge_method', challengeMethod);
+ }
+
+ return new Promise(async (resolve, reject) => {
+ const authorizationUrlStr = authorizationUrl.toString();
+ console.log('Authorizing', authorizationUrlStr);
+
+ let foundCode = false;
+
+ let { close } = await ctx.window.openUrl({
+ url: authorizationUrlStr,
+ label: 'oauth-authorization-url',
+ dataDirKey: await getDataDirKey(ctx, contextId),
+ async onClose() {
+ if (!foundCode) {
+ reject(new Error('Authorization window closed'));
+ }
+ },
+ async onNavigate({ url: urlStr }) {
+ const url = new URL(urlStr);
+ if (url.searchParams.has('error')) {
+ return reject(new Error(`Failed to authorize: ${url.searchParams.get('error')}`));
+ }
+ const code = url.searchParams.get('code');
+ if (!code) {
+ return; // Could be one of many redirects in a chain, so skip it
+ }
+
+ // Close the window here, because we don't need it anymore!
+ foundCode = true;
+ close();
+
+ const response = await getAccessToken(ctx, {
+ grantType: 'authorization_code',
+ accessTokenUrl,
+ clientId,
+ clientSecret,
+ scope,
+ audience,
+ credentialsInBody,
+ params: [
+ { name: 'code', value: code },
+ ...(redirectUri ? [{ name: 'redirect_uri', value: redirectUri }] : []),
+ ],
+ });
+
+ try {
+ resolve(await storeToken(ctx, contextId, response));
+ } catch (err) {
+ reject(err);
+ }
+ },
+ });
+ });
+}
+
+function createPkceCodeVerifier() {
+ return encodeForPkce(randomBytes(32));
+}
+
+function createPkceCodeChallenge(verifier: string, method: string) {
+ if (method === 'plain') {
+ return verifier;
+ }
+
+ const hash = encodeForPkce(createHash('sha256').update(verifier).digest());
+ return hash
+ .replace(/=/g, '') // Remove padding '='
+ .replace(/\+/g, '-') // Replace '+' with '-'
+ .replace(/\//g, '_'); // Replace '/' with '_'
+}
+
+function encodeForPkce(bytes: Buffer) {
+ return bytes.toString('base64')
+ .replace(/=/g, '') // Remove padding '='
+ .replace(/\+/g, '-') // Replace '+' with '-'
+ .replace(/\//g, '_'); // Replace '/' with '_'
+}
diff --git a/plugins/auth-oauth2/src/grants/clientCredentials.ts b/plugins/auth-oauth2/src/grants/clientCredentials.ts
new file mode 100644
index 00000000..9543d9b7
--- /dev/null
+++ b/plugins/auth-oauth2/src/grants/clientCredentials.ts
@@ -0,0 +1,43 @@
+import { Context } from '@yaakapp/api';
+import { getAccessToken } from '../getAccessToken';
+import { getToken, storeToken } from '../store';
+
+export async function getClientCredentials(
+ ctx: Context,
+ contextId: string,
+ {
+ accessTokenUrl,
+ clientId,
+ clientSecret,
+ scope,
+ audience,
+ credentialsInBody,
+ }: {
+ accessTokenUrl: string;
+ clientId: string;
+ clientSecret: string;
+ scope: string | null;
+ audience: string | null;
+ credentialsInBody: boolean;
+ },
+) {
+ const token = await getToken(ctx, contextId);
+ if (token) {
+ // resolve(token.response.access_token);
+ // TODO: Refresh token if expired
+ // return;
+ }
+
+ const response = await getAccessToken(ctx, {
+ grantType: 'client_credentials',
+ accessTokenUrl,
+ audience,
+ clientId,
+ clientSecret,
+ scope,
+ credentialsInBody,
+ params: [],
+ });
+
+ return storeToken(ctx, contextId, response);
+}
diff --git a/plugins/auth-oauth2/src/grants/implicit.ts b/plugins/auth-oauth2/src/grants/implicit.ts
new file mode 100644
index 00000000..592f875f
--- /dev/null
+++ b/plugins/auth-oauth2/src/grants/implicit.ts
@@ -0,0 +1,81 @@
+import { Context } from '@yaakapp/api';
+import { AccessToken, AccessTokenRawResponse, getToken, storeToken } from '../store';
+
+export function getImplicit(
+ ctx: Context,
+ contextId: string,
+ {
+ authorizationUrl: authorizationUrlRaw,
+ responseType,
+ clientId,
+ redirectUri,
+ scope,
+ state,
+ audience,
+ }: {
+ authorizationUrl: string;
+ responseType: string;
+ clientId: string;
+ redirectUri: string | null;
+ scope: string | null;
+ state: string | null;
+ audience: string | null;
+ },
+) :Promise {
+ return new Promise(async (resolve, reject) => {
+ const token = await getToken(ctx, contextId);
+ if (token) {
+ // resolve(token.response.access_token);
+ // TODO: Refresh token if expired
+ // return;
+ }
+
+ const authorizationUrl = new URL(`${authorizationUrlRaw ?? ''}`);
+ authorizationUrl.searchParams.set('response_type', 'token');
+ authorizationUrl.searchParams.set('client_id', clientId);
+ if (redirectUri) authorizationUrl.searchParams.set('redirect_uri', redirectUri);
+ if (scope) authorizationUrl.searchParams.set('scope', scope);
+ if (state) authorizationUrl.searchParams.set('state', state);
+ if (audience) authorizationUrl.searchParams.set('audience', audience);
+ if (responseType.includes('id_token')) {
+ authorizationUrl.searchParams.set('nonce', String(Math.floor(Math.random() * 9999999999999) + 1));
+ }
+
+ const authorizationUrlStr = authorizationUrl.toString();
+ let foundAccessToken = false;
+ let { close } = await ctx.window.openUrl({
+ url: authorizationUrlStr,
+ label: 'oauth-authorization-url',
+ async onClose() {
+ if (!foundAccessToken) {
+ reject(new Error('Authorization window closed'));
+ }
+ },
+ async onNavigate({ url: urlStr }) {
+ const url = new URL(urlStr);
+ if (url.searchParams.has('error')) {
+ return reject(Error(`Failed to authorize: ${url.searchParams.get('error')}`));
+ }
+
+ const hash = url.hash.slice(1);
+ const params = new URLSearchParams(hash);
+
+ const accessToken = params.get('access_token');
+ if (!accessToken) {
+ return;
+ }
+ foundAccessToken = true;
+
+ // Close the window here, because we don't need it anymore
+ close();
+
+ const response = Object.fromEntries(params) as unknown as AccessTokenRawResponse;
+ try {
+ resolve(await storeToken(ctx, contextId, response));
+ } catch (err) {
+ reject(err);
+ }
+ },
+ });
+ });
+}
diff --git a/plugins/auth-oauth2/src/grants/password.ts b/plugins/auth-oauth2/src/grants/password.ts
new file mode 100644
index 00000000..2192345f
--- /dev/null
+++ b/plugins/auth-oauth2/src/grants/password.ts
@@ -0,0 +1,55 @@
+import { Context } from '@yaakapp/api';
+import { getAccessToken } from '../getAccessToken';
+import { getOrRefreshAccessToken } from '../getOrRefreshAccessToken';
+import { AccessToken, storeToken } from '../store';
+
+export async function getPassword(
+ ctx: Context,
+ contextId: string,
+ {
+ accessTokenUrl,
+ clientId,
+ clientSecret,
+ username,
+ password,
+ credentialsInBody,
+ audience,
+ scope,
+ }: {
+ accessTokenUrl: string;
+ clientId: string;
+ clientSecret: string;
+ username: string;
+ password: string;
+ scope: string | null;
+ audience: string | null;
+ credentialsInBody: boolean;
+ },
+): Promise {
+ const token = await getOrRefreshAccessToken(ctx, contextId, {
+ accessTokenUrl,
+ scope,
+ clientId,
+ clientSecret,
+ credentialsInBody,
+ });
+ if (token != null) {
+ return token;
+ }
+
+ const response = await getAccessToken(ctx, {
+ accessTokenUrl,
+ clientId,
+ clientSecret,
+ scope,
+ audience,
+ grantType: 'password',
+ credentialsInBody,
+ params: [
+ { name: 'username', value: username },
+ { name: 'password', value: password },
+ ],
+ });
+
+ return storeToken(ctx, contextId, response);
+}
diff --git a/plugins/auth-oauth2/src/index.ts b/plugins/auth-oauth2/src/index.ts
new file mode 100644
index 00000000..9026a305
--- /dev/null
+++ b/plugins/auth-oauth2/src/index.ts
@@ -0,0 +1,332 @@
+import {
+ Context,
+ FormInputSelectOption,
+ GetHttpAuthenticationConfigRequest,
+ JsonPrimitive,
+ PluginDefinition,
+} from '@yaakapp/api';
+import { DEFAULT_PKCE_METHOD, getAuthorizationCode, PKCE_PLAIN, PKCE_SHA256 } from './grants/authorizationCode';
+import { getClientCredentials } from './grants/clientCredentials';
+import { getImplicit } from './grants/implicit';
+import { getPassword } from './grants/password';
+import { AccessToken, deleteToken, getToken, resetDataDirKey } from './store';
+
+type GrantType = 'authorization_code' | 'implicit' | 'password' | 'client_credentials';
+
+const grantTypes: FormInputSelectOption[] = [
+ { label: 'Authorization Code', value: 'authorization_code' },
+ { label: 'Implicit', value: 'implicit' },
+ { label: 'Resource Owner Password Credential', value: 'password' },
+ { label: 'Client Credentials', value: 'client_credentials' },
+];
+
+const defaultGrantType = grantTypes[0]!.value;
+
+function hiddenIfNot(grantTypes: GrantType[], ...other: ((values: GetHttpAuthenticationConfigRequest['values']) => boolean)[]) {
+ return (_ctx: Context, { values }: GetHttpAuthenticationConfigRequest) => {
+ const hasGrantType = grantTypes.find(t => t === String(values.grantType ?? defaultGrantType));
+ const hasOtherBools = other.every(t => t(values));
+ const show = hasGrantType && hasOtherBools;
+ return { hidden: !show };
+ };
+}
+
+const authorizationUrls = [
+ 'https://github.com/login/oauth/authorize',
+ 'https://account.box.com/api/oauth2/authorize',
+ 'https://accounts.google.com/o/oauth2/v2/auth',
+ 'https://api.imgur.com/oauth2/authorize',
+ 'https://bitly.com/oauth/authorize',
+ 'https://gitlab.example.com/oauth/authorize',
+ 'https://medium.com/m/oauth/authorize',
+ 'https://public-api.wordpress.com/oauth2/authorize',
+ 'https://slack.com/oauth/authorize',
+ 'https://todoist.com/oauth/authorize',
+ 'https://www.dropbox.com/oauth2/authorize',
+ 'https://www.linkedin.com/oauth/v2/authorization',
+ 'https://MY_SHOP.myshopify.com/admin/oauth/access_token',
+];
+
+const accessTokenUrls = [
+ 'https://github.com/login/oauth/access_token',
+ 'https://api-ssl.bitly.com/oauth/access_token',
+ 'https://api.box.com/oauth2/token',
+ 'https://api.dropboxapi.com/oauth2/token',
+ 'https://api.imgur.com/oauth2/token',
+ 'https://api.medium.com/v1/tokens',
+ 'https://gitlab.example.com/oauth/token',
+ 'https://public-api.wordpress.com/oauth2/token',
+ 'https://slack.com/api/oauth.access',
+ 'https://todoist.com/oauth/access_token',
+ 'https://www.googleapis.com/oauth2/v4/token',
+ 'https://www.linkedin.com/oauth/v2/accessToken',
+ 'https://MY_SHOP.myshopify.com/admin/oauth/authorize',
+];
+
+export const plugin: PluginDefinition = {
+ authentication: {
+ name: 'oauth2',
+ label: 'OAuth 2.0',
+ shortLabel: 'OAuth 2',
+ actions: [
+ {
+ label: 'Copy Current Token',
+ async onSelect(ctx, { contextId }) {
+ const token = await getToken(ctx, contextId);
+ if (token == null) {
+ await ctx.toast.show({ message: 'No token to copy', color: 'warning' });
+ } else {
+ await ctx.clipboard.copyText(token.response.access_token);
+ await ctx.toast.show({ message: 'Token copied to clipboard', icon: 'copy', color: 'success' });
+ }
+ },
+ },
+ {
+ label: 'Delete Token',
+ async onSelect(ctx, { contextId }) {
+ if (await deleteToken(ctx, contextId)) {
+ await ctx.toast.show({ message: 'Token deleted', color: 'success' });
+ } else {
+ await ctx.toast.show({ message: 'No token to delete', color: 'warning' });
+ }
+ },
+ },
+ {
+ label: 'Clear Window Session',
+ async onSelect(ctx, { contextId }) {
+ await resetDataDirKey(ctx, contextId);
+ },
+ },
+ ],
+ args: [
+ {
+ type: 'select',
+ name: 'grantType',
+ label: 'Grant Type',
+ hideLabel: true,
+ defaultValue: defaultGrantType,
+ options: grantTypes,
+ },
+
+ // Always-present fields
+ {
+ type: 'text',
+ name: 'clientId',
+ label: 'Client ID',
+ optional: true,
+ },
+ {
+ type: 'text',
+ name: 'clientSecret',
+ label: 'Client Secret',
+ optional: true,
+ password: true,
+ dynamic: hiddenIfNot(['authorization_code', 'password', 'client_credentials']),
+ },
+ {
+ type: 'text',
+ name: 'authorizationUrl',
+ optional: true,
+ label: 'Authorization URL',
+ dynamic: hiddenIfNot(['authorization_code', 'implicit']),
+ placeholder: authorizationUrls[0],
+ completionOptions: authorizationUrls.map(url => ({ label: url, value: url })),
+ },
+ {
+ type: 'text',
+ name: 'accessTokenUrl',
+ optional: true,
+ label: 'Access Token URL',
+ placeholder: accessTokenUrls[0],
+ dynamic: hiddenIfNot(['authorization_code', 'password', 'client_credentials']),
+ completionOptions: accessTokenUrls.map(url => ({ label: url, value: url })),
+ },
+ {
+ type: 'text',
+ name: 'redirectUri',
+ label: 'Redirect URI',
+ optional: true,
+ dynamic: hiddenIfNot(['authorization_code', 'implicit']),
+ },
+ {
+ type: 'text',
+ name: 'state',
+ label: 'State',
+ optional: true,
+ dynamic: hiddenIfNot(['authorization_code', 'implicit']),
+ },
+ {
+ type: 'text',
+ name: 'audience',
+ label: 'Audience',
+ optional: true,
+ },
+ {
+ type: 'checkbox',
+ name: 'usePkce',
+ label: 'Use PKCE',
+ dynamic: hiddenIfNot(['authorization_code']),
+ },
+ {
+ type: 'select',
+ name: 'pkceChallengeMethod',
+ label: 'Code Challenge Method',
+ options: [{ label: 'SHA-256', value: PKCE_SHA256 }, { label: 'Plain', value: PKCE_PLAIN }],
+ defaultValue: DEFAULT_PKCE_METHOD,
+ dynamic: hiddenIfNot(['authorization_code'], ({ usePkce }) => !!usePkce),
+ },
+ {
+ type: 'text',
+ name: 'pkceCodeVerifier',
+ label: 'Code Verifier',
+ placeholder: 'Automatically generated if not provided',
+ optional: true,
+ dynamic: hiddenIfNot(['authorization_code'], ({ usePkce }) => !!usePkce),
+ },
+ {
+ type: 'text',
+ name: 'username',
+ label: 'Username',
+ optional: true,
+ dynamic: hiddenIfNot(['password']),
+ },
+ {
+ type: 'text',
+ name: 'password',
+ label: 'Password',
+ password: true,
+ optional: true,
+ dynamic: hiddenIfNot(['password']),
+ },
+ {
+ type: 'select',
+ name: 'responseType',
+ label: 'Response Type',
+ defaultValue: 'token',
+ options: [
+ { label: 'Access Token', value: 'token' },
+ { label: 'ID Token', value: 'id_token' },
+ { label: 'ID and Access Token', value: 'id_token token' },
+ ],
+ dynamic: hiddenIfNot(['implicit']),
+ },
+ {
+ type: 'accordion',
+ label: 'Advanced',
+ inputs: [
+ { type: 'text', name: 'scope', label: 'Scope', optional: true },
+ { type: 'text', name: 'headerPrefix', label: 'Header Prefix', optional: true, defaultValue: 'Bearer' },
+ {
+ type: 'select', name: 'credentials', label: 'Send Credentials', defaultValue: 'body', options: [
+ { label: 'In Request Body', value: 'body' },
+ { label: 'As Basic Authentication', value: 'basic' },
+ ],
+ },
+ ],
+ },
+ {
+ type: 'accordion',
+ label: 'Access Token Response',
+ async dynamic(ctx, { contextId }) {
+ const token = await getToken(ctx, contextId);
+ if (token == null) {
+ return { hidden: true };
+ }
+ return {
+ label: 'Access Token Response',
+ inputs: [
+ {
+ type: 'editor',
+ defaultValue: JSON.stringify(token.response, null, 2),
+ hideLabel: true,
+ readOnly: true,
+ language: 'json',
+ },
+ ],
+ };
+ },
+ },
+ ],
+ async onApply(ctx, { values, contextId }) {
+ const headerPrefix = stringArg(values, 'headerPrefix');
+ const grantType = stringArg(values, 'grantType') as GrantType;
+ const credentialsInBody = values.credentials === 'body';
+
+ let token: AccessToken;
+ if (grantType === 'authorization_code') {
+ const authorizationUrl = stringArg(values, 'authorizationUrl');
+ const accessTokenUrl = stringArg(values, 'accessTokenUrl');
+ token = await getAuthorizationCode(ctx, contextId, {
+ accessTokenUrl: accessTokenUrl.match(/^https?:\/\//) ? accessTokenUrl : `https://${accessTokenUrl}`,
+ authorizationUrl: authorizationUrl.match(/^https?:\/\//) ? authorizationUrl : `https://${authorizationUrl}`,
+ clientId: stringArg(values, 'clientId'),
+ clientSecret: stringArg(values, 'clientSecret'),
+ redirectUri: stringArgOrNull(values, 'redirectUri'),
+ scope: stringArgOrNull(values, 'scope'),
+ audience: stringArgOrNull(values, 'audience'),
+ state: stringArgOrNull(values, 'state'),
+ credentialsInBody,
+ pkce: values.usePkce ? {
+ challengeMethod: stringArg(values, 'pkceChallengeMethod'),
+ codeVerifier: stringArgOrNull(values, 'pkceCodeVerifier'),
+ } : null,
+ });
+ } else if (grantType === 'implicit') {
+ const authorizationUrl = stringArg(values, 'authorizationUrl');
+ token = await getImplicit(ctx, contextId, {
+ authorizationUrl: authorizationUrl.match(/^https?:\/\//) ? authorizationUrl : `https://${authorizationUrl}`,
+ clientId: stringArg(values, 'clientId'),
+ redirectUri: stringArgOrNull(values, 'redirectUri'),
+ responseType: stringArg(values, 'responseType'),
+ scope: stringArgOrNull(values, 'scope'),
+ audience: stringArgOrNull(values, 'audience'),
+ state: stringArgOrNull(values, 'state'),
+ });
+ } else if (grantType === 'client_credentials') {
+ const accessTokenUrl = stringArg(values, 'accessTokenUrl');
+ token = await getClientCredentials(ctx, contextId, {
+ accessTokenUrl: accessTokenUrl.match(/^https?:\/\//) ? accessTokenUrl : `https://${accessTokenUrl}`,
+ clientId: stringArg(values, 'clientId'),
+ clientSecret: stringArg(values, 'clientSecret'),
+ scope: stringArgOrNull(values, 'scope'),
+ audience: stringArgOrNull(values, 'audience'),
+ credentialsInBody,
+ });
+ } else if (grantType === 'password') {
+ const accessTokenUrl = stringArg(values, 'accessTokenUrl');
+ token = await getPassword(ctx, contextId, {
+ accessTokenUrl: accessTokenUrl.match(/^https?:\/\//) ? accessTokenUrl : `https://${accessTokenUrl}`,
+ clientId: stringArg(values, 'clientId'),
+ clientSecret: stringArg(values, 'clientSecret'),
+ username: stringArg(values, 'username'),
+ password: stringArg(values, 'password'),
+ scope: stringArgOrNull(values, 'scope'),
+ audience: stringArgOrNull(values, 'audience'),
+ credentialsInBody,
+ });
+ } else {
+ throw new Error('Invalid grant type ' + grantType);
+ }
+
+ const headerValue = `${headerPrefix} ${token.response.access_token}`.trim();
+ return {
+ setHeaders: [{
+ name: 'Authorization',
+ value: headerValue,
+ }],
+ };
+ },
+ },
+};
+
+function stringArgOrNull(values: Record, name: string): string | null {
+ const arg = values[name];
+ if (arg == null || arg == '') return null;
+ return `${arg}`;
+}
+
+function stringArg(values: Record, name: string): string {
+ const arg = stringArgOrNull(values, name);
+ if (!arg) return '';
+ return arg;
+}
diff --git a/plugins/auth-oauth2/src/store.ts b/plugins/auth-oauth2/src/store.ts
new file mode 100644
index 00000000..89bf43e6
--- /dev/null
+++ b/plugins/auth-oauth2/src/store.ts
@@ -0,0 +1,56 @@
+import { Context } from '@yaakapp/api';
+
+export async function storeToken(ctx: Context, contextId: string, response: AccessTokenRawResponse) {
+ if (!response.access_token) {
+ throw new Error(`Token not found in response`);
+ }
+
+ const expiresAt = response.expires_in ? Date.now() + response.expires_in * 1000 : null;
+ const token: AccessToken = {
+ response,
+ expiresAt,
+ };
+ await ctx.store.set(tokenStoreKey(contextId), token);
+ return token;
+}
+
+export async function getToken(ctx: Context, contextId: string) {
+ return ctx.store.get(tokenStoreKey(contextId));
+}
+
+export async function deleteToken(ctx: Context, contextId: string) {
+ return ctx.store.delete(tokenStoreKey(contextId));
+}
+
+export async function resetDataDirKey(ctx: Context, contextId: string) {
+ const key = new Date().toISOString();
+ return ctx.store.set(dataDirStoreKey(contextId), key);
+}
+
+export async function getDataDirKey(ctx: Context, contextId: string) {
+ const key = (await ctx.store.get(dataDirStoreKey(contextId))) ?? 'default';
+ return `${contextId}::${key}`;
+}
+
+function tokenStoreKey(context_id: string) {
+ return ['token', context_id].join('::');
+}
+
+function dataDirStoreKey(context_id: string) {
+ return ['data_dir', context_id].join('::');
+}
+
+export interface AccessToken {
+ response: AccessTokenRawResponse,
+ expiresAt: number | null;
+}
+
+export interface AccessTokenRawResponse {
+ access_token: string;
+ token_type?: string;
+ expires_in?: number;
+ refresh_token?: string;
+ error?: string;
+ error_description?: string;
+ scope?: string;
+}
diff --git a/src-tauri/vendored/plugins/exporter-curl/package.json b/plugins/exporter-curl/package.json
similarity index 100%
rename from src-tauri/vendored/plugins/exporter-curl/package.json
rename to plugins/exporter-curl/package.json
diff --git a/plugins/exporter-curl/src/index.ts b/plugins/exporter-curl/src/index.ts
new file mode 100644
index 00000000..e8fa3415
--- /dev/null
+++ b/plugins/exporter-curl/src/index.ts
@@ -0,0 +1,101 @@
+import { HttpRequest, PluginDefinition } from '@yaakapp/api';
+
+const NEWLINE = '\\\n ';
+
+export const plugin: PluginDefinition = {
+ httpRequestActions: [{
+ label: 'Copy as Curl',
+ icon: 'copy',
+ async onSelect(ctx, args) {
+ const rendered_request = await ctx.httpRequest.render({ httpRequest: args.httpRequest, purpose: 'preview' });
+ const data = await convertToCurl(rendered_request);
+ await ctx.clipboard.copyText(data);
+ await ctx.toast.show({ message: 'Curl copied to clipboard', icon: 'copy', color: 'success' });
+ },
+ }],
+};
+
+export async function convertToCurl(request: Partial) {
+ const xs = ['curl'];
+
+ // Add method and URL all on first line
+ if (request.method) xs.push('-X', request.method);
+ if (request.url) xs.push(quote(request.url));
+
+
+ xs.push(NEWLINE);
+
+ // Add URL params
+ for (const p of (request.urlParameters ?? []).filter(onlyEnabled)) {
+ xs.push('--url-query', quote(`${p.name}=${p.value}`));
+ xs.push(NEWLINE);
+ }
+
+ // Add headers
+ for (const h of (request.headers ?? []).filter(onlyEnabled)) {
+ xs.push('--header', quote(`${h.name}: ${h.value}`));
+ xs.push(NEWLINE);
+ }
+
+ // Add form params
+ if (Array.isArray(request.body?.form)) {
+ const flag = request.bodyType === 'multipart/form-data' ? '--form' : '--data';
+ for (const p of (request.body?.form ?? []).filter(onlyEnabled)) {
+ if (p.file) {
+ let v = `${p.name}=@${p.file}`;
+ v += p.contentType ? `;type=${p.contentType}` : '';
+ xs.push(flag, v);
+ } else {
+ xs.push(flag, quote(`${p.name}=${p.value}`));
+ }
+ xs.push(NEWLINE);
+ }
+ } else if (typeof request.body?.query === 'string') {
+ const body = { query: request.body.query || '', variables: maybeParseJSON(request.body.variables, undefined) };
+ xs.push('--data-raw', `${quote(JSON.stringify(body))}`);
+ xs.push(NEWLINE);
+ } else if (typeof request.body?.text === 'string') {
+ xs.push('--data-raw', `${quote(request.body.text)}`);
+ xs.push(NEWLINE);
+ }
+
+ // Add basic/digest authentication
+ if (request.authenticationType === 'basic' || request.authenticationType === 'digest') {
+ if (request.authenticationType === 'digest') xs.push('--digest');
+ xs.push(
+ '--user',
+ quote(`${request.authentication?.username ?? ''}:${request.authentication?.password ?? ''}`),
+ );
+ xs.push(NEWLINE);
+ }
+
+ // Add bearer authentication
+ if (request.authenticationType === 'bearer') {
+ xs.push('--header', quote(`Authorization: Bearer ${request.authentication?.token ?? ''}`));
+ xs.push(NEWLINE);
+ }
+
+ // Remove trailing newline
+ if (xs[xs.length - 1] === NEWLINE) {
+ xs.splice(xs.length - 1, 1);
+ }
+
+ return xs.join(' ');
+}
+
+function quote(arg: string): string {
+ const escaped = arg.replace(/'/g, '\\\'');
+ return `'${escaped}'`;
+}
+
+function onlyEnabled(v: { name?: string; enabled?: boolean }): boolean {
+ return v.enabled !== false && !!v.name;
+}
+
+function maybeParseJSON(v: any, fallback: any): string {
+ try {
+ return JSON.parse(v);
+ } catch (err) {
+ return fallback;
+ }
+}
diff --git a/plugins/exporter-curl/tests/index.test.ts b/plugins/exporter-curl/tests/index.test.ts
new file mode 100644
index 00000000..0f633a7b
--- /dev/null
+++ b/plugins/exporter-curl/tests/index.test.ts
@@ -0,0 +1,206 @@
+import { describe, expect, test } from 'vitest';
+import { convertToCurl } from '../src';
+
+describe('exporter-curl', () => {
+ test('Exports GET with params', async () => {
+ expect(
+ await convertToCurl({
+ url: 'https://yaak.app',
+ urlParameters: [
+ { name: 'a', value: 'aaa' },
+ { name: 'b', value: 'bbb', enabled: true },
+ { name: 'c', value: 'ccc', enabled: false },
+ ],
+ }),
+ ).toEqual(
+ [`curl 'https://yaak.app'`, `--url-query 'a=aaa'`, `--url-query 'b=bbb'`].join(` \\\n `),
+ );
+ });
+ test('Exports POST with url form data', async () => {
+ expect(
+ await convertToCurl({
+ url: 'https://yaak.app',
+ method: 'POST',
+ bodyType: 'application/x-www-form-urlencoded',
+ body: {
+ form: [
+ { name: 'a', value: 'aaa' },
+ { name: 'b', value: 'bbb', enabled: true },
+ { name: 'c', value: 'ccc', enabled: false },
+ ],
+ },
+ }),
+ ).toEqual(
+ [`curl -X POST 'https://yaak.app'`, `--data 'a=aaa'`, `--data 'b=bbb'`].join(` \\\n `),
+ );
+ });
+
+ test('Exports POST with GraphQL data', async () => {
+ expect(
+ await convertToCurl({
+ url: 'https://yaak.app',
+ method: 'POST',
+ bodyType: 'graphql',
+ body: {
+ query: '{foo,bar}',
+ variables: '{"a": "aaa", "b": "bbb"}',
+ },
+ }),
+ ).toEqual(
+ [`curl -X POST 'https://yaak.app'`, `--data-raw '{"query":"{foo,bar}","variables":{"a":"aaa","b":"bbb"}}'`].join(` \\\n `),
+ );
+ });
+
+ test('Exports POST with GraphQL data no variables', async () => {
+ expect(
+ await convertToCurl({
+ url: 'https://yaak.app',
+ method: 'POST',
+ bodyType: 'graphql',
+ body: {
+ query: '{foo,bar}',
+ },
+ }),
+ ).toEqual(
+ [`curl -X POST 'https://yaak.app'`, `--data-raw '{"query":"{foo,bar}"}'`].join(` \\\n `),
+ );
+ });
+
+ test('Exports PUT with multipart form', async () => {
+ expect(
+ await convertToCurl({
+ url: 'https://yaak.app',
+ method: 'PUT',
+ bodyType: 'multipart/form-data',
+ body: {
+ form: [
+ { name: 'a', value: 'aaa' },
+ { name: 'b', value: 'bbb', enabled: true },
+ { name: 'c', value: 'ccc', enabled: false },
+ { name: 'f', file: '/foo/bar.png', contentType: 'image/png' },
+ ],
+ },
+ }),
+ ).toEqual(
+ [
+ `curl -X PUT 'https://yaak.app'`,
+ `--form 'a=aaa'`,
+ `--form 'b=bbb'`,
+ `--form f=@/foo/bar.png;type=image/png`,
+ ].join(` \\\n `),
+ );
+ });
+
+ test('Exports JSON body', async () => {
+ expect(
+ await convertToCurl({
+ url: 'https://yaak.app',
+ method: 'POST',
+ bodyType: 'application/json',
+ body: {
+ text: `{"foo":"bar's"}`,
+ },
+ headers: [{ name: 'Content-Type', value: 'application/json' }],
+ }),
+ ).toEqual(
+ [
+ `curl -X POST 'https://yaak.app'`,
+ `--header 'Content-Type: application/json'`,
+ `--data-raw '{"foo":"bar\\'s"}'`,
+ ].join(` \\\n `),
+ );
+ });
+
+ test('Exports multi-line JSON body', async () => {
+ expect(
+ await convertToCurl({
+ url: 'https://yaak.app',
+ method: 'POST',
+ bodyType: 'application/json',
+ body: {
+ text: `{"foo":"bar",\n"baz":"qux"}`,
+ },
+ headers: [{ name: 'Content-Type', value: 'application/json' }],
+ }),
+ ).toEqual(
+ [
+ `curl -X POST 'https://yaak.app'`,
+ `--header 'Content-Type: application/json'`,
+ `--data-raw '{"foo":"bar",\n"baz":"qux"}'`,
+ ].join(` \\\n `),
+ );
+ });
+
+ test('Exports headers', async () => {
+ expect(
+ await convertToCurl({
+ headers: [
+ { name: 'a', value: 'aaa' },
+ { name: 'b', value: 'bbb', enabled: true },
+ { name: 'c', value: 'ccc', enabled: false },
+ ],
+ }),
+ ).toEqual([`curl`, `--header 'a: aaa'`, `--header 'b: bbb'`].join(` \\\n `));
+ });
+
+ test('Basic auth', async () => {
+ expect(
+ await convertToCurl({
+ url: 'https://yaak.app',
+ authenticationType: 'basic',
+ authentication: {
+ username: 'user',
+ password: 'pass',
+ },
+ }),
+ ).toEqual([`curl 'https://yaak.app'`, `--user 'user:pass'`].join(` \\\n `));
+ });
+
+ test('Broken basic auth', async () => {
+ expect(
+ await convertToCurl({
+ url: 'https://yaak.app',
+ authenticationType: 'basic',
+ authentication: {},
+ }),
+ ).toEqual([`curl 'https://yaak.app'`, `--user ':'`].join(` \\\n `));
+ });
+
+ test('Digest auth', async () => {
+ expect(
+ await convertToCurl({
+ url: 'https://yaak.app',
+ authenticationType: 'digest',
+ authentication: {
+ username: 'user',
+ password: 'pass',
+ },
+ }),
+ ).toEqual([`curl 'https://yaak.app'`, `--digest --user 'user:pass'`].join(` \\\n `));
+ });
+
+ test('Bearer auth', async () => {
+ expect(
+ await convertToCurl({
+ url: 'https://yaak.app',
+ authenticationType: 'bearer',
+ authentication: {
+ token: 'tok',
+ },
+ }),
+ ).toEqual([`curl 'https://yaak.app'`, `--header 'Authorization: Bearer tok'`].join(` \\\n `));
+ });
+
+ test('Broken bearer auth', async () => {
+ expect(
+ await convertToCurl({
+ url: 'https://yaak.app',
+ authenticationType: 'bearer',
+ authentication: {
+ username: 'user',
+ password: 'pass',
+ },
+ }),
+ ).toEqual([`curl 'https://yaak.app'`, `--header 'Authorization: Bearer '`].join(` \\\n `));
+ });
+});
diff --git a/src-tauri/vendored/plugins/filter-jsonpath/package.json b/plugins/filter-jsonpath/package.json
similarity index 100%
rename from src-tauri/vendored/plugins/filter-jsonpath/package.json
rename to plugins/filter-jsonpath/package.json
diff --git a/plugins/filter-jsonpath/src/index.ts b/plugins/filter-jsonpath/src/index.ts
new file mode 100644
index 00000000..a4539e61
--- /dev/null
+++ b/plugins/filter-jsonpath/src/index.ts
@@ -0,0 +1,14 @@
+import { PluginDefinition } from '@yaakapp/api';
+import { JSONPath } from 'jsonpath-plus';
+
+export const plugin: PluginDefinition = {
+ filter: {
+ name: 'JSONPath',
+ description: 'Filter JSONPath',
+ onFilter(_ctx, args) {
+ const parsed = JSON.parse(args.payload);
+ const filtered = JSONPath({ path: args.filter, json: parsed });
+ return { filtered: JSON.stringify(filtered, null, 2) };
+ },
+ },
+};
diff --git a/src-tauri/vendored/plugins/filter-xpath/package.json b/plugins/filter-xpath/package.json
similarity index 100%
rename from src-tauri/vendored/plugins/filter-xpath/package.json
rename to plugins/filter-xpath/package.json
diff --git a/plugins/filter-xpath/src/index.ts b/plugins/filter-xpath/src/index.ts
new file mode 100644
index 00000000..4a010657
--- /dev/null
+++ b/plugins/filter-xpath/src/index.ts
@@ -0,0 +1,21 @@
+import { DOMParser } from '@xmldom/xmldom';
+import { PluginDefinition } from '@yaakapp/api';
+import xpath from 'xpath';
+
+export const plugin: PluginDefinition = {
+ filter: {
+ name: 'XPath',
+ description: 'Filter XPath',
+ onFilter(_ctx, args) {
+ const doc = new DOMParser().parseFromString(args.payload, 'text/xml');
+ const result = xpath.select(args.filter, doc, false);
+
+ if (Array.isArray(result)) {
+ return { filtered: result.map(r => String(r)).join('\n') };
+ } else {
+ // Not sure what cases this happens in (?)
+ return { filtered: String(result) };
+ }
+ },
+ },
+};
diff --git a/src-tauri/vendored/plugins/importer-curl/package.json b/plugins/importer-curl/package.json
similarity index 100%
rename from src-tauri/vendored/plugins/importer-curl/package.json
rename to plugins/importer-curl/package.json
diff --git a/plugins/importer-curl/src/index.ts b/plugins/importer-curl/src/index.ts
new file mode 100644
index 00000000..887e4c1d
--- /dev/null
+++ b/plugins/importer-curl/src/index.ts
@@ -0,0 +1,441 @@
+import { Context, Environment, Folder, HttpRequest, HttpUrlParameter, PluginDefinition, Workspace } from '@yaakapp/api';
+import { ControlOperator, parse, ParseEntry } from 'shell-quote';
+
+type AtLeast = Partial & Pick;
+
+interface ExportResources {
+ workspaces: AtLeast[];
+ environments: AtLeast[];
+ httpRequests: AtLeast[];
+ folders: AtLeast[];
+}
+
+const DATA_FLAGS = ['d', 'data', 'data-raw', 'data-urlencode', 'data-binary', 'data-ascii'];
+const SUPPORTED_FLAGS = [
+ ['cookie', 'b'],
+ ['d', 'data'], // Add url encoded data
+ ['data-ascii'],
+ ['data-binary'],
+ ['data-raw'],
+ ['data-urlencode'],
+ ['digest'], // Apply auth as digest
+ ['form', 'F'], // Add multipart data
+ ['get', 'G'], // Put the post data in the URL
+ ['header', 'H'],
+ ['request', 'X'], // Request method
+ ['url'], // Specify the URL explicitly
+ ['url-query'],
+ ['user', 'u'], // Authentication
+ DATA_FLAGS,
+].flatMap((v) => v);
+
+const BOOLEAN_FLAGS = ['G', 'get', 'digest'];
+
+type FlagValue = string | boolean;
+
+type FlagsByName = Record;
+
+export const plugin: PluginDefinition = {
+ importer: {
+ name: 'cURL',
+ description: 'Import cURL commands',
+ onImport(_ctx: Context, args: { text: string }) {
+ return convertCurl(args.text) as any;
+ },
+ },
+};
+
+export function convertCurl(rawData: string) {
+ if (!rawData.match(/^\s*curl /)) {
+ return null;
+ }
+
+ const commands: ParseEntry[][] = [];
+
+ // Replace non-escaped newlines with semicolons to make parsing easier
+ // NOTE: This is really slow in debug build but fast in release mode
+ const normalizedData = rawData.replace(/\ncurl/g, '; curl');
+
+ let currentCommand: ParseEntry[] = [];
+
+ const parsed = parse(normalizedData);
+
+ // Break up `-XPOST` into `-X POST`
+ const normalizedParseEntries = parsed.flatMap((entry) => {
+ if (
+ typeof entry === 'string' &&
+ entry.startsWith('-') &&
+ !entry.startsWith('--') &&
+ entry.length > 2
+ ) {
+ return [entry.slice(0, 2), entry.slice(2)];
+ }
+ return entry;
+ });
+
+ for (const parseEntry of normalizedParseEntries) {
+ if (typeof parseEntry === 'string') {
+ if (parseEntry.startsWith('$')) {
+ currentCommand.push(parseEntry.slice(1));
+ } else {
+ currentCommand.push(parseEntry);
+ }
+ continue;
+ }
+
+ if ('comment' in parseEntry) {
+ continue;
+ }
+
+ const { op } = parseEntry as { op: 'glob'; pattern: string } | { op: ControlOperator };
+
+ // `;` separates commands
+ if (op === ';') {
+ commands.push(currentCommand);
+ currentCommand = [];
+ continue;
+ }
+
+ if (op?.startsWith('$')) {
+ // Handle the case where literal like -H $'Header: \'Some Quoted Thing\''
+ const str = op.slice(2, op.length - 1).replace(/\\'/g, '\'');
+
+ currentCommand.push(str);
+ continue;
+ }
+
+ if (op === 'glob') {
+ currentCommand.push((parseEntry as { op: 'glob'; pattern: string }).pattern);
+ }
+ }
+
+ commands.push(currentCommand);
+
+ const workspace: ExportResources['workspaces'][0] = {
+ model: 'workspace',
+ id: generateId('workspace'),
+ name: 'Curl Import',
+ };
+
+ const requests: ExportResources['httpRequests'] = commands
+ .filter((command) => command[0] === 'curl')
+ .map((v) => importCommand(v, workspace.id));
+
+ return {
+ resources: {
+ httpRequests: requests,
+ workspaces: [workspace],
+ },
+ };
+}
+
+function importCommand(parseEntries: ParseEntry[], workspaceId: string) {
+ // ~~~~~~~~~~~~~~~~~~~~~ //
+ // Collect all the flags //
+ // ~~~~~~~~~~~~~~~~~~~~~ //
+ const flagsByName: FlagsByName = {};
+ const singletons: ParseEntry[] = [];
+
+ // Start at 1 so we can skip the ^curl part
+ for (let i = 1; i < parseEntries.length; i++) {
+ let parseEntry = parseEntries[i];
+ if (typeof parseEntry === 'string') {
+ parseEntry = parseEntry.trim();
+ }
+
+ if (typeof parseEntry === 'string' && parseEntry.match(/^-{1,2}[\w-]+/)) {
+ const isSingleDash = parseEntry[0] === '-' && parseEntry[1] !== '-';
+ let name = parseEntry.replace(/^-{1,2}/, '');
+
+ if (!SUPPORTED_FLAGS.includes(name)) {
+ continue;
+ }
+
+ let value;
+ const nextEntry = parseEntries[i + 1];
+ const hasValue = !BOOLEAN_FLAGS.includes(name);
+ if (isSingleDash && name.length > 1) {
+ // Handle squished arguments like -XPOST
+ value = name.slice(1);
+ name = name.slice(0, 1);
+ } else if (typeof nextEntry === 'string' && hasValue && !nextEntry.startsWith('-')) {
+ // Next arg is not a flag, so assign it as the value
+ value = nextEntry;
+ i++; // Skip next one
+ } else {
+ value = true;
+ }
+
+ flagsByName[name] = flagsByName[name] || [];
+ flagsByName[name]!.push(value);
+ } else if (parseEntry) {
+ singletons.push(parseEntry);
+ }
+ }
+
+ // ~~~~~~~~~~~~~~~~~ //
+ // Build the request //
+ // ~~~~~~~~~~~~~~~~~ //
+
+ // Url and Parameters
+ let urlParameters: HttpUrlParameter[];
+ let url: string;
+
+ const urlArg = getPairValue(flagsByName, (singletons[0] as string) || '', ['url']);
+ const [baseUrl, search] = splitOnce(urlArg, '?');
+ urlParameters =
+ search?.split('&').map((p) => {
+ const v = splitOnce(p, '=');
+ return { name: decodeURIComponent(v[0] ?? ''), value: decodeURIComponent(v[1] ?? ''), enabled: true };
+ }) ?? [];
+
+ url = baseUrl ?? urlArg;
+
+ // Query params
+ for (const p of flagsByName['url-query'] ?? []) {
+ if (typeof p !== 'string') {
+ continue;
+ }
+ const [name, value] = p.split('=');
+ urlParameters.push({
+ name: name ?? '',
+ value: value ?? '',
+ enabled: true,
+ });
+ }
+
+ // Authentication
+ const [username, password] = getPairValue(flagsByName, '', ['u', 'user']).split(/:(.*)$/);
+
+ const isDigest = getPairValue(flagsByName, false, ['digest']);
+ const authenticationType = username ? (isDigest ? 'digest' : 'basic') : null;
+ const authentication = username
+ ? {
+ username: username.trim(),
+ password: (password ?? '').trim(),
+ }
+ : {};
+
+ // Headers
+ const headers = [
+ ...((flagsByName['header'] as string[] | undefined) || []),
+ ...((flagsByName['H'] as string[] | undefined) || []),
+ ].map((header) => {
+ const [name, value] = header.split(/:(.*)$/);
+ // remove final colon from header name if present
+ if (!value) {
+ return {
+ name: (name ?? '').trim().replace(/;$/, ''),
+ value: '',
+ enabled: true,
+ };
+ }
+ return {
+ name: (name ?? '').trim(),
+ value: value.trim(),
+ enabled: true,
+ };
+ });
+
+ // Cookies
+ const cookieHeaderValue = [
+ ...((flagsByName['cookie'] as string[] | undefined) || []),
+ ...((flagsByName['b'] as string[] | undefined) || []),
+ ]
+ .map((str) => {
+ const name = str.split('=', 1)[0];
+ const value = str.replace(`${name}=`, '');
+ return `${name}=${value}`;
+ })
+ .join('; ');
+
+ // Convert cookie value to header
+ const existingCookieHeader = headers.find((header) => header.name.toLowerCase() === 'cookie');
+
+ if (cookieHeaderValue && existingCookieHeader) {
+ // Has existing cookie header, so let's update it
+ existingCookieHeader.value += `; ${cookieHeaderValue}`;
+ } else if (cookieHeaderValue) {
+ // No existing cookie header, so let's make a new one
+ headers.push({
+ name: 'Cookie',
+ value: cookieHeaderValue,
+ enabled: true,
+ });
+ }
+
+ // Body (Text or Blob)
+ const dataParameters = pairsToDataParameters(flagsByName);
+ const contentTypeHeader = headers.find((header) => header.name.toLowerCase() === 'content-type');
+ const mimeType = contentTypeHeader ? contentTypeHeader.value.split(';')[0] : null;
+
+ // Body (Multipart Form Data)
+ const formDataParams = [
+ ...((flagsByName['form'] as string[] | undefined) || []),
+ ...((flagsByName['F'] as string[] | undefined) || []),
+ ].map((str) => {
+ const parts = str.split('=');
+ const name = parts[0] ?? '';
+ const value = parts[1] ?? '';
+ const item: { name: string; value?: string; file?: string; enabled: boolean } = {
+ name,
+ enabled: true,
+ };
+
+ if (value.indexOf('@') === 0) {
+ item['file'] = value.slice(1);
+ } else {
+ item['value'] = value;
+ }
+
+ return item;
+ });
+
+ // Body
+ let body = {};
+ let bodyType: string | null = null;
+ const bodyAsGET = getPairValue(flagsByName, false, ['G', 'get']);
+
+ if (dataParameters.length > 0 && bodyAsGET) {
+ urlParameters.push(...dataParameters);
+ } else if (
+ dataParameters.length > 0 &&
+ (mimeType == null || mimeType === 'application/x-www-form-urlencoded')
+ ) {
+ bodyType = mimeType ?? 'application/x-www-form-urlencoded';
+ body = {
+ form: dataParameters.map((parameter) => ({
+ ...parameter,
+ name: decodeURIComponent(parameter.name || ''),
+ value: decodeURIComponent(parameter.value || ''),
+ })),
+ };
+ headers.push({
+ name: 'Content-Type',
+ value: 'application/x-www-form-urlencoded',
+ enabled: true,
+ });
+ } else if (dataParameters.length > 0) {
+ bodyType =
+ mimeType === 'application/json' || mimeType === 'text/xml' || mimeType === 'text/plain'
+ ? mimeType
+ : 'other';
+ body = {
+ text: dataParameters
+ .map(({ name, value }) => (name && value ? `${name}=${value}` : name || value))
+ .join('&'),
+ };
+ } else if (formDataParams.length) {
+ bodyType = mimeType ?? 'multipart/form-data';
+ body = {
+ form: formDataParams,
+ };
+ if (mimeType == null) {
+ headers.push({
+ name: 'Content-Type',
+ value: 'multipart/form-data',
+ enabled: true,
+ });
+ }
+ }
+
+ // Method
+ let method = getPairValue(flagsByName, '', ['X', 'request']).toUpperCase();
+
+ if (method === '' && body) {
+ method = 'text' in body || 'form' in body ? 'POST' : 'GET';
+ }
+
+ const request: ExportResources['httpRequests'][0] = {
+ id: generateId('http_request'),
+ model: 'http_request',
+ workspaceId,
+ name: '',
+ urlParameters,
+ url,
+ method,
+ headers,
+ authentication,
+ authenticationType,
+ body,
+ bodyType,
+ folderId: null,
+ sortPriority: 0,
+ };
+
+ return request;
+}
+
+interface DataParameter {
+ name: string;
+ value: string;
+ contentType?: string;
+ filePath?: string;
+ enabled?: boolean;
+}
+
+function pairsToDataParameters(keyedPairs: FlagsByName): DataParameter[] {
+ let dataParameters: DataParameter[] = [];
+
+ for (const flagName of DATA_FLAGS) {
+ const pairs = keyedPairs[flagName];
+
+ if (!pairs || pairs.length === 0) {
+ continue;
+ }
+
+ for (const p of pairs) {
+ if (typeof p !== 'string') continue;
+ let params = p.split("&");
+ for (const param of params) {
+ const [name, value] = param.split('=');
+ if (param.startsWith('@')) {
+ // Yaak doesn't support files in url-encoded data, so
+ dataParameters.push({
+ name: name ?? '',
+ value: '',
+ filePath: param.slice(1),
+ enabled: true,
+ });
+ } else {
+ dataParameters.push({
+ name: name ?? '',
+ value: flagName === 'data-urlencode' ? encodeURIComponent(value ?? '') : value ?? '',
+ enabled: true,
+ });
+ }
+ }
+ }
+ }
+
+ return dataParameters;
+}
+
+const getPairValue = (
+ pairsByName: FlagsByName,
+ defaultValue: T,
+ names: string[],
+) => {
+ for (const name of names) {
+ if (pairsByName[name] && pairsByName[name]!.length) {
+ return pairsByName[name]![0] as T;
+ }
+ }
+
+ return defaultValue;
+};
+
+function splitOnce(str: string, sep: string): string[] {
+ const index = str.indexOf(sep);
+ if (index > -1) {
+ return [str.slice(0, index), str.slice(index + 1)];
+ }
+ return [str];
+}
+
+const idCount: Partial> = {};
+
+function generateId(model: string): string {
+ idCount[model] = (idCount[model] ?? -1) + 1;
+ return `GENERATE_ID::${model.toUpperCase()}_${idCount[model]}`;
+}
diff --git a/plugins/importer-curl/tests/index.test.ts b/plugins/importer-curl/tests/index.test.ts
new file mode 100644
index 00000000..10c266fa
--- /dev/null
+++ b/plugins/importer-curl/tests/index.test.ts
@@ -0,0 +1,400 @@
+import { HttpRequest, Workspace } from '@yaakapp/api';
+import { describe, expect, test } from 'vitest';
+import { convertCurl } from '../src';
+
+describe('importer-curl', () => {
+ test('Imports basic GET', () => {
+ expect(convertCurl('curl https://yaak.app')).toEqual({
+ resources: {
+ workspaces: [baseWorkspace()],
+ httpRequests: [
+ baseRequest({
+ url: 'https://yaak.app',
+ }),
+ ],
+ },
+ });
+ });
+
+ test('Explicit URL', () => {
+ expect(convertCurl('curl --url https://yaak.app')).toEqual({
+ resources: {
+ workspaces: [baseWorkspace()],
+ httpRequests: [
+ baseRequest({
+ url: 'https://yaak.app',
+ }),
+ ],
+ },
+ });
+ });
+
+ test('Missing URL', () => {
+ expect(convertCurl('curl -X POST')).toEqual({
+ resources: {
+ workspaces: [baseWorkspace()],
+ httpRequests: [
+ baseRequest({
+ method: 'POST',
+ }),
+ ],
+ },
+ });
+ });
+
+ test('URL between', () => {
+ expect(convertCurl('curl -v https://yaak.app -X POST')).toEqual({
+ resources: {
+ workspaces: [baseWorkspace()],
+ httpRequests: [
+ baseRequest({
+ url: 'https://yaak.app',
+ method: 'POST',
+ }),
+ ],
+ },
+ });
+ });
+
+ test('Random flags', () => {
+ expect(convertCurl('curl --random -Z -Y -S --foo https://yaak.app')).toEqual({
+ resources: {
+ workspaces: [baseWorkspace()],
+ httpRequests: [
+ baseRequest({
+ url: 'https://yaak.app',
+ }),
+ ],
+ },
+ });
+ });
+
+ test('Imports --request method', () => {
+ expect(convertCurl('curl --request POST https://yaak.app')).toEqual({
+ resources: {
+ workspaces: [baseWorkspace()],
+ httpRequests: [
+ baseRequest({
+ url: 'https://yaak.app',
+ method: 'POST',
+ }),
+ ],
+ },
+ });
+ });
+
+ test('Imports -XPOST method', () => {
+ expect(convertCurl('curl -XPOST --request POST https://yaak.app')).toEqual({
+ resources: {
+ workspaces: [baseWorkspace()],
+ httpRequests: [
+ baseRequest({
+ url: 'https://yaak.app',
+ method: 'POST',
+ }),
+ ],
+ },
+ });
+ });
+
+ test('Imports multiple requests', () => {
+ expect(
+ convertCurl('curl \\\n https://yaak.app\necho "foo"\ncurl example.com;curl foo.com'),
+ ).toEqual({
+ resources: {
+ workspaces: [baseWorkspace()],
+ httpRequests: [
+ baseRequest({ url: 'https://yaak.app' }),
+ baseRequest({ url: 'example.com' }),
+ baseRequest({ url: 'foo.com' }),
+ ],
+ },
+ });
+ });
+
+ test('Imports form data', () => {
+ expect(
+ convertCurl('curl -X POST -F "a=aaa" -F b=bbb" -F f=@filepath https://yaak.app'),
+ ).toEqual({
+ resources: {
+ workspaces: [baseWorkspace()],
+ httpRequests: [
+ baseRequest({
+ method: 'POST',
+ url: 'https://yaak.app',
+ headers: [
+ {
+ name: 'Content-Type',
+ value: 'multipart/form-data',
+ enabled: true,
+ },
+ ],
+ bodyType: 'multipart/form-data',
+ body: {
+ form: [
+ { enabled: true, name: 'a', value: 'aaa' },
+ { enabled: true, name: 'b', value: 'bbb' },
+ { enabled: true, name: 'f', file: 'filepath' },
+ ],
+ },
+ }),
+ ],
+ },
+ });
+ });
+
+ test('Imports data params as form url-encoded', () => {
+ expect(convertCurl('curl -d a -d b -d c=ccc https://yaak.app')).toEqual({
+ resources: {
+ workspaces: [baseWorkspace()],
+ httpRequests: [
+ baseRequest({
+ method: 'POST',
+ url: 'https://yaak.app',
+ bodyType: 'application/x-www-form-urlencoded',
+ headers: [
+ {
+ name: 'Content-Type',
+ value: 'application/x-www-form-urlencoded',
+ enabled: true,
+ },
+ ],
+ body: {
+ form: [
+ { name: 'a', value: '', enabled: true },
+ { name: 'b', value: '', enabled: true },
+ { name: 'c', value: 'ccc', enabled: true },
+ ],
+ },
+ }),
+ ],
+ },
+ });
+ });
+
+ test('Imports combined data params as form url-encoded', () => {
+ expect(convertCurl(`curl -d 'a=aaa&b=bbb&c' https://yaak.app`)).toEqual({
+ resources: {
+ workspaces: [baseWorkspace()],
+ httpRequests: [
+ baseRequest({
+ method: 'POST',
+ url: 'https://yaak.app',
+ bodyType: 'application/x-www-form-urlencoded',
+ headers: [
+ {
+ name: 'Content-Type',
+ value: 'application/x-www-form-urlencoded',
+ enabled: true,
+ },
+ ],
+ body: {
+ form: [
+ { name: 'a', value: 'aaa', enabled: true },
+ { name: 'b', value: 'bbb', enabled: true },
+ { name: 'c', value: '', enabled: true },
+ ],
+ },
+ }),
+ ],
+ },
+ });
+ });
+
+ test('Imports data params as text', () => {
+ expect(
+ convertCurl('curl -H Content-Type:text/plain -d a -d b -d c=ccc https://yaak.app'),
+ ).toEqual({
+ resources: {
+ workspaces: [baseWorkspace()],
+ httpRequests: [
+ baseRequest({
+ method: 'POST',
+ url: 'https://yaak.app',
+ headers: [{ name: 'Content-Type', value: 'text/plain', enabled: true }],
+ bodyType: 'text/plain',
+ body: { text: 'a&b&c=ccc' },
+ }),
+ ],
+ },
+ });
+ });
+
+ test('Imports post data into URL', () => {
+ expect(
+ convertCurl('curl -G https://api.stripe.com/v1/payment_links -d limit=3'),
+ ).toEqual({
+ resources: {
+ workspaces: [baseWorkspace()],
+ httpRequests: [
+ baseRequest({
+ method: 'GET',
+ url: 'https://api.stripe.com/v1/payment_links',
+ urlParameters: [{
+ enabled: true,
+ name: 'limit',
+ value: '3',
+ }],
+ }),
+ ],
+ },
+ });
+ });
+
+ test('Imports multi-line JSON', () => {
+ expect(
+ convertCurl(`curl -H Content-Type:application/json -d $'{\n "foo":"bar"\n}' https://yaak.app`),
+ ).toEqual({
+ resources: {
+ workspaces: [baseWorkspace()],
+ httpRequests: [
+ baseRequest({
+ method: 'POST',
+ url: 'https://yaak.app',
+ headers: [{ name: 'Content-Type', value: 'application/json', enabled: true }],
+ bodyType: 'application/json',
+ body: { text: '{\n "foo":"bar"\n}' },
+ }),
+ ],
+ },
+ });
+ });
+
+ test('Imports multiple headers', () => {
+ expect(
+ convertCurl('curl -H Foo:bar --header Name -H AAA:bbb -H :ccc https://yaak.app'),
+ ).toEqual({
+ resources: {
+ workspaces: [baseWorkspace()],
+ httpRequests: [
+ baseRequest({
+ url: 'https://yaak.app',
+ headers: [
+ { name: 'Name', value: '', enabled: true },
+ { name: 'Foo', value: 'bar', enabled: true },
+ { name: 'AAA', value: 'bbb', enabled: true },
+ { name: '', value: 'ccc', enabled: true },
+ ],
+ }),
+ ],
+ },
+ });
+ });
+
+ test('Imports basic auth', () => {
+ expect(convertCurl('curl --user user:pass https://yaak.app')).toEqual({
+ resources: {
+ workspaces: [baseWorkspace()],
+ httpRequests: [
+ baseRequest({
+ url: 'https://yaak.app',
+ authenticationType: 'basic',
+ authentication: {
+ username: 'user',
+ password: 'pass',
+ },
+ }),
+ ],
+ },
+ });
+ });
+
+ test('Imports digest auth', () => {
+ expect(convertCurl('curl --digest --user user:pass https://yaak.app')).toEqual({
+ resources: {
+ workspaces: [baseWorkspace()],
+ httpRequests: [
+ baseRequest({
+ url: 'https://yaak.app',
+ authenticationType: 'digest',
+ authentication: {
+ username: 'user',
+ password: 'pass',
+ },
+ }),
+ ],
+ },
+ });
+ });
+
+ test('Imports cookie as header', () => {
+ expect(convertCurl('curl --cookie "foo=bar" https://yaak.app')).toEqual({
+ resources: {
+ workspaces: [baseWorkspace()],
+ httpRequests: [
+ baseRequest({
+ url: 'https://yaak.app',
+ headers: [{ name: 'Cookie', value: 'foo=bar', enabled: true }],
+ }),
+ ],
+ },
+ });
+ });
+
+ test('Imports query params', () => {
+ expect(convertCurl('curl "https://yaak.app" --url-query foo=bar --url-query baz=qux')).toEqual({
+ resources: {
+ workspaces: [baseWorkspace()],
+ httpRequests: [
+ baseRequest({
+ url: 'https://yaak.app',
+ urlParameters: [
+ { name: 'foo', value: 'bar', enabled: true },
+ { name: 'baz', value: 'qux', enabled: true },
+ ],
+ }),
+ ],
+ },
+ });
+ });
+
+ test('Imports query params from the URL', () => {
+ expect(convertCurl('curl "https://yaak.app?foo=bar&baz=a%20a"')).toEqual({
+ resources: {
+ workspaces: [baseWorkspace()],
+ httpRequests: [
+ baseRequest({
+ url: 'https://yaak.app',
+ urlParameters: [
+ { name: 'foo', value: 'bar', enabled: true },
+ { name: 'baz', value: 'a a', enabled: true },
+ ],
+ }),
+ ],
+ },
+ });
+ });
+});
+
+const idCount: Partial> = {};
+
+function baseRequest(mergeWith: Partial) {
+ idCount.http_request = (idCount.http_request ?? -1) + 1;
+ return {
+ id: `GENERATE_ID::HTTP_REQUEST_${idCount.http_request}`,
+ model: 'http_request',
+ authentication: {},
+ authenticationType: null,
+ body: {},
+ bodyType: null,
+ folderId: null,
+ headers: [],
+ method: 'GET',
+ name: '',
+ sortPriority: 0,
+ url: '',
+ urlParameters: [],
+ workspaceId: `GENERATE_ID::WORKSPACE_${idCount.workspace}`,
+ ...mergeWith,
+ };
+}
+
+function baseWorkspace(mergeWith: Partial = {}) {
+ idCount.workspace = (idCount.workspace ?? -1) + 1;
+ return {
+ id: `GENERATE_ID::WORKSPACE_${idCount.workspace}`,
+ model: 'workspace',
+ name: 'Curl Import',
+ ...mergeWith,
+ };
+}
diff --git a/src-tauri/vendored/plugins/importer-insomnia/package.json b/plugins/importer-insomnia/package.json
similarity index 100%
rename from src-tauri/vendored/plugins/importer-insomnia/package.json
rename to plugins/importer-insomnia/package.json
diff --git a/plugins/importer-insomnia/src/common.ts b/plugins/importer-insomnia/src/common.ts
new file mode 100644
index 00000000..253924f0
--- /dev/null
+++ b/plugins/importer-insomnia/src/common.ts
@@ -0,0 +1,34 @@
+
+export function convertSyntax(variable: string): string {
+ if (!isJSString(variable)) return variable;
+ return variable.replaceAll(/{{\s*(_\.)?([^}]+)\s*}}/g, '${[$2]}');
+}
+
+export function isJSObject(obj: any) {
+ return Object.prototype.toString.call(obj) === '[object Object]';
+}
+
+export function isJSString(obj: any) {
+ return Object.prototype.toString.call(obj) === '[object String]';
+}
+
+export function convertId(id: string): string {
+ if (id.startsWith('GENERATE_ID::')) {
+ return id;
+ }
+ return `GENERATE_ID::${id}`;
+}
+
+export function deleteUndefinedAttrs(obj: T): T {
+ if (Array.isArray(obj) && obj != null) {
+ return obj.map(deleteUndefinedAttrs) as T;
+ } else if (typeof obj === 'object' && obj != null) {
+ return Object.fromEntries(
+ Object.entries(obj)
+ .filter(([, v]) => v !== undefined)
+ .map(([k, v]) => [k, deleteUndefinedAttrs(v)]),
+ ) as T;
+ } else {
+ return obj;
+ }
+}
diff --git a/plugins/importer-insomnia/src/index.ts b/plugins/importer-insomnia/src/index.ts
new file mode 100644
index 00000000..4d95ac2b
--- /dev/null
+++ b/plugins/importer-insomnia/src/index.ts
@@ -0,0 +1,35 @@
+import { Context, PluginDefinition } from '@yaakapp/api';
+import YAML from 'yaml';
+import { deleteUndefinedAttrs, isJSObject } from './common';
+import { convertInsomniaV4 } from './v4';
+import { convertInsomniaV5 } from './v5';
+
+export const plugin: PluginDefinition = {
+ importer: {
+ name: 'Insomnia',
+ description: 'Import Insomnia workspaces',
+ async onImport(_ctx: Context, args: { text: string }) {
+ return convertInsomnia(args.text);
+ },
+ },
+};
+
+export function convertInsomnia(contents: string) {
+ let parsed: any;
+
+ try {
+ parsed = JSON.parse(contents);
+ } catch (e) {
+ }
+
+ try {
+ parsed = parsed ?? YAML.parse(contents);
+ } catch (e) {
+ }
+
+ if (!isJSObject(parsed)) return null;
+
+ const result = convertInsomniaV5(parsed) ?? convertInsomniaV4(parsed);
+
+ return deleteUndefinedAttrs(result);
+}
diff --git a/plugins/importer-insomnia/src/v4.ts b/plugins/importer-insomnia/src/v4.ts
new file mode 100644
index 00000000..8fcb6173
--- /dev/null
+++ b/plugins/importer-insomnia/src/v4.ts
@@ -0,0 +1,206 @@
+import { PartialImportResources } from '@yaakapp/api';
+import { convertId, convertSyntax, isJSObject } from './common';
+
+export function convertInsomniaV4(parsed: Record) {
+ if (!Array.isArray(parsed.resources)) return null;
+
+ const resources: PartialImportResources = {
+ environments: [],
+ folders: [],
+ grpcRequests: [],
+ httpRequests: [],
+ websocketRequests: [],
+ workspaces: [],
+ };
+
+ // Import workspaces
+ const workspacesToImport = parsed.resources.filter(r => isJSObject(r) && r._type === 'workspace');
+ for (const w of workspacesToImport) {
+ resources.workspaces.push({
+ id: convertId(w._id),
+ createdAt: w.created ? new Date(w.created).toISOString().replace('Z', '') : undefined,
+ updatedAt: w.updated ? new Date(w.updated).toISOString().replace('Z', '') : undefined,
+ model: 'workspace',
+ name: w.name,
+ description: w.description || undefined,
+ });
+ const environmentsToImport = parsed.resources.filter(
+ (r: any) => isJSObject(r) && r._type === 'environment',
+ );
+ resources.environments.push(
+ ...environmentsToImport.map((r: any) => importEnvironment(r, w._id)),
+ );
+
+ const nextFolder = (parentId: string) => {
+ const children = parsed.resources.filter((r: any) => r.parentId === parentId);
+ for (const child of children) {
+ if (!isJSObject(child)) continue;
+
+ if (child._type === 'request_group') {
+ resources.folders.push(importFolder(child, w._id));
+ nextFolder(child._id);
+ } else if (child._type === 'request') {
+ resources.httpRequests.push(
+ importHttpRequest(child, w._id),
+ );
+ } else if (child._type === 'grpc_request') {
+ resources.grpcRequests.push(
+ importGrpcRequest(child, w._id),
+ );
+ }
+ }
+ };
+
+ // Import folders
+ nextFolder(w._id);
+ }
+
+ // Filter out any `null` values
+ resources.httpRequests = resources.httpRequests.filter(Boolean);
+ resources.grpcRequests = resources.grpcRequests.filter(Boolean);
+ resources.environments = resources.environments.filter(Boolean);
+ resources.workspaces = resources.workspaces.filter(Boolean);
+
+ return { resources };
+}
+
+function importHttpRequest(
+ r: any,
+ workspaceId: string,
+): PartialImportResources['httpRequests'][0] {
+ let bodyType: string | null = null;
+ let body = {};
+ if (r.body.mimeType === 'application/octet-stream') {
+ bodyType = 'binary';
+ body = { filePath: r.body.fileName ?? '' };
+ } else if (r.body?.mimeType === 'application/x-www-form-urlencoded') {
+ bodyType = 'application/x-www-form-urlencoded';
+ body = {
+ form: (r.body.params ?? []).map((p: any) => ({
+ enabled: !p.disabled,
+ name: p.name ?? '',
+ value: p.value ?? '',
+ })),
+ };
+ } else if (r.body?.mimeType === 'multipart/form-data') {
+ bodyType = 'multipart/form-data';
+ body = {
+ form: (r.body.params ?? []).map((p: any) => ({
+ enabled: !p.disabled,
+ name: p.name ?? '',
+ value: p.value ?? '',
+ file: p.fileName ?? null,
+ })),
+ };
+ } else if (r.body?.mimeType === 'application/graphql') {
+ bodyType = 'graphql';
+ body = { text: convertSyntax(r.body.text ?? '') };
+ } else if (r.body?.mimeType === 'application/json') {
+ bodyType = 'application/json';
+ body = { text: convertSyntax(r.body.text ?? '') };
+ }
+
+ let authenticationType: string | null = null;
+ let authentication = {};
+ if (r.authentication.type === 'bearer') {
+ authenticationType = 'bearer';
+ authentication = {
+ token: convertSyntax(r.authentication.token),
+ };
+ } else if (r.authentication.type === 'basic') {
+ authenticationType = 'basic';
+ authentication = {
+ username: convertSyntax(r.authentication.username),
+ password: convertSyntax(r.authentication.password),
+ };
+ }
+
+ return {
+ id: convertId(r.meta?.id ?? r._id),
+ createdAt: r.created ? new Date(r.created).toISOString().replace('Z', '') : undefined,
+ updatedAt: r.modified ? new Date(r.modified).toISOString().replace('Z', '') : undefined,
+ workspaceId: convertId(workspaceId),
+ folderId: r.parentId === workspaceId ? null : convertId(r.parentId),
+ model: 'http_request',
+ sortPriority: r.metaSortKey,
+ name: r.name,
+ description: r.description || undefined,
+ url: convertSyntax(r.url),
+ body,
+ bodyType,
+ authentication,
+ authenticationType,
+ method: r.method,
+ headers: (r.headers ?? [])
+ .map((h: any) => ({
+ enabled: !h.disabled,
+ name: h.name ?? '',
+ value: h.value ?? '',
+ }))
+ .filter(({ name, value }: any) => name !== '' || value !== ''),
+ };
+}
+
+function importGrpcRequest(
+ r: any,
+ workspaceId: string,
+): PartialImportResources['grpcRequests'][0] {
+ const parts = r.protoMethodName.split('/').filter((p: any) => p !== '');
+ const service = parts[0] ?? null;
+ const method = parts[1] ?? null;
+
+ return {
+ id: convertId(r.meta?.id ?? r._id),
+ createdAt: r.created ? new Date(r.created).toISOString().replace('Z', '') : undefined,
+ updatedAt: r.modified ? new Date(r.modified).toISOString().replace('Z', '') : undefined,
+ workspaceId: convertId(workspaceId),
+ folderId: r.parentId === workspaceId ? null : convertId(r.parentId),
+ model: 'grpc_request',
+ sortPriority: r.metaSortKey,
+ name: r.name,
+ description: r.description || undefined,
+ url: convertSyntax(r.url),
+ service,
+ method,
+ message: r.body?.text ?? '',
+ metadata: (r.metadata ?? [])
+ .map((h: any) => ({
+ enabled: !h.disabled,
+ name: h.name ?? '',
+ value: h.value ?? '',
+ }))
+ .filter(({ name, value }: any) => name !== '' || value !== ''),
+ };
+}
+
+function importFolder(f: any, workspaceId: string): PartialImportResources['folders'][0] {
+ return {
+ id: convertId(f._id),
+ createdAt: f.created ? new Date(f.created).toISOString().replace('Z', '') : undefined,
+ updatedAt: f.modified ? new Date(f.modified).toISOString().replace('Z', '') : undefined,
+ folderId: f.parentId === workspaceId ? null : convertId(f.parentId),
+ workspaceId: convertId(workspaceId),
+ description: f.description || undefined,
+ model: 'folder',
+ name: f.name,
+ };
+}
+
+function importEnvironment(e: any, workspaceId: string, isParent?: boolean): PartialImportResources['environments'][0] {
+ return {
+ id: convertId(e._id),
+ createdAt: e.created ? new Date(e.created).toISOString().replace('Z', '') : undefined,
+ updatedAt: e.modified ? new Date(e.modified).toISOString().replace('Z', '') : undefined,
+ workspaceId: convertId(workspaceId),
+ // @ts-ignore
+ sortPriority: e.metaSortKey, // Will be added to Yaak later
+ base: isParent ?? e.parentId === workspaceId,
+ model: 'environment',
+ name: e.name,
+ variables: Object.entries(e.data).map(([name, value]) => ({
+ enabled: true,
+ name,
+ value: `${value}`,
+ })),
+ };
+}
diff --git a/plugins/importer-insomnia/src/v5.ts b/plugins/importer-insomnia/src/v5.ts
new file mode 100644
index 00000000..523d5abe
--- /dev/null
+++ b/plugins/importer-insomnia/src/v5.ts
@@ -0,0 +1,265 @@
+import { PartialImportResources } from '@yaakapp/api';
+import { convertId, convertSyntax, isJSObject } from './common';
+
+export function convertInsomniaV5(parsed: Record) {
+ if (!Array.isArray(parsed.collection)) return null;
+
+ const resources: PartialImportResources = {
+ environments: [],
+ folders: [],
+ grpcRequests: [],
+ httpRequests: [],
+ websocketRequests: [],
+ workspaces: [],
+ };
+
+ // Import workspaces
+ const meta: Record = parsed.meta ?? {};
+ resources.workspaces.push({
+ id: convertId(meta.id ?? 'collection'),
+ createdAt: meta.created ? new Date(meta.created).toISOString().replace('Z', '') : undefined,
+ updatedAt: meta.modified ? new Date(meta.modified).toISOString().replace('Z', '') : undefined,
+ model: 'workspace',
+ name: parsed.name,
+ description: meta.description || undefined,
+ });
+ resources.environments.push(
+ importEnvironment(parsed.environments, meta.id, true),
+ ...(parsed.environments.subEnvironments ?? []).map((r: any) => importEnvironment(r, meta.id)),
+ );
+
+ const nextFolder = (children: any[], parentId: string) => {
+ for (const child of children ?? []) {
+ if (!isJSObject(child)) continue;
+
+ if (Array.isArray(child.children)) {
+ resources.folders.push(importFolder(child, meta.id, parentId));
+ nextFolder(child.children, child.meta.id);
+ } else if (child.method) {
+ resources.httpRequests.push(
+ importHttpRequest(child, meta.id, parentId),
+ );
+ } else if (child.protoFileId) {
+ resources.grpcRequests.push(
+ importGrpcRequest(child, meta.id, parentId),
+ );
+ } else if (child.url) {
+ resources.websocketRequests.push(
+ importWebsocketRequest(child, meta.id, parentId),
+ );
+ }
+ }
+ };
+
+ // Import folders
+ nextFolder(parsed.collection ?? [], meta.id);
+
+ // Filter out any `null` values
+ resources.httpRequests = resources.httpRequests.filter(Boolean);
+ resources.grpcRequests = resources.grpcRequests.filter(Boolean);
+ resources.environments = resources.environments.filter(Boolean);
+ resources.workspaces = resources.workspaces.filter(Boolean);
+
+ return { resources };
+}
+
+function importHttpRequest(
+ r: any,
+ workspaceId: string,
+ parentId: string,
+): PartialImportResources['httpRequests'][0] {
+ const id = r.meta?.id ?? r._id;
+ const created = r.meta?.created ?? r.created;
+ const updated = r.meta?.modified ?? r.updated;
+ const sortKey = r.meta?.sortKey ?? r.sortKey;
+
+ let bodyType: string | null = null;
+ let body = {};
+ if (r.body?.mimeType === 'application/octet-stream') {
+ bodyType = 'binary';
+ body = { filePath: r.body.fileName ?? '' };
+ } else if (r.body?.mimeType === 'application/x-www-form-urlencoded') {
+ bodyType = 'application/x-www-form-urlencoded';
+ body = {
+ form: (r.body.params ?? []).map((p: any) => ({
+ enabled: !p.disabled,
+ name: p.name ?? '',
+ value: p.value ?? '',
+ })),
+ };
+ } else if (r.body?.mimeType === 'multipart/form-data') {
+ bodyType = 'multipart/form-data';
+ body = {
+ form: (r.body.params ?? []).map((p: any) => ({
+ enabled: !p.disabled,
+ name: p.name ?? '',
+ value: p.value ?? '',
+ file: p.fileName ?? null,
+ })),
+ };
+ } else if (r.body?.mimeType === 'application/graphql') {
+ bodyType = 'graphql';
+ body = { text: convertSyntax(r.body.text ?? '') };
+ } else if (r.body?.mimeType === 'application/json') {
+ bodyType = 'application/json';
+ body = { text: convertSyntax(r.body.text ?? '') };
+ }
+
+ return {
+ id: convertId(id),
+ workspaceId: convertId(workspaceId),
+ createdAt: created ? new Date(created).toISOString().replace('Z', '') : undefined,
+ updatedAt: updated ? new Date(updated).toISOString().replace('Z', '') : undefined,
+ folderId: parentId === workspaceId ? null : convertId(parentId),
+ sortPriority: sortKey,
+ model: 'http_request',
+ name: r.name,
+ description: r.meta?.description || undefined,
+ url: convertSyntax(r.url),
+ body,
+ bodyType,
+ method: r.method,
+ ...importHeaders(r),
+ ...importAuthentication(r),
+ };
+}
+
+function importGrpcRequest(
+ r: any,
+ workspaceId: string,
+ parentId: string,
+): PartialImportResources['grpcRequests'][0] {
+ const id = r.meta?.id ?? r._id;
+ const created = r.meta?.created ?? r.created;
+ const updated = r.meta?.modified ?? r.updated;
+ const sortKey = r.meta?.sortKey ?? r.sortKey;
+
+ const parts = r.protoMethodName.split('/').filter((p: any) => p !== '');
+ const service = parts[0] ?? null;
+ const method = parts[1] ?? null;
+
+ return {
+ model: 'grpc_request',
+ id: convertId(id),
+ workspaceId: convertId(workspaceId),
+ createdAt: created ? new Date(created).toISOString().replace('Z', '') : undefined,
+ updatedAt: updated ? new Date(updated).toISOString().replace('Z', '') : undefined,
+ folderId: parentId === workspaceId ? null : convertId(parentId),
+ sortPriority: sortKey,
+ name: r.name,
+ description: r.description || undefined,
+ url: convertSyntax(r.url),
+ service,
+ method,
+ message: r.body?.text ?? '',
+ metadata: (r.metadata ?? [])
+ .map((h: any) => ({
+ enabled: !h.disabled,
+ name: h.name ?? '',
+ value: h.value ?? '',
+ }))
+ .filter(({ name, value }: any) => name !== '' || value !== ''),
+ };
+}
+
+function importWebsocketRequest(
+ r: any,
+ workspaceId: string,
+ parentId: string,
+): PartialImportResources['websocketRequests'][0] {
+ const id = r.meta?.id ?? r._id;
+ const created = r.meta?.created ?? r.created;
+ const updated = r.meta?.modified ?? r.updated;
+ const sortKey = r.meta?.sortKey ?? r.sortKey;
+
+ return {
+ model: 'websocket_request',
+ id: convertId(id),
+ workspaceId: convertId(workspaceId),
+ createdAt: created ? new Date(created).toISOString().replace('Z', '') : undefined,
+ updatedAt: updated ? new Date(updated).toISOString().replace('Z', '') : undefined,
+ folderId: parentId === workspaceId ? null : convertId(parentId),
+ sortPriority: sortKey,
+ name: r.name,
+ description: r.description || undefined,
+ url: convertSyntax(r.url),
+ message: r.body?.text ?? '',
+ ...importHeaders(r),
+ ...importAuthentication(r),
+ };
+}
+
+function importHeaders(r: any) {
+ const headers = (r.headers ?? [])
+ .map((h: any) => ({
+ enabled: !h.disabled,
+ name: h.name ?? '',
+ value: h.value ?? '',
+ }))
+ .filter(({ name, value }: any) => name !== '' || value !== '');
+ return { headers } as const;
+}
+
+function importAuthentication(r: any) {
+ let authenticationType: string | null = null;
+ let authentication = {};
+ if (r.authentication?.type === 'bearer') {
+ authenticationType = 'bearer';
+ authentication = {
+ token: convertSyntax(r.authentication.token),
+ };
+ } else if (r.authentication?.type === 'basic') {
+ authenticationType = 'basic';
+ authentication = {
+ username: convertSyntax(r.authentication.username),
+ password: convertSyntax(r.authentication.password),
+ };
+ }
+
+ return { authenticationType, authentication } as const;
+}
+
+function importFolder(f: any, workspaceId: string, parentId: string): PartialImportResources['folders'][0] {
+ const id = f.meta?.id ?? f._id;
+ const created = f.meta?.created ?? f.created;
+ const updated = f.meta?.modified ?? f.updated;
+ const sortKey = f.meta?.sortKey ?? f.sortKey;
+
+ return {
+ model: 'folder',
+ id: convertId(id),
+ createdAt: created ? new Date(created).toISOString().replace('Z', '') : undefined,
+ updatedAt: updated ? new Date(updated).toISOString().replace('Z', '') : undefined,
+ folderId: parentId === workspaceId ? null : convertId(parentId),
+ sortPriority: sortKey,
+ workspaceId: convertId(workspaceId),
+ description: f.description || undefined,
+ name: f.name,
+ };
+}
+
+
+function importEnvironment(e: any, workspaceId: string, isParent?: boolean): PartialImportResources['environments'][0] {
+ const id = e.meta?.id ?? e._id;
+ const created = e.meta?.created ?? e.created;
+ const updated = e.meta?.modified ?? e.updated;
+ const sortKey = e.meta?.sortKey ?? e.sortKey;
+
+ return {
+ id: convertId(id),
+ createdAt: created ? new Date(created).toISOString().replace('Z', '') : undefined,
+ updatedAt: updated ? new Date(updated).toISOString().replace('Z', '') : undefined,
+ workspaceId: convertId(workspaceId),
+ public: !e.isPrivate,
+ // @ts-ignore
+ sortPriority: sortKey, // Will be added to Yaak later
+ base: isParent ?? e.parentId === workspaceId,
+ model: 'environment',
+ name: e.name,
+ variables: Object.entries(e.data ?? {}).map(([name, value]) => ({
+ enabled: true,
+ name,
+ value: `${value}`,
+ })),
+ };
+}
diff --git a/plugins/importer-insomnia/tests/fixtures/basic.input.json b/plugins/importer-insomnia/tests/fixtures/basic.input.json
new file mode 100644
index 00000000..cb0568e5
--- /dev/null
+++ b/plugins/importer-insomnia/tests/fixtures/basic.input.json
@@ -0,0 +1,187 @@
+{
+ "_type": "export",
+ "__export_format": 4,
+ "__export_date": "2025-01-13T15:19:18.330Z",
+ "__export_source": "insomnia.desktop.app:v10.3.0",
+ "resources": [
+ {
+ "_id": "req_84cd9ae4bd034dd8bb730e856a665cbb",
+ "parentId": "fld_859d1df78261463480b6a3a1419517e3",
+ "modified": 1736781473176,
+ "created": 1736781406672,
+ "url": "{{ _.BASE_URL }}/foo/:id",
+ "name": "New Request",
+ "description": "My description of the request",
+ "method": "GET",
+ "body": {
+ "mimeType": "multipart/form-data",
+ "params": [
+ {
+ "id": "pair_7c86036ae8ef499dbbc0b43d0800c5a3",
+ "name": "form",
+ "value": "data",
+ "description": "",
+ "disabled": false
+ }
+ ]
+ },
+ "parameters": [
+ {
+ "id": "pair_b22f6ff611cd4250a6e405ca7b713d09",
+ "name": "query",
+ "value": "qqq",
+ "description": "",
+ "disabled": false
+ }
+ ],
+ "headers": [
+ {
+ "name": "Content-Type",
+ "value": "multipart/form-data",
+ "id": "pair_4af845963bd14256b98716617971eecd"
+ },
+ {
+ "name": "User-Agent",
+ "value": "insomnia/10.3.0",
+ "id": "pair_535ffd00ce48462cb1b7258832ade65a"
+ },
+ {
+ "id": "pair_ab4b870278e943cba6babf5a73e213e3",
+ "name": "X-Header",
+ "value": "xxxx",
+ "description": "",
+ "disabled": false
+ }
+ ],
+ "authentication": {
+ "type": "basic",
+ "useISO88591": false,
+ "disabled": false,
+ "username": "user",
+ "password": "pass"
+ },
+ "metaSortKey": -1736781406672,
+ "isPrivate": false,
+ "pathParameters": [
+ {
+ "name": "id",
+ "value": "iii"
+ }
+ ],
+ "settingStoreCookies": true,
+ "settingSendCookies": true,
+ "settingDisableRenderRequestBody": false,
+ "settingEncodeUrl": true,
+ "settingRebuildPath": true,
+ "settingFollowRedirects": "global",
+ "_type": "request"
+ },
+ {
+ "_id": "fld_859d1df78261463480b6a3a1419517e3",
+ "parentId": "wrk_d4d92f7c0ee947b89159243506687019",
+ "modified": 1736781404718,
+ "created": 1736781404718,
+ "name": "Top Level",
+ "description": "",
+ "environment": {},
+ "environmentPropertyOrder": null,
+ "metaSortKey": -1736781404718,
+ "environmentType": "kv",
+ "_type": "request_group"
+ },
+ {
+ "_id": "wrk_d4d92f7c0ee947b89159243506687019",
+ "parentId": null,
+ "modified": 1736781343765,
+ "created": 1736781343765,
+ "name": "Dummy",
+ "description": "",
+ "scope": "collection",
+ "_type": "workspace"
+ },
+ {
+ "_id": "env_16c0dec5b77c414ae0e419b8f10c3701300c5900",
+ "parentId": "wrk_d4d92f7c0ee947b89159243506687019",
+ "modified": 1736781355209,
+ "created": 1736781343767,
+ "name": "Base Environment",
+ "data": {
+ "BASE_VAR": "hello"
+ },
+ "dataPropertyOrder": null,
+ "color": null,
+ "isPrivate": false,
+ "metaSortKey": 1736781343767,
+ "environmentType": "kv",
+ "kvPairData": [
+ {
+ "id": "envPair_61c1be66d42241b5a28306d2cd92d3e3",
+ "name": "BASE_VAR",
+ "value": "hello",
+ "type": "str",
+ "enabled": true
+ }
+ ],
+ "_type": "environment"
+ },
+ {
+ "_id": "jar_16c0dec5b77c414ae0e419b8f10c3701300c5900",
+ "parentId": "wrk_d4d92f7c0ee947b89159243506687019",
+ "modified": 1736781343768,
+ "created": 1736781343768,
+ "name": "Default Jar",
+ "cookies": [],
+ "_type": "cookie_jar"
+ },
+ {
+ "_id": "env_799ae3d723ef44af91b4817e5d057e6d",
+ "parentId": "env_16c0dec5b77c414ae0e419b8f10c3701300c5900",
+ "modified": 1736781394705,
+ "created": 1736781358515,
+ "name": "Production",
+ "data": {
+ "BASE_URL": "https://api.yaak.app"
+ },
+ "dataPropertyOrder": null,
+ "color": "#f22c2c",
+ "isPrivate": false,
+ "metaSortKey": 1736781358515,
+ "environmentType": "kv",
+ "kvPairData": [
+ {
+ "id": "envPair_4d97b569b7e845ccbf488e1b26637cbc",
+ "name": "BASE_URL",
+ "value": "https://api.yaak.app",
+ "type": "str",
+ "enabled": true
+ }
+ ],
+ "_type": "environment"
+ },
+ {
+ "_id": "env_030fbfdbb274426ebd78e2e6518f8553",
+ "parentId": "env_16c0dec5b77c414ae0e419b8f10c3701300c5900",
+ "modified": 1736781391078,
+ "created": 1736781374707,
+ "name": "Staging",
+ "data": {
+ "BASE_URL": "https://api.staging.yaak.app"
+ },
+ "dataPropertyOrder": null,
+ "color": "#206fac",
+ "isPrivate": false,
+ "metaSortKey": 1736781358565,
+ "environmentType": "kv",
+ "kvPairData": [
+ {
+ "id": "envPair_4d97b569b7e845ccbf488e1b26637cbc",
+ "name": "BASE_URL",
+ "value": "https://api.staging.yaak.app",
+ "type": "str",
+ "enabled": true
+ }
+ ],
+ "_type": "environment"
+ }
+ ]
+}
diff --git a/plugins/importer-insomnia/tests/fixtures/basic.output.json b/plugins/importer-insomnia/tests/fixtures/basic.output.json
new file mode 100644
index 00000000..235a227d
--- /dev/null
+++ b/plugins/importer-insomnia/tests/fixtures/basic.output.json
@@ -0,0 +1,126 @@
+{
+ "resources": {
+ "environments": [
+ {
+ "createdAt": "2025-01-13T15:15:43.767",
+ "updatedAt": "2025-01-13T15:15:55.209",
+ "sortPriority": 1736781343767,
+ "base": true,
+ "id": "GENERATE_ID::env_16c0dec5b77c414ae0e419b8f10c3701300c5900",
+ "model": "environment",
+ "name": "Base Environment",
+ "variables": [
+ {
+ "enabled": true,
+ "name": "BASE_VAR",
+ "value": "hello"
+ }
+ ],
+ "workspaceId": "GENERATE_ID::wrk_d4d92f7c0ee947b89159243506687019"
+ },
+ {
+ "createdAt": "2025-01-13T15:15:58.515",
+ "updatedAt": "2025-01-13T15:16:34.705",
+ "sortPriority": 1736781358515,
+ "base": false,
+ "id": "GENERATE_ID::env_799ae3d723ef44af91b4817e5d057e6d",
+ "model": "environment",
+ "name": "Production",
+ "variables": [
+ {
+ "enabled": true,
+ "name": "BASE_URL",
+ "value": "https://api.yaak.app"
+ }
+ ],
+ "workspaceId": "GENERATE_ID::wrk_d4d92f7c0ee947b89159243506687019"
+ },
+ {
+ "createdAt": "2025-01-13T15:16:14.707",
+ "updatedAt": "2025-01-13T15:16:31.078",
+ "sortPriority": 1736781358565,
+ "base": false,
+ "id": "GENERATE_ID::env_030fbfdbb274426ebd78e2e6518f8553",
+ "model": "environment",
+ "name": "Staging",
+ "variables": [
+ {
+ "enabled": true,
+ "name": "BASE_URL",
+ "value": "https://api.staging.yaak.app"
+ }
+ ],
+ "workspaceId": "GENERATE_ID::wrk_d4d92f7c0ee947b89159243506687019"
+ }
+ ],
+ "folders": [
+ {
+ "createdAt": "2025-01-13T15:16:44.718",
+ "updatedAt": "2025-01-13T15:16:44.718",
+ "folderId": null,
+ "id": "GENERATE_ID::fld_859d1df78261463480b6a3a1419517e3",
+ "model": "folder",
+ "name": "Top Level",
+ "workspaceId": "GENERATE_ID::wrk_d4d92f7c0ee947b89159243506687019"
+ }
+ ],
+ "grpcRequests": [],
+ "httpRequests": [
+ {
+ "authentication": {
+ "password": "pass",
+ "username": "user"
+ },
+ "authenticationType": "basic",
+ "body": {
+ "form": [
+ {
+ "enabled": true,
+ "file": null,
+ "name": "form",
+ "value": "data"
+ }
+ ]
+ },
+ "bodyType": "multipart/form-data",
+ "createdAt": "2025-01-13T15:16:46.672",
+ "sortPriority": -1736781406672,
+ "updatedAt": "2025-01-13T15:17:53.176",
+ "description": "My description of the request",
+ "folderId": "GENERATE_ID::fld_859d1df78261463480b6a3a1419517e3",
+ "headers": [
+ {
+ "enabled": true,
+ "name": "Content-Type",
+ "value": "multipart/form-data"
+ },
+ {
+ "enabled": true,
+ "name": "User-Agent",
+ "value": "insomnia/10.3.0"
+ },
+ {
+ "enabled": true,
+ "name": "X-Header",
+ "value": "xxxx"
+ }
+ ],
+ "id": "GENERATE_ID::req_84cd9ae4bd034dd8bb730e856a665cbb",
+ "method": "GET",
+ "model": "http_request",
+ "name": "New Request",
+ "url": "${[BASE_URL ]}/foo/:id",
+ "workspaceId": "GENERATE_ID::wrk_d4d92f7c0ee947b89159243506687019"
+ }
+ ],
+ "websocketRequests": [],
+ "workspaces": [
+ {
+ "createdAt": "2025-01-13T15:15:43.765",
+ "id": "GENERATE_ID::wrk_d4d92f7c0ee947b89159243506687019",
+ "model": "workspace",
+ "name": "Dummy"
+ }
+ ]
+ }
+}
diff --git a/plugins/importer-insomnia/tests/fixtures/version-5-minimal.input.yaml b/plugins/importer-insomnia/tests/fixtures/version-5-minimal.input.yaml
new file mode 100644
index 00000000..ff7a005b
--- /dev/null
+++ b/plugins/importer-insomnia/tests/fixtures/version-5-minimal.input.yaml
@@ -0,0 +1,72 @@
+type: collection.insomnia.rest/5.0
+name: Debugging
+meta:
+ id: wrk_9717dd1c9e0c4b2e9ed6d2abcf3bd45c
+ created: 1747197924902
+ modified: 1747197924902
+collection:
+ - name: My Folder
+ meta:
+ id: fld_296933ea4ea84783a775d199997e9be7
+ created: 1747414092298
+ modified: 1747414142427
+ sortKey: -1747414092298
+ children:
+ - url: https://httpbin.org/post
+ name: New Request
+ meta:
+ id: req_9a80320365ac4509ade406359dbc6a71
+ created: 1747197928502
+ modified: 1747414129313
+ isPrivate: false
+ sortKey: -1747414129276
+ method: GET
+ headers:
+ - name: User-Agent
+ value: insomnia/11.1.0
+ id: pair_6ae87d1620a9494f8e5b29cd9f92d087
+ settings:
+ renderRequestBody: true
+ encodeUrl: true
+ followRedirects: global
+ cookies:
+ send: true
+ store: true
+ rebuildPath: true
+ headers:
+ - id: pair_f2b330e3914f4c11b209318aef94325c
+ name: foo
+ value: bar
+ disabled: false
+ - name: New Request
+ meta:
+ id: req_e3f8cdbd58784a539dd4c1e127d73451
+ created: 1747414160497
+ modified: 1747414160497
+ isPrivate: false
+ sortKey: -1747414160498
+ method: GET
+ headers:
+ - name: User-Agent
+ value: insomnia/11.1.0
+ settings:
+ renderRequestBody: true
+ encodeUrl: true
+ followRedirects: global
+ cookies:
+ send: true
+ store: true
+ rebuildPath: true
+cookieJar:
+ name: Default Jar
+ meta:
+ id: jar_e46dc73e8ccda30ca132153e8f11183bd08119ce
+ created: 1747197924904
+ modified: 1747197924904
+environments:
+ name: Base Environment
+ meta:
+ id: env_e46dc73e8ccda30ca132153e8f11183bd08119ce
+ created: 1747197924903
+ modified: 1747197924903
+ isPrivate: false
diff --git a/plugins/importer-insomnia/tests/fixtures/version-5-minimal.output.json b/plugins/importer-insomnia/tests/fixtures/version-5-minimal.output.json
new file mode 100644
index 00000000..b581956c
--- /dev/null
+++ b/plugins/importer-insomnia/tests/fixtures/version-5-minimal.output.json
@@ -0,0 +1,87 @@
+{
+ "resources": {
+ "environments": [
+ {
+ "base": true,
+ "createdAt": "2025-05-14T04:45:24.903",
+ "id": "GENERATE_ID::env_e46dc73e8ccda30ca132153e8f11183bd08119ce",
+ "model": "environment",
+ "name": "Base Environment",
+ "public": true,
+ "updatedAt": "2025-05-14T04:45:24.903",
+ "variables": [],
+ "workspaceId": "GENERATE_ID::wrk_9717dd1c9e0c4b2e9ed6d2abcf3bd45c"
+ }
+ ],
+ "folders": [
+ {
+ "createdAt": "2025-05-16T16:48:12.298",
+ "folderId": null,
+ "id": "GENERATE_ID::fld_296933ea4ea84783a775d199997e9be7",
+ "model": "folder",
+ "name": "My Folder",
+ "sortPriority": -1747414092298,
+ "updatedAt": "2025-05-16T16:49:02.427",
+ "workspaceId": "GENERATE_ID::wrk_9717dd1c9e0c4b2e9ed6d2abcf3bd45c"
+ }
+ ],
+ "grpcRequests": [],
+ "httpRequests": [
+ {
+ "authentication": {},
+ "authenticationType": null,
+ "body": {},
+ "bodyType": null,
+ "createdAt": "2025-05-14T04:45:28.502",
+ "folderId": "GENERATE_ID::fld_296933ea4ea84783a775d199997e9be7",
+ "headers": [
+ {
+ "enabled": true,
+ "name": "User-Agent",
+ "value": "insomnia/11.1.0"
+ }
+ ],
+ "id": "GENERATE_ID::req_9a80320365ac4509ade406359dbc6a71",
+ "method": "GET",
+ "model": "http_request",
+ "name": "New Request",
+ "sortPriority": -1747414129276,
+ "updatedAt": "2025-05-16T16:48:49.313",
+ "url": "https://httpbin.org/post",
+ "workspaceId": "GENERATE_ID::wrk_9717dd1c9e0c4b2e9ed6d2abcf3bd45c"
+ },
+ {
+ "authentication": {},
+ "authenticationType": null,
+ "body": {},
+ "bodyType": null,
+ "createdAt": "2025-05-16T16:49:20.497",
+ "folderId": null,
+ "headers": [
+ {
+ "enabled": true,
+ "name": "User-Agent",
+ "value": "insomnia/11.1.0"
+ }
+ ],
+ "id": "GENERATE_ID::req_e3f8cdbd58784a539dd4c1e127d73451",
+ "method": "GET",
+ "model": "http_request",
+ "name": "New Request",
+ "sortPriority": -1747414160498,
+ "updatedAt": "2025-05-16T16:49:20.497",
+ "workspaceId": "GENERATE_ID::wrk_9717dd1c9e0c4b2e9ed6d2abcf3bd45c"
+ }
+ ],
+ "websocketRequests": [],
+ "workspaces": [
+ {
+ "createdAt": "2025-05-14T04:45:24.902",
+ "id": "GENERATE_ID::wrk_9717dd1c9e0c4b2e9ed6d2abcf3bd45c",
+ "model": "workspace",
+ "name": "Debugging",
+ "updatedAt": "2025-05-14T04:45:24.902"
+ }
+ ]
+ }
+}
diff --git a/plugins/importer-insomnia/tests/fixtures/version-5.input.yaml b/plugins/importer-insomnia/tests/fixtures/version-5.input.yaml
new file mode 100644
index 00000000..6bbd81f4
--- /dev/null
+++ b/plugins/importer-insomnia/tests/fixtures/version-5.input.yaml
@@ -0,0 +1,142 @@
+type: collection.insomnia.rest/5.0
+name: Dummy
+meta:
+ id: wrk_c1eacfa750a04f3ea9985ef28043fa53
+ created: 1746799305927
+ modified: 1746843054272
+ description: This is the description
+collection:
+ - name: Top Level
+ meta:
+ id: fld_42eb2e2bb22b4cedacbd3d057634e80c
+ created: 1736781404718
+ modified: 1736781404718
+ sortKey: -1736781404718
+ children:
+ - url: "{{ _.BASE_URL }}/foo/:id"
+ name: New Request
+ meta:
+ id: req_d72fff2a6b104b91a2ebe9de9edd2785
+ created: 1736781406672
+ modified: 1736781473176
+ isPrivate: false
+ description: My description of the request
+ sortKey: -1736781406672
+ method: GET
+ body:
+ mimeType: multipart/form-data
+ params:
+ - id: pair_7c86036ae8ef499dbbc0b43d0800c5a3
+ name: form
+ value: data
+ disabled: false
+ parameters:
+ - id: pair_b22f6ff611cd4250a6e405ca7b713d09
+ name: query
+ value: qqq
+ disabled: false
+ headers:
+ - name: Content-Type
+ value: multipart/form-data
+ id: pair_4af845963bd14256b98716617971eecd
+ - name: User-Agent
+ value: insomnia/10.3.0
+ id: pair_535ffd00ce48462cb1b7258832ade65a
+ - id: pair_ab4b870278e943cba6babf5a73e213e3
+ name: X-Header
+ value: xxxx
+ disabled: false
+ authentication:
+ type: basic
+ useISO88591: false
+ disabled: false
+ username: user
+ password: pass
+ settings:
+ renderRequestBody: true
+ encodeUrl: true
+ followRedirects: global
+ cookies:
+ send: true
+ store: true
+ rebuildPath: true
+ pathParameters:
+ - name: id
+ value: iii
+ - url: grpcb.in:9000
+ name: New Request
+ meta:
+ id: greq_06d659324df94504a4d64632be7106b3
+ created: 1746799344864
+ modified: 1746799544082
+ isPrivate: false
+ sortKey: -1746799344864
+ body:
+ text: |-
+ {
+ "greeting": "Greg"
+ }
+ protoFileId: pf_9d45b0dfaccc4bcc9d930746716786c5
+ protoMethodName: /hello.HelloService/SayHello
+ reflectionApi:
+ enabled: false
+ url: https://buf.build
+ module: buf.build/connectrpc/eliza
+ - url: wss://echo.websocket.org
+ name: New WebSocket Request
+ meta:
+ id: ws-req_5d1a4c7c79494743962e5176f6add270
+ created: 1746799553909
+ modified: 1746887120958
+ sortKey: -1746799553909
+ settings:
+ encodeUrl: true
+ followRedirects: global
+ cookies:
+ send: true
+ store: true
+ authentication:
+ type: basic
+ useISO88591: false
+ disabled: false
+ username: user
+ password: password
+ headers:
+ - name: User-Agent
+ value: insomnia/11.1.0
+cookieJar:
+ name: Default Jar
+ meta:
+ id: jar_663d5741b072441aa2709a6113371510
+ created: 1736781343768
+ modified: 1736781343768
+environments:
+ name: Base Environment
+ meta:
+ id: env_20945044d3c8497ca8b717bef750987e
+ created: 1736781343767
+ modified: 1736781355209
+ isPrivate: false
+ data:
+ BASE_VAR: hello
+ subEnvironments:
+ - name: Production
+ meta:
+ id: env_6f7728bb7fc04d558d668e954d756ea2
+ created: 1736781358515
+ modified: 1736781394705
+ isPrivate: false
+ sortKey: 1736781358515
+ data:
+ BASE_URL: https://api.yaak.app
+ color: "#f22c2c"
+ - name: Staging
+ meta:
+ id: env_976a8b6eb5d44fb6a20150f65c32d243
+ created: 1736781374707
+ modified: 1736781391078
+ isPrivate: false
+ sortKey: 1736781358565
+ data:
+ BASE_URL: https://api.staging.yaak.app
+ color: "#206fac"
diff --git a/plugins/importer-insomnia/tests/fixtures/version-5.output.json b/plugins/importer-insomnia/tests/fixtures/version-5.output.json
new file mode 100644
index 00000000..6b00c40a
--- /dev/null
+++ b/plugins/importer-insomnia/tests/fixtures/version-5.output.json
@@ -0,0 +1,172 @@
+{
+ "resources": {
+ "environments": [
+ {
+ "createdAt": "2025-01-13T15:15:43.767",
+ "updatedAt": "2025-01-13T15:15:55.209",
+ "base": true,
+ "public": true,
+ "id": "GENERATE_ID::env_20945044d3c8497ca8b717bef750987e",
+ "model": "environment",
+ "name": "Base Environment",
+ "variables": [
+ {
+ "enabled": true,
+ "name": "BASE_VAR",
+ "value": "hello"
+ }
+ ],
+ "workspaceId": "GENERATE_ID::wrk_c1eacfa750a04f3ea9985ef28043fa53"
+ },
+ {
+ "createdAt": "2025-01-13T15:15:58.515",
+ "updatedAt": "2025-01-13T15:16:34.705",
+ "base": false,
+ "public": true,
+ "id": "GENERATE_ID::env_6f7728bb7fc04d558d668e954d756ea2",
+ "model": "environment",
+ "name": "Production",
+ "sortPriority": 1736781358515,
+ "variables": [
+ {
+ "enabled": true,
+ "name": "BASE_URL",
+ "value": "https://api.yaak.app"
+ }
+ ],
+ "workspaceId": "GENERATE_ID::wrk_c1eacfa750a04f3ea9985ef28043fa53"
+ },
+ {
+ "createdAt": "2025-01-13T15:16:14.707",
+ "updatedAt": "2025-01-13T15:16:31.078",
+ "base": false,
+ "public": true,
+ "id": "GENERATE_ID::env_976a8b6eb5d44fb6a20150f65c32d243",
+ "model": "environment",
+ "name": "Staging",
+ "sortPriority": 1736781358565,
+ "variables": [
+ {
+ "enabled": true,
+ "name": "BASE_URL",
+ "value": "https://api.staging.yaak.app"
+ }
+ ],
+ "workspaceId": "GENERATE_ID::wrk_c1eacfa750a04f3ea9985ef28043fa53"
+ }
+ ],
+ "folders": [
+ {
+ "createdAt": "2025-01-13T15:16:44.718",
+ "updatedAt": "2025-01-13T15:16:44.718",
+ "folderId": null,
+ "id": "GENERATE_ID::fld_42eb2e2bb22b4cedacbd3d057634e80c",
+ "model": "folder",
+ "name": "Top Level",
+ "sortPriority": -1736781404718,
+ "workspaceId": "GENERATE_ID::wrk_c1eacfa750a04f3ea9985ef28043fa53"
+ }
+ ],
+ "grpcRequests": [
+ {
+ "model": "grpc_request",
+ "createdAt": "2025-05-09T14:02:24.864",
+ "folderId": null,
+ "id": "GENERATE_ID::greq_06d659324df94504a4d64632be7106b3",
+ "message": "{\n\t\"greeting\": \"Greg\"\n}",
+ "metadata": [],
+ "method": "SayHello",
+ "name": "New Request",
+ "service": "hello.HelloService",
+ "sortPriority": -1746799344864,
+ "updatedAt": "2025-05-09T14:05:44.082",
+ "url": "grpcb.in:9000",
+ "workspaceId": "GENERATE_ID::wrk_c1eacfa750a04f3ea9985ef28043fa53"
+ }
+ ],
+ "httpRequests": [
+ {
+ "authentication": {
+ "password": "pass",
+ "username": "user"
+ },
+ "authenticationType": "basic",
+ "body": {
+ "form": [
+ {
+ "enabled": true,
+ "file": null,
+ "name": "form",
+ "value": "data"
+ }
+ ]
+ },
+ "bodyType": "multipart/form-data",
+ "createdAt": "2025-01-13T15:16:46.672",
+ "updatedAt": "2025-01-13T15:17:53.176",
+ "description": "My description of the request",
+ "folderId": "GENERATE_ID::fld_42eb2e2bb22b4cedacbd3d057634e80c",
+ "headers": [
+ {
+ "enabled": true,
+ "name": "Content-Type",
+ "value": "multipart/form-data"
+ },
+ {
+ "enabled": true,
+ "name": "User-Agent",
+ "value": "insomnia/10.3.0"
+ },
+ {
+ "enabled": true,
+ "name": "X-Header",
+ "value": "xxxx"
+ }
+ ],
+ "id": "GENERATE_ID::req_d72fff2a6b104b91a2ebe9de9edd2785",
+ "method": "GET",
+ "model": "http_request",
+ "name": "New Request",
+ "sortPriority": -1736781406672,
+ "url": "${[BASE_URL ]}/foo/:id",
+ "workspaceId": "GENERATE_ID::wrk_c1eacfa750a04f3ea9985ef28043fa53"
+ }
+ ],
+ "websocketRequests": [
+ {
+ "id": "GENERATE_ID::ws-req_5d1a4c7c79494743962e5176f6add270",
+ "createdAt": "2025-05-09T14:05:53.909",
+ "updatedAt": "2025-05-10T14:25:20.958",
+ "message": "",
+ "model": "websocket_request",
+ "name": "New WebSocket Request",
+ "sortPriority": -1746799553909,
+ "authenticationType": "basic",
+ "authentication": {
+ "password": "password",
+ "username": "user"
+ },
+ "folderId": null,
+ "headers": [
+ {
+ "enabled": true,
+ "name": "User-Agent",
+ "value": "insomnia/11.1.0"
+ }
+ ],
+ "url": "wss://echo.websocket.org",
+ "workspaceId": "GENERATE_ID::wrk_c1eacfa750a04f3ea9985ef28043fa53"
+ }
+ ],
+ "workspaces": [
+ {
+ "createdAt": "2025-05-09T14:01:45.927",
+ "updatedAt": "2025-05-10T02:10:54.272",
+ "description": "This is the description",
+ "id": "GENERATE_ID::wrk_c1eacfa750a04f3ea9985ef28043fa53",
+ "model": "workspace",
+ "name": "Dummy"
+ }
+ ]
+ }
+}
diff --git a/plugins/importer-insomnia/tests/index.test.ts b/plugins/importer-insomnia/tests/index.test.ts
new file mode 100644
index 00000000..da561926
--- /dev/null
+++ b/plugins/importer-insomnia/tests/index.test.ts
@@ -0,0 +1,32 @@
+import * as fs from 'node:fs';
+import * as path from 'node:path';
+import { describe, expect, test } from 'vitest';
+import YAML from 'yaml';
+import { convertInsomnia } from '../src';
+
+describe('importer-yaak', () => {
+ const p = path.join(__dirname, 'fixtures');
+ const fixtures = fs.readdirSync(p);
+
+ for (const fixture of fixtures) {
+ if (fixture.includes('.output')) {
+ continue;
+ }
+
+ test('Imports ' + fixture, () => {
+ const contents = fs.readFileSync(path.join(p, fixture), 'utf-8');
+ const expected = fs.readFileSync(path.join(p, fixture.replace(/.input\..*/, '.output.json')), 'utf-8');
+ const result = convertInsomnia(contents);
+ // console.log(JSON.stringify(result, null, 2))
+ expect(result).toEqual(parseJsonOrYaml(expected));
+ });
+ }
+});
+
+function parseJsonOrYaml(text: string): unknown {
+ try {
+ return JSON.parse(text);
+ } catch {
+ return YAML.parse(text);
+ }
+}
diff --git a/src-tauri/vendored/plugins/importer-openapi/package.json b/plugins/importer-openapi/package.json
similarity index 100%
rename from src-tauri/vendored/plugins/importer-openapi/package.json
rename to plugins/importer-openapi/package.json
diff --git a/plugins/importer-openapi/src/index.ts b/plugins/importer-openapi/src/index.ts
new file mode 100644
index 00000000..2080dda4
--- /dev/null
+++ b/plugins/importer-openapi/src/index.ts
@@ -0,0 +1,44 @@
+import { Context, Environment, Folder, HttpRequest, PluginDefinition, Workspace } from '@yaakapp/api';
+import { convert } from 'openapi-to-postmanv2';
+import { convertPostman } from '@yaakapp/importer-postman/src';
+
+type AtLeast = Partial & Pick;
+
+interface ExportResources {
+ workspaces: AtLeast[];
+ environments: AtLeast[];
+ httpRequests: AtLeast[];
+ folders: AtLeast[];
+}
+
+export const plugin: PluginDefinition = {
+ importer: {
+ name: 'OpenAPI',
+ description: 'Import OpenAPI collections',
+ onImport(_ctx: Context, args: { text: string }) {
+ return convertOpenApi(args.text) as any;
+ },
+ },
+};
+
+export async function convertOpenApi(
+ contents: string,
+): Promise<{ resources: ExportResources } | undefined> {
+ let postmanCollection;
+ try {
+ postmanCollection = await new Promise((resolve, reject) => {
+ convert({ type: 'string', data: contents }, {}, (err, result: any) => {
+ if (err != null) reject(err);
+
+ if (Array.isArray(result.output) && result.output.length > 0) {
+ resolve(result.output[0].data);
+ }
+ });
+ });
+ } catch (err) {
+ // Probably not an OpenAPI file, so skip it
+ return undefined;
+ }
+
+ return convertPostman(JSON.stringify(postmanCollection));
+}
diff --git a/plugins/importer-openapi/tests/fixtures/petstore.yaml b/plugins/importer-openapi/tests/fixtures/petstore.yaml
new file mode 100644
index 00000000..f5271a59
--- /dev/null
+++ b/plugins/importer-openapi/tests/fixtures/petstore.yaml
@@ -0,0 +1,819 @@
+openapi: 3.0.2
+servers:
+ - url: /v3
+info:
+ description: |-
+ This is a sample Pet Store Server based on the OpenAPI 3.0 specification. You can find out more about
+ Swagger at [http://swagger.io](http://swagger.io). In the third iteration of the pet store, we've switched to the design first approach!
+ You can now help us improve the API whether it's by making changes to the definition itself or to the code.
+ That way, with time, we can improve the API in general, and expose some of the new features in OAS3.
+
+ Some useful links:
+ - [The Pet Store repository](https://github.com/swagger-api/swagger-petstore)
+ - [The source API definition for the Pet Store](https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml)
+ version: 1.0.20-SNAPSHOT
+ title: Swagger Petstore - OpenAPI 3.0
+ termsOfService: 'http://swagger.io/terms/'
+ contact:
+ email: apiteam@swagger.io
+ license:
+ name: Apache 2.0
+ url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
+tags:
+ - name: pet
+ description: Everything about your Pets
+ externalDocs:
+ description: Find out more
+ url: 'http://swagger.io'
+ - name: store
+ description: Access to Petstore orders
+ externalDocs:
+ description: Find out more about our store
+ url: 'http://swagger.io'
+ - name: user
+ description: Operations about user
+paths:
+ /pet:
+ post:
+ tags:
+ - pet
+ summary: Add a new pet to the store
+ description: Add a new pet to the store
+ operationId: addPet
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ '405':
+ description: Invalid input
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ requestBody:
+ description: Create a new pet in the store
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/x-www-form-urlencoded:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ put:
+ tags:
+ - pet
+ summary: Update an existing pet
+ description: Update an existing pet by Id
+ operationId: updatePet
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ '405':
+ description: Validation exception
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ requestBody:
+ description: Update an existent pet in the store
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/x-www-form-urlencoded:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ /pet/findByStatus:
+ get:
+ tags:
+ - pet
+ summary: Finds Pets by status
+ description: Multiple status values can be provided with comma separated strings
+ operationId: findPetsByStatus
+ parameters:
+ - name: status
+ in: query
+ description: Status values that need to be considered for filter
+ required: false
+ explode: true
+ schema:
+ type: string
+ enum:
+ - available
+ - pending
+ - sold
+ default: available
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ '400':
+ description: Invalid status value
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ /pet/findByTags:
+ get:
+ tags:
+ - pet
+ summary: Finds Pets by tags
+ description: >-
+ Multiple tags can be provided with comma separated strings. Use tag1,
+ tag2, tag3 for testing.
+ operationId: findPetsByTags
+ parameters:
+ - name: tags
+ in: query
+ description: Tags to filter by
+ required: false
+ explode: true
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ '400':
+ description: Invalid tag value
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ '/pet/{petId}':
+ get:
+ tags:
+ - pet
+ summary: Find pet by ID
+ description: Returns a single pet
+ operationId: getPetById
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet to return
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ security:
+ - api_key: []
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ post:
+ tags:
+ - pet
+ summary: Updates a pet in the store with form data
+ description: ''
+ operationId: updatePetWithForm
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet that needs to be updated
+ required: true
+ schema:
+ type: integer
+ format: int64
+ - name: name
+ in: query
+ description: Name of pet that needs to be updated
+ schema:
+ type: string
+ - name: status
+ in: query
+ description: Status of pet that needs to be updated
+ schema:
+ type: string
+ responses:
+ '405':
+ description: Invalid input
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ delete:
+ tags:
+ - pet
+ summary: Deletes a pet
+ description: ''
+ operationId: deletePet
+ parameters:
+ - name: api_key
+ in: header
+ description: ''
+ required: false
+ schema:
+ type: string
+ - name: petId
+ in: path
+ description: Pet id to delete
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '400':
+ description: Invalid pet value
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ '/pet/{petId}/uploadImage':
+ post:
+ tags:
+ - pet
+ summary: uploads an image
+ description: ''
+ operationId: uploadFile
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet to update
+ required: true
+ schema:
+ type: integer
+ format: int64
+ - name: additionalMetadata
+ in: query
+ description: Additional Metadata
+ required: false
+ schema:
+ type: string
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ requestBody:
+ content:
+ application/octet-stream:
+ schema:
+ type: string
+ format: binary
+ /store/inventory:
+ get:
+ tags:
+ - store
+ summary: Returns pet inventories by status
+ description: Returns a map of status codes to quantities
+ operationId: getInventory
+ x-swagger-router-controller: OrderController
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/json:
+ schema:
+ type: object
+ additionalProperties:
+ type: integer
+ format: int32
+ security:
+ - api_key: []
+ /store/order:
+ post:
+ tags:
+ - store
+ summary: Place an order for a pet
+ description: Place a new order in the store
+ operationId: placeOrder
+ x-swagger-router-controller: OrderController
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Order'
+ '405':
+ description: Invalid input
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Order'
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Order'
+ application/x-www-form-urlencoded:
+ schema:
+ $ref: '#/components/schemas/Order'
+ '/store/order/{orderId}':
+ get:
+ tags:
+ - store
+ summary: Find purchase order by ID
+ x-swagger-router-controller: OrderController
+ description: >-
+ For valid response try integer IDs with value <= 5 or > 10. Other values
+ will generate exceptions.
+ operationId: getOrderById
+ parameters:
+ - name: orderId
+ in: path
+ description: ID of order that needs to be fetched
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Order'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Order'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Order not found
+ delete:
+ tags:
+ - store
+ summary: Delete purchase order by ID
+ x-swagger-router-controller: OrderController
+ description: >-
+ For valid response try integer IDs with value < 1000. Anything above
+ 1000 or nonintegers will generate API errors
+ operationId: deleteOrder
+ parameters:
+ - name: orderId
+ in: path
+ description: ID of the order that needs to be deleted
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Order not found
+ /user:
+ post:
+ tags:
+ - user
+ summary: Create user
+ description: This can only be done by the logged in user.
+ operationId: createUser
+ responses:
+ default:
+ description: successful operation
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/User'
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/User'
+ application/x-www-form-urlencoded:
+ schema:
+ $ref: '#/components/schemas/User'
+ description: Created user object
+ /user/createWithList:
+ post:
+ tags:
+ - user
+ summary: Creates list of users with given input array
+ description: 'Creates list of users with given input array'
+ x-swagger-router-controller: UserController
+ operationId: createUsersWithListInput
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/User'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ default:
+ description: successful operation
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/User'
+ /user/login:
+ get:
+ tags:
+ - user
+ summary: Logs user into the system
+ description: ''
+ operationId: loginUser
+ parameters:
+ - name: username
+ in: query
+ description: The user name for login
+ required: false
+ schema:
+ type: string
+ - name: password
+ in: query
+ description: The password for login in clear text
+ required: false
+ schema:
+ type: string
+ responses:
+ '200':
+ description: successful operation
+ headers:
+ X-Rate-Limit:
+ description: calls per hour allowed by the user
+ schema:
+ type: integer
+ format: int32
+ X-Expires-After:
+ description: date in UTC when token expires
+ schema:
+ type: string
+ format: date-time
+ content:
+ application/xml:
+ schema:
+ type: string
+ application/json:
+ schema:
+ type: string
+ '400':
+ description: Invalid username/password supplied
+ /user/logout:
+ get:
+ tags:
+ - user
+ summary: Logs out current logged in user session
+ description: ''
+ operationId: logoutUser
+ parameters: []
+ responses:
+ default:
+ description: successful operation
+ '/user/{username}':
+ get:
+ tags:
+ - user
+ summary: Get user by user name
+ description: ''
+ operationId: getUserByName
+ parameters:
+ - name: username
+ in: path
+ description: 'The name that needs to be fetched. Use user1 for testing. '
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/User'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ '400':
+ description: Invalid username supplied
+ '404':
+ description: User not found
+ put:
+ tags:
+ - user
+ summary: Update user
+ x-swagger-router-controller: UserController
+ description: This can only be done by the logged in user.
+ operationId: updateUser
+ parameters:
+ - name: username
+ in: path
+ description: name that needs to be updated
+ required: true
+ schema:
+ type: string
+ responses:
+ default:
+ description: successful operation
+ requestBody:
+ description: Update an existent user in the store
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/User'
+ application/x-www-form-urlencoded:
+ schema:
+ $ref: '#/components/schemas/User'
+ delete:
+ tags:
+ - user
+ summary: Delete user
+ description: This can only be done by the logged in user.
+ operationId: deleteUser
+ parameters:
+ - name: username
+ in: path
+ description: The name that needs to be deleted
+ required: true
+ schema:
+ type: string
+ responses:
+ '400':
+ description: Invalid username supplied
+ '404':
+ description: User not found
+externalDocs:
+ description: Find out more about Swagger
+ url: 'http://swagger.io'
+components:
+ schemas:
+ Order:
+ x-swagger-router-model: io.swagger.petstore.model.Order
+ properties:
+ id:
+ type: integer
+ format: int64
+ example: 10
+ petId:
+ type: integer
+ format: int64
+ example: 198772
+ quantity:
+ type: integer
+ format: int32
+ example: 7
+ shipDate:
+ type: string
+ format: date-time
+ status:
+ type: string
+ description: Order Status
+ enum:
+ - placed
+ - approved
+ - delivered
+ example: approved
+ complete:
+ type: boolean
+ xml:
+ name: order
+ type: object
+ Customer:
+ properties:
+ id:
+ type: integer
+ format: int64
+ example: 100000
+ username:
+ type: string
+ example: fehguy
+ address:
+ type: array
+ items:
+ $ref: '#/components/schemas/Address'
+ xml:
+ wrapped: true
+ name: addresses
+ xml:
+ name: customer
+ type: object
+ Address:
+ properties:
+ street:
+ type: string
+ example: 437 Lytton
+ city:
+ type: string
+ example: Palo Alto
+ state:
+ type: string
+ example: CA
+ zip:
+ type: string
+ example: 94301
+ xml:
+ name: address
+ type: object
+ Category:
+ x-swagger-router-model: io.swagger.petstore.model.Category
+ properties:
+ id:
+ type: integer
+ format: int64
+ example: 1
+ name:
+ type: string
+ example: Dogs
+ xml:
+ name: category
+ type: object
+ User:
+ x-swagger-router-model: io.swagger.petstore.model.User
+ properties:
+ id:
+ type: integer
+ format: int64
+ example: 10
+ username:
+ type: string
+ example: theUser
+ firstName:
+ type: string
+ example: John
+ lastName:
+ type: string
+ example: James
+ email:
+ type: string
+ example: john@email.com
+ password:
+ type: string
+ example: 12345
+ phone:
+ type: string
+ example: 12345
+ userStatus:
+ type: integer
+ format: int32
+ example: 1
+ description: User Status
+ xml:
+ name: user
+ type: object
+ Tag:
+ x-swagger-router-model: io.swagger.petstore.model.Tag
+ properties:
+ id:
+ type: integer
+ format: int64
+ name:
+ type: string
+ xml:
+ name: tag
+ type: object
+ Pet:
+ x-swagger-router-model: io.swagger.petstore.model.Pet
+ required:
+ - name
+ - photoUrls
+ properties:
+ id:
+ type: integer
+ format: int64
+ example: 10
+ name:
+ type: string
+ example: doggie
+ category:
+ $ref: '#/components/schemas/Category'
+ photoUrls:
+ type: array
+ xml:
+ wrapped: true
+ items:
+ type: string
+ xml:
+ name: photoUrl
+ tags:
+ type: array
+ xml:
+ wrapped: true
+ items:
+ $ref: '#/components/schemas/Tag'
+ xml:
+ name: tag
+ status:
+ type: string
+ description: pet status in the store
+ enum:
+ - available
+ - pending
+ - sold
+ xml:
+ name: pet
+ type: object
+ ApiResponse:
+ properties:
+ code:
+ type: integer
+ format: int32
+ type:
+ type: string
+ message:
+ type: string
+ xml:
+ name: '##default'
+ type: object
+ requestBodies:
+ Pet:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ description: Pet object that needs to be added to the store
+ UserArray:
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/User'
+ description: List of user object
+ securitySchemes:
+ petstore_auth:
+ type: oauth2
+ flows:
+ implicit:
+ authorizationUrl: 'https://petstore.swagger.io/oauth/authorize'
+ scopes:
+ 'write:pets': modify pets in your account
+ 'read:pets': read your pets
+ api_key:
+ type: apiKey
+ name: api_key
+ in: header
diff --git a/plugins/importer-openapi/tests/index.test.ts b/plugins/importer-openapi/tests/index.test.ts
new file mode 100644
index 00000000..1e79c355
--- /dev/null
+++ b/plugins/importer-openapi/tests/index.test.ts
@@ -0,0 +1,29 @@
+import * as fs from 'node:fs';
+import * as path from 'node:path';
+import { describe, expect, test } from 'vitest';
+import { convertOpenApi } from '../src';
+
+describe('importer-openapi', () => {
+ const p = path.join(__dirname, 'fixtures');
+ const fixtures = fs.readdirSync(p);
+
+ test('Skips invalid file', async () => {
+ const imported = await convertOpenApi('{}');
+ expect(imported).toBeUndefined();
+ });
+
+ for (const fixture of fixtures) {
+ test('Imports ' + fixture, async () => {
+ const contents = fs.readFileSync(path.join(p, fixture), 'utf-8');
+ const imported = await convertOpenApi(contents);
+ expect(imported?.resources.workspaces).toEqual([
+ expect.objectContaining({
+ name: 'Swagger Petstore - OpenAPI 3.0',
+ description: expect.stringContaining('This is a sample Pet Store Server'),
+ }),
+ ]);
+ expect(imported?.resources.httpRequests.length).toBe(19);
+ expect(imported?.resources.folders.length).toBe(7);
+ });
+ }
+});
diff --git a/src-tauri/vendored/plugins/importer-postman/package.json b/plugins/importer-postman/package.json
similarity index 100%
rename from src-tauri/vendored/plugins/importer-postman/package.json
rename to plugins/importer-postman/package.json
diff --git a/plugins/importer-postman/src/index.ts b/plugins/importer-postman/src/index.ts
new file mode 100644
index 00000000..b73aee15
--- /dev/null
+++ b/plugins/importer-postman/src/index.ts
@@ -0,0 +1,370 @@
+import {
+ Context,
+ Environment,
+ Folder,
+ HttpRequest,
+ HttpRequestHeader,
+ HttpUrlParameter,
+ PluginDefinition,
+ Workspace,
+} from '@yaakapp/api';
+
+const POSTMAN_2_1_0_SCHEMA = 'https://schema.getpostman.com/json/collection/v2.1.0/collection.json';
+const POSTMAN_2_0_0_SCHEMA = 'https://schema.getpostman.com/json/collection/v2.0.0/collection.json';
+const VALID_SCHEMAS = [POSTMAN_2_0_0_SCHEMA, POSTMAN_2_1_0_SCHEMA];
+
+type AtLeast = Partial & Pick;
+
+interface ExportResources {
+ workspaces: AtLeast[];
+ environments: AtLeast[];
+ httpRequests: AtLeast[];
+ folders: AtLeast[];
+}
+
+export const plugin: PluginDefinition = {
+ importer: {
+ name: 'Postman',
+ description: 'Import postman collections',
+ onImport(_ctx: Context, args: { text: string }) {
+ return convertPostman(args.text) as any;
+ },
+ },
+};
+
+export function convertPostman(
+ contents: string,
+): { resources: ExportResources } | undefined {
+ const root = parseJSONToRecord(contents);
+ if (root == null) return;
+
+ const info = toRecord(root.info);
+ const isValidSchema = VALID_SCHEMAS.includes(info.schema);
+ if (!isValidSchema || !Array.isArray(root.item)) {
+ return;
+ }
+
+ const globalAuth = importAuth(root.auth);
+
+ const exportResources: ExportResources = {
+ workspaces: [],
+ environments: [],
+ httpRequests: [],
+ folders: [],
+ };
+
+ const workspace: ExportResources['workspaces'][0] = {
+ model: 'workspace',
+ id: generateId('workspace'),
+ name: info.name || 'Postman Import',
+ description: info.description?.content ?? info.description,
+ };
+ exportResources.workspaces.push(workspace);
+
+ // Create the base environment
+ const environment: ExportResources['environments'][0] = {
+ model: 'environment',
+ id: generateId('environment'),
+ name: 'Global Variables',
+ workspaceId: workspace.id,
+ variables:
+ root.variable?.map((v: any) => ({
+ name: v.key,
+ value: v.value,
+ })) ?? [],
+ };
+ exportResources.environments.push(environment);
+
+ const importItem = (v: Record, folderId: string | null = null) => {
+ if (typeof v.name === 'string' && Array.isArray(v.item)) {
+ const folder: ExportResources['folders'][0] = {
+ model: 'folder',
+ workspaceId: workspace.id,
+ id: generateId('folder'),
+ name: v.name,
+ folderId,
+ };
+ exportResources.folders.push(folder);
+ for (const child of v.item) {
+ importItem(child, folder.id);
+ }
+ } else if (typeof v.name === 'string' && 'request' in v) {
+ const r = toRecord(v.request);
+ const bodyPatch = importBody(r.body);
+ const requestAuthPath = importAuth(r.auth);
+ const authPatch = requestAuthPath.authenticationType == null ? globalAuth : requestAuthPath;
+
+ const headers: HttpRequestHeader[] = toArray(r.header).map((h) => {
+ return {
+ name: h.key,
+ value: h.value,
+ enabled: !h.disabled,
+ };
+ });
+
+ // Add body headers only if they don't already exist
+ for (const bodyPatchHeader of bodyPatch.headers) {
+ const existingHeader = headers.find(h => h.name.toLowerCase() === bodyPatchHeader.name.toLowerCase());
+ if (existingHeader) {
+ continue;
+ }
+ headers.push(bodyPatchHeader);
+ }
+
+ const { url, urlParameters } = convertUrl(r.url);
+
+ const request: ExportResources['httpRequests'][0] = {
+ model: 'http_request',
+ id: generateId('http_request'),
+ workspaceId: workspace.id,
+ folderId,
+ name: v.name,
+ description: v.description || undefined,
+ method: r.method || 'GET',
+ url,
+ urlParameters,
+ body: bodyPatch.body,
+ bodyType: bodyPatch.bodyType,
+ authentication: authPatch.authentication,
+ authenticationType: authPatch.authenticationType,
+ headers,
+ };
+ exportResources.httpRequests.push(request);
+ } else {
+ console.log('Unknown item', v, folderId);
+ }
+ };
+
+ for (const item of root.item) {
+ importItem(item);
+ }
+
+ const resources = deleteUndefinedAttrs(convertTemplateSyntax(exportResources));
+
+ return { resources };
+}
+
+function convertUrl(url: string | any): Pick {
+ if (typeof url === 'string') {
+ return { url, urlParameters: [] };
+ }
+
+ url = toRecord(url);
+
+ let v = '';
+
+ if ('protocol' in url && typeof url.protocol === 'string') {
+ v += `${url.protocol}://`;
+ }
+
+ if ('host' in url) {
+ v += `${Array.isArray(url.host) ? url.host.join('.') : url.host}`;
+ }
+
+ if ('port' in url && typeof url.port === 'string') {
+ v += `:${url.port}`;
+ }
+
+ if ('path' in url && Array.isArray(url.path) && url.path.length > 0) {
+ v += `/${Array.isArray(url.path) ? url.path.join('/') : url.path}`;
+ }
+
+ const params: HttpUrlParameter[] = [];
+ if ('query' in url && Array.isArray(url.query) && url.query.length > 0) {
+ for (const query of url.query) {
+ params.push({
+ name: query.key ?? '',
+ value: query.value ?? '',
+ enabled: !query.disabled,
+ });
+ }
+ }
+
+ if ('variable' in url && Array.isArray(url.variable) && url.variable.length > 0) {
+ for (const v of url.variable) {
+ params.push({
+ name: ':' + (v.key ?? ''),
+ value: v.value ?? '',
+ enabled: !v.disabled,
+ });
+ }
+ }
+
+ if ('hash' in url && typeof url.hash === 'string') {
+ v += `#${url.hash}`;
+ }
+
+ // TODO: Implement url.variables (path variables)
+
+ return { url: v, urlParameters: params };
+}
+
+function importAuth(
+ rawAuth: any,
+): Pick {
+ const auth = toRecord(rawAuth);
+ if ('basic' in auth) {
+ return {
+ authenticationType: 'basic',
+ authentication: {
+ username: auth.basic.username || '',
+ password: auth.basic.password || '',
+ },
+ };
+ } else if ('bearer' in auth) {
+ return {
+ authenticationType: 'bearer',
+ authentication: {
+ token: auth.bearer.token || '',
+ },
+ };
+ } else {
+ return { authenticationType: null, authentication: {} };
+ }
+}
+
+function importBody(rawBody: any): Pick {
+ const body = toRecord(rawBody);
+ if (body.mode === 'graphql') {
+ return {
+ headers: [
+ {
+ name: 'Content-Type',
+ value: 'application/json',
+ enabled: true,
+ },
+ ],
+ bodyType: 'graphql',
+ body: {
+ text: JSON.stringify(
+ { query: body.graphql.query, variables: parseJSONToRecord(body.graphql.variables) },
+ null,
+ 2,
+ ),
+ },
+ };
+ } else if (body.mode === 'urlencoded') {
+ return {
+ headers: [
+ {
+ name: 'Content-Type',
+ value: 'application/x-www-form-urlencoded',
+ enabled: true,
+ },
+ ],
+ bodyType: 'application/x-www-form-urlencoded',
+ body: {
+ form: toArray(body.urlencoded).map((f) => ({
+ enabled: !f.disabled,
+ name: f.key ?? '',
+ value: f.value ?? '',
+ })),
+ },
+ };
+ } else if (body.mode === 'formdata') {
+ return {
+ headers: [
+ {
+ name: 'Content-Type',
+ value: 'multipart/form-data',
+ enabled: true,
+ },
+ ],
+ bodyType: 'multipart/form-data',
+ body: {
+ form: toArray(body.formdata).map((f) =>
+ f.src != null
+ ? {
+ enabled: !f.disabled,
+ contentType: f.contentType ?? null,
+ name: f.key ?? '',
+ file: f.src ?? '',
+ }
+ : {
+ enabled: !f.disabled,
+ name: f.key ?? '',
+ value: f.value ?? '',
+ },
+ ),
+ },
+ };
+ } else if (body.mode === 'raw') {
+ return {
+ headers: [
+ {
+ name: 'Content-Type',
+ value: body.options?.raw?.language === 'json' ? 'application/json' : '',
+ enabled: true,
+ },
+ ],
+ bodyType: body.options?.raw?.language === 'json' ? 'application/json' : 'other',
+ body: {
+ text: body.raw ?? '',
+ },
+ };
+ } else if (body.mode === 'file') {
+ return {
+ headers: [],
+ bodyType: 'binary',
+ body: {
+ filePath: body.file?.src,
+ },
+ };
+ } else {
+ return { headers: [], bodyType: null, body: {} };
+ }
+}
+
+function parseJSONToRecord(jsonStr: string): Record | null {
+ try {
+ return toRecord(JSON.parse(jsonStr));
+ } catch (err) {
+ }
+ return null;
+}
+
+function toRecord(value: any): Record {
+ if (Object.prototype.toString.call(value) === '[object Object]') return value;
+ else return {};
+}
+
+function toArray(value: any): any[] {
+ if (Object.prototype.toString.call(value) === '[object Array]') return value;
+ else return [];
+}
+
+/** Recursively render all nested object properties */
+function convertTemplateSyntax(obj: T): T {
+ if (typeof obj === 'string') {
+ return obj.replace(/{{\s*(_\.)?([^}]+)\s*}}/g, '${[$2]}') as T;
+ } else if (Array.isArray(obj) && obj != null) {
+ return obj.map(convertTemplateSyntax) as T;
+ } else if (typeof obj === 'object' && obj != null) {
+ return Object.fromEntries(
+ Object.entries(obj).map(([k, v]) => [k, convertTemplateSyntax(v)]),
+ ) as T;
+ } else {
+ return obj;
+ }
+}
+
+function deleteUndefinedAttrs(obj: T): T {
+ if (Array.isArray(obj) && obj != null) {
+ return obj.map(deleteUndefinedAttrs) as T;
+ } else if (typeof obj === 'object' && obj != null) {
+ return Object.fromEntries(
+ Object.entries(obj)
+ .filter(([, v]) => v !== undefined)
+ .map(([k, v]) => [k, deleteUndefinedAttrs(v)]),
+ ) as T;
+ } else {
+ return obj;
+ }
+}
+
+const idCount: Partial> = {};
+
+function generateId(model: string): string {
+ idCount[model] = (idCount[model] ?? -1) + 1;
+ return `GENERATE_ID::${model.toUpperCase()}_${idCount[model]}`;
+}
diff --git a/plugins/importer-postman/tests/fixtures/nested.input.json b/plugins/importer-postman/tests/fixtures/nested.input.json
new file mode 100644
index 00000000..0061656e
--- /dev/null
+++ b/plugins/importer-postman/tests/fixtures/nested.input.json
@@ -0,0 +1,38 @@
+{
+ "info": {
+ "_postman_id": "9e6dfada-256c-49ea-a38f-7d1b05b7ca2d",
+ "name": "New Collection",
+ "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json",
+ "_exporter_id": "18798"
+ },
+ "item": [
+ {
+ "name": "Top Folder",
+ "item": [
+ {
+ "name": "Nested Folder",
+ "item": [
+ {
+ "name": "Request 1",
+ "request": {
+ "method": "GET"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Request 2",
+ "request": {
+ "method": "GET"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Request 3",
+ "request": {
+ "method": "GET"
+ }
+ }
+ ]
+}
diff --git a/plugins/importer-postman/tests/fixtures/nested.output.json b/plugins/importer-postman/tests/fixtures/nested.output.json
new file mode 100644
index 00000000..9e9bfaab
--- /dev/null
+++ b/plugins/importer-postman/tests/fixtures/nested.output.json
@@ -0,0 +1,83 @@
+{
+ "resources": {
+ "workspaces": [
+ {
+ "model": "workspace",
+ "id": "GENERATE_ID::WORKSPACE_0",
+ "name": "New Collection"
+ }
+ ],
+ "environments": [
+ {
+ "id": "GENERATE_ID::ENVIRONMENT_0",
+ "model": "environment",
+ "name": "Global Variables",
+ "variables": [],
+ "workspaceId": "GENERATE_ID::WORKSPACE_0"
+ }
+ ],
+ "httpRequests": [
+ {
+ "model": "http_request",
+ "id": "GENERATE_ID::HTTP_REQUEST_0",
+ "workspaceId": "GENERATE_ID::WORKSPACE_0",
+ "folderId": "GENERATE_ID::FOLDER_1",
+ "name": "Request 1",
+ "method": "GET",
+ "url": "",
+ "urlParameters": [],
+ "body": {},
+ "bodyType": null,
+ "authentication": {},
+ "authenticationType": null,
+ "headers": []
+ },
+ {
+ "model": "http_request",
+ "id": "GENERATE_ID::HTTP_REQUEST_1",
+ "workspaceId": "GENERATE_ID::WORKSPACE_0",
+ "folderId": "GENERATE_ID::FOLDER_0",
+ "name": "Request 2",
+ "method": "GET",
+ "url": "",
+ "urlParameters": [],
+ "body": {},
+ "bodyType": null,
+ "authentication": {},
+ "authenticationType": null,
+ "headers": []
+ },
+ {
+ "model": "http_request",
+ "id": "GENERATE_ID::HTTP_REQUEST_2",
+ "workspaceId": "GENERATE_ID::WORKSPACE_0",
+ "folderId": null,
+ "name": "Request 3",
+ "method": "GET",
+ "url": "",
+ "urlParameters": [],
+ "body": {},
+ "bodyType": null,
+ "authentication": {},
+ "authenticationType": null,
+ "headers": []
+ }
+ ],
+ "folders": [
+ {
+ "model": "folder",
+ "workspaceId": "GENERATE_ID::WORKSPACE_0",
+ "id": "GENERATE_ID::FOLDER_0",
+ "name": "Top Folder",
+ "folderId": null
+ },
+ {
+ "model": "folder",
+ "workspaceId": "GENERATE_ID::WORKSPACE_0",
+ "id": "GENERATE_ID::FOLDER_1",
+ "name": "Nested Folder",
+ "folderId": "GENERATE_ID::FOLDER_0"
+ }
+ ]
+ }
+}
diff --git a/plugins/importer-postman/tests/fixtures/params.input.json b/plugins/importer-postman/tests/fixtures/params.input.json
new file mode 100644
index 00000000..f2969d24
--- /dev/null
+++ b/plugins/importer-postman/tests/fixtures/params.input.json
@@ -0,0 +1,136 @@
+{
+ "info": {
+ "_postman_id": "9e6dfada-256c-49ea-a38f-7d1b05b7ca2d",
+ "name": "New Collection",
+ "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
+ "_exporter_id": "18798"
+ },
+ "item": [
+ {
+ "name": "Form URL",
+ "request": {
+ "auth": {
+ "type": "bearer",
+ "bearer": [
+ {
+ "key": "token",
+ "value": "baeare",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "X-foo",
+ "value": "bar",
+ "description": "description"
+ },
+ {
+ "key": "Disabled",
+ "value": "tnroant",
+ "description": "ntisorantosra",
+ "disabled": true
+ }
+ ],
+ "body": {
+ "mode": "formdata",
+ "formdata": [
+ {
+ "key": "Key",
+ "contentType": "Custom/COntent",
+ "description": "DEscription",
+ "type": "file",
+ "src": "/Users/gschier/Desktop/Screenshot 2024-05-31 at 12.05.11 PM.png"
+ }
+ ]
+ },
+ "url": {
+ "raw": "example.com/:foo/:bar?q=qqq&",
+ "host": [
+ "example",
+ "com"
+ ],
+ "path": [
+ ":foo",
+ ":bar"
+ ],
+ "query": [
+ {
+ "key": "disabled",
+ "value": "secondvalue",
+ "description": "this is disabled",
+ "disabled": true
+ },
+ {
+ "key": "q",
+ "value": "qqq",
+ "description": "hello"
+ },
+ {
+ "key": "",
+ "value": null
+ }
+ ],
+ "variable": [
+ {
+ "key": "foo",
+ "value": "fff",
+ "description": "Description"
+ },
+ {
+ "key": "bar",
+ "value": "bbb",
+ "description": "bbb description"
+ }
+ ]
+ }
+ },
+ "response": []
+ }
+ ],
+ "auth": {
+ "type": "basic",
+ "basic": [
+ {
+ "key": "password",
+ "value": "globalpass",
+ "type": "string"
+ },
+ {
+ "key": "username",
+ "value": "globaluser",
+ "type": "string"
+ }
+ ]
+ },
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "type": "text/javascript",
+ "packages": {},
+ "exec": [
+ ""
+ ]
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "type": "text/javascript",
+ "packages": {},
+ "exec": [
+ ""
+ ]
+ }
+ }
+ ],
+ "variable": [
+ {
+ "key": "COLLECTION VARIABLE",
+ "value": "collection variable",
+ "type": "string"
+ }
+ ]
+}
diff --git a/plugins/importer-postman/tests/fixtures/params.output.json b/plugins/importer-postman/tests/fixtures/params.output.json
new file mode 100644
index 00000000..1eb16ce3
--- /dev/null
+++ b/plugins/importer-postman/tests/fixtures/params.output.json
@@ -0,0 +1,96 @@
+{
+ "resources": {
+ "workspaces": [
+ {
+ "model": "workspace",
+ "id": "GENERATE_ID::WORKSPACE_1",
+ "name": "New Collection"
+ }
+ ],
+ "environments": [
+ {
+ "id": "GENERATE_ID::ENVIRONMENT_1",
+ "workspaceId": "GENERATE_ID::WORKSPACE_1",
+ "model": "environment",
+ "name": "Global Variables",
+ "variables": [
+ {
+ "name": "COLLECTION VARIABLE",
+ "value": "collection variable"
+ }
+ ]
+ }
+ ],
+ "httpRequests": [
+ {
+ "model": "http_request",
+ "id": "GENERATE_ID::HTTP_REQUEST_3",
+ "workspaceId": "GENERATE_ID::WORKSPACE_1",
+ "folderId": null,
+ "name": "Form URL",
+ "method": "POST",
+ "url": "example.com/:foo/:bar",
+ "urlParameters": [
+ {
+ "name": "disabled",
+ "value": "secondvalue",
+ "enabled": false
+ },
+ {
+ "name": "q",
+ "value": "qqq",
+ "enabled": true
+ },
+ {
+ "name": "",
+ "value": "",
+ "enabled": true
+ },
+ {
+ "name": ":foo",
+ "value": "fff",
+ "enabled": true
+ },
+ {
+ "name": ":bar",
+ "value": "bbb",
+ "enabled": true
+ }
+ ],
+ "body": {
+ "form": [
+ {
+ "enabled": true,
+ "contentType": "Custom/COntent",
+ "name": "Key",
+ "file": "/Users/gschier/Desktop/Screenshot 2024-05-31 at 12.05.11 PM.png"
+ }
+ ]
+ },
+ "bodyType": "multipart/form-data",
+ "authentication": {
+ "token": ""
+ },
+ "authenticationType": "bearer",
+ "headers": [
+ {
+ "name": "X-foo",
+ "value": "bar",
+ "enabled": true
+ },
+ {
+ "name": "Disabled",
+ "value": "tnroant",
+ "enabled": false
+ },
+ {
+ "name": "Content-Type",
+ "value": "multipart/form-data",
+ "enabled": true
+ }
+ ]
+ }
+ ],
+ "folders": []
+ }
+}
diff --git a/plugins/importer-postman/tests/index.test.ts b/plugins/importer-postman/tests/index.test.ts
new file mode 100644
index 00000000..3311605a
--- /dev/null
+++ b/plugins/importer-postman/tests/index.test.ts
@@ -0,0 +1,23 @@
+import * as fs from 'node:fs';
+import * as path from 'node:path';
+import { describe, expect, test } from 'vitest';
+import { convertPostman } from '../src';
+
+describe('importer-postman', () => {
+ const p = path.join(__dirname, 'fixtures');
+ const fixtures = fs.readdirSync(p);
+
+ for (const fixture of fixtures) {
+ if (fixture.includes('.output')) {
+ continue;
+ }
+
+ test('Imports ' + fixture, () => {
+ const contents = fs.readFileSync(path.join(p, fixture), 'utf-8');
+ const expected = fs.readFileSync(path.join(p, fixture.replace('.input', '.output')), 'utf-8');
+ const result = convertPostman(contents);
+ // console.log(JSON.stringify(result, null, 2))
+ expect(result).toEqual(JSON.parse(expected));
+ });
+ }
+});
diff --git a/src-tauri/vendored/plugins/importer-yaak/package.json b/plugins/importer-yaak/package.json
similarity index 100%
rename from src-tauri/vendored/plugins/importer-yaak/package.json
rename to plugins/importer-yaak/package.json
diff --git a/plugins/importer-yaak/src/index.ts b/plugins/importer-yaak/src/index.ts
new file mode 100644
index 00000000..1a71cfbb
--- /dev/null
+++ b/plugins/importer-yaak/src/index.ts
@@ -0,0 +1,74 @@
+import { Environment, PluginDefinition } from '@yaakapp/api';
+
+export const plugin: PluginDefinition = {
+ importer: {
+ name: 'Yaak',
+ description: 'Yaak official format',
+ onImport(_ctx, args) {
+ return migrateImport(args.text) as any;
+ },
+ },
+};
+
+export function migrateImport(contents: string) {
+ let parsed;
+ try {
+ parsed = JSON.parse(contents);
+ } catch (err) {
+ return undefined;
+ }
+
+ if (!isJSObject(parsed)) {
+ return undefined;
+ }
+
+ const isYaakExport = 'yaakSchema' in parsed;
+ if (!isYaakExport) {
+ return;
+ }
+
+ // Migrate v1 to v2 -- changes requests to httpRequests
+ if ('requests' in parsed.resources) {
+ parsed.resources.httpRequests = parsed.resources.requests;
+ delete parsed.resources['requests'];
+ }
+
+ // Migrate v2 to v3
+ for (const workspace of parsed.resources.workspaces ?? []) {
+ if ('variables' in workspace) {
+ // Create the base environment
+ const baseEnvironment: Partial = {
+ id: `GENERATE_ID::base_env_${workspace['id']}`,
+ name: 'Global Variables',
+ variables: workspace.variables,
+ workspaceId: workspace.id,
+ };
+ parsed.resources.environments = parsed.resources.environments ?? [];
+ parsed.resources.environments.push(baseEnvironment);
+
+ // Delete variables key from the workspace
+ delete workspace.variables;
+
+ // Add environmentId to relevant environments
+ for (const environment of parsed.resources.environments) {
+ if (environment.workspaceId === workspace.id && environment.id !== baseEnvironment.id) {
+ environment.environmentId = baseEnvironment.id;
+ }
+ }
+ }
+ }
+
+ // Migrate v3 to v4
+ for (const environment of parsed.resources.environments ?? []) {
+ if ('environmentId' in environment) {
+ environment.base = environment.environmentId == null;
+ delete environment.environmentId;
+ }
+ }
+
+ return { resources: parsed.resources }; // Should already be in the correct format
+}
+
+function isJSObject(obj: any) {
+ return Object.prototype.toString.call(obj) === '[object Object]';
+}
diff --git a/plugins/importer-yaak/tests/index.test.ts b/plugins/importer-yaak/tests/index.test.ts
new file mode 100644
index 00000000..a55e62b1
--- /dev/null
+++ b/plugins/importer-yaak/tests/index.test.ts
@@ -0,0 +1,70 @@
+import { describe, expect, test } from 'vitest';
+import { migrateImport } from '../src';
+
+describe('importer-yaak', () => {
+ test('Skips invalid imports', () => {
+ expect(migrateImport('not JSON')).toBeUndefined();
+ expect(migrateImport('[]')).toBeUndefined();
+ expect(migrateImport(JSON.stringify({ resources: {} }))).toBeUndefined();
+ });
+
+ test('converts schema 1 to 2', () => {
+ const imported = migrateImport(
+ JSON.stringify({
+ yaakSchema: 1,
+ resources: {
+ requests: [],
+ },
+ }),
+ );
+
+ expect(imported).toEqual(
+ expect.objectContaining({
+ resources: {
+ httpRequests: [],
+ },
+ }),
+ );
+ });
+ test('converts schema 2 to 3', () => {
+ const imported = migrateImport(
+ JSON.stringify({
+ yaakSchema: 2,
+ resources: {
+ environments: [{
+ id: 'e_1',
+ workspaceId: 'w_1',
+ name: 'Production',
+ variables: [{ name: 'E1', value: 'E1!' }],
+ }],
+ workspaces: [{
+ id: 'w_1',
+ variables: [{ name: 'W1', value: 'W1!' }],
+ }],
+ },
+ }),
+ );
+
+ expect(imported).toEqual(
+ expect.objectContaining({
+ resources: {
+ workspaces: [{
+ id: 'w_1',
+ }],
+ environments: [{
+ id: 'e_1',
+ base: false,
+ workspaceId: 'w_1',
+ name: 'Production',
+ variables: [{ name: 'E1', value: 'E1!' }],
+ }, {
+ id: 'GENERATE_ID::base_env_w_1',
+ workspaceId: 'w_1',
+ name: 'Global Variables',
+ variables: [{ name: 'W1', value: 'W1!' }],
+ }],
+ },
+ }),
+ );
+ });
+});
diff --git a/src-tauri/vendored/plugins/template-function-cookie/package.json b/plugins/template-function-cookie/package.json
similarity index 100%
rename from src-tauri/vendored/plugins/template-function-cookie/package.json
rename to plugins/template-function-cookie/package.json
diff --git a/plugins/template-function-cookie/src/index.ts b/plugins/template-function-cookie/src/index.ts
new file mode 100644
index 00000000..3d39d74c
--- /dev/null
+++ b/plugins/template-function-cookie/src/index.ts
@@ -0,0 +1,20 @@
+import { CallTemplateFunctionArgs, Context, PluginDefinition } from '@yaakapp/api';
+
+export const plugin: PluginDefinition = {
+ templateFunctions: [
+ {
+ name: 'cookie.value',
+ description: 'Read the value of a cookie in the jar, by name',
+ args: [
+ {
+ type: 'text',
+ name: 'cookie_name',
+ label: 'Cookie Name',
+ },
+ ],
+ async onRender(ctx: Context, args: CallTemplateFunctionArgs): Promise {
+ return ctx.cookies.getValue({ name: String(args.values.cookie_name) });
+ },
+ },
+ ],
+};
diff --git a/src-tauri/vendored/plugins/template-function-encode/package.json b/plugins/template-function-encode/package.json
similarity index 100%
rename from src-tauri/vendored/plugins/template-function-encode/package.json
rename to plugins/template-function-encode/package.json
diff --git a/plugins/template-function-encode/src/index.ts b/plugins/template-function-encode/src/index.ts
new file mode 100644
index 00000000..d829eedf
--- /dev/null
+++ b/plugins/template-function-encode/src/index.ts
@@ -0,0 +1,42 @@
+import { CallTemplateFunctionArgs, Context, PluginDefinition } from '@yaakapp/api';
+
+export const plugin: PluginDefinition = {
+ templateFunctions: [
+ {
+ name: 'base64.encode',
+ description: 'Encode a value to base64',
+ args: [{ label: 'Plain Text', type: 'text', name: 'value', multiLine: true }],
+ async onRender(_ctx: Context, args: CallTemplateFunctionArgs): Promise {
+ return Buffer.from(args.values.value ?? '').toString('base64');
+ },
+ },
+ {
+ name: 'base64.decode',
+ description: 'Decode a value from base64',
+ args: [{ label: 'Encoded Value', type: 'text', name: 'value', multiLine: true }],
+ async onRender(_ctx: Context, args: CallTemplateFunctionArgs): Promise {
+ return Buffer.from(args.values.value ?? '', 'base64').toString('utf-8');
+ },
+ },
+ {
+ name: 'url.encode',
+ description: 'Encode a value for use in a URL (percent-encoding)',
+ args: [{ label: 'Plain Text', type: 'text', name: 'value', multiLine: true }],
+ async onRender(_ctx: Context, args: CallTemplateFunctionArgs): Promise {
+ return encodeURIComponent(args.values.value ?? '');
+ },
+ },
+ {
+ name: 'url.decode',
+ description: 'Decode a percent-encoded URL value',
+ args: [{ label: 'Encoded Value', type: 'text', name: 'value', multiLine: true }],
+ async onRender(_ctx: Context, args: CallTemplateFunctionArgs): Promise {
+ try {
+ return decodeURIComponent(args.values.value ?? '');
+ } catch {
+ return '';
+ }
+ },
+ },
+ ],
+};
diff --git a/src-tauri/vendored/plugins/template-function-fs/package.json b/plugins/template-function-fs/package.json
similarity index 100%
rename from src-tauri/vendored/plugins/template-function-fs/package.json
rename to plugins/template-function-fs/package.json
diff --git a/plugins/template-function-fs/src/index.ts b/plugins/template-function-fs/src/index.ts
new file mode 100644
index 00000000..c783ea4f
--- /dev/null
+++ b/plugins/template-function-fs/src/index.ts
@@ -0,0 +1,19 @@
+import { CallTemplateFunctionArgs, Context, PluginDefinition } from '@yaakapp/api';
+import fs from 'node:fs';
+
+export const plugin: PluginDefinition = {
+ templateFunctions: [{
+ name: 'fs.readFile',
+ description: 'Read the contents of a file as utf-8',
+ args: [{ title: 'Select File', type: 'file', name: 'path', label: 'File' }],
+ async onRender(_ctx: Context, args: CallTemplateFunctionArgs): Promise {
+ if (!args.values.path) return null;
+
+ try {
+ return fs.promises.readFile(args.values.path, 'utf-8');
+ } catch (err) {
+ return null;
+ }
+ },
+ }],
+};
diff --git a/src-tauri/vendored/plugins/template-function-hash/package.json b/plugins/template-function-hash/package.json
similarity index 100%
rename from src-tauri/vendored/plugins/template-function-hash/package.json
rename to plugins/template-function-hash/package.json
diff --git a/plugins/template-function-hash/src/index.ts b/plugins/template-function-hash/src/index.ts
new file mode 100755
index 00000000..308cb0aa
--- /dev/null
+++ b/plugins/template-function-hash/src/index.ts
@@ -0,0 +1,86 @@
+import { CallTemplateFunctionArgs, Context, PluginDefinition } from '@yaakapp/api';
+import { createHash, createHmac } from 'node:crypto';
+
+const algorithms = ['md5', 'sha1', 'sha256', 'sha512'] as const;
+const encodings = ['base64', 'hex'] as const;
+
+type TemplateFunctionPlugin = NonNullable[number];
+
+const hashFunctions: TemplateFunctionPlugin[] = algorithms.map(algorithm => ({
+ name: `hash.${algorithm}`,
+ description: 'Hash a value to its hexidecimal representation',
+ args: [
+ {
+ type: 'text',
+ name: 'input',
+ label: 'Input',
+ placeholder: 'input text',
+ multiLine: true,
+ },
+ {
+ type: 'select',
+ name: 'encoding',
+ label: 'Encoding',
+ defaultValue: 'base64',
+ options: encodings.map(encoding => ({
+ label: capitalize(encoding),
+ value: encoding,
+ })),
+ },
+ ],
+ async onRender(_ctx: Context, args: CallTemplateFunctionArgs): Promise {
+ const input = String(args.values.input);
+ const encoding = String(args.values.encoding) as typeof encodings[number];
+
+ return createHash(algorithm)
+ .update(input, 'utf-8')
+ .digest(encoding);
+ },
+}));
+
+const hmacFunctions: TemplateFunctionPlugin[] = algorithms.map(algorithm => ({
+ name: `hmac.${algorithm}`,
+ description: 'Compute the HMAC of a value',
+ args: [
+ {
+ type: 'text',
+ name: 'input',
+ label: 'Input',
+ placeholder: 'input text',
+ multiLine: true,
+ },
+ {
+ type: 'text',
+ name: 'key',
+ label: 'Key',
+ password: true,
+ },
+ {
+ type: 'select',
+ name: 'encoding',
+ label: 'Encoding',
+ defaultValue: 'base64',
+ options: encodings.map(encoding => ({
+ value: encoding,
+ label: capitalize(encoding),
+ })),
+ },
+ ],
+ async onRender(_ctx: Context, args: CallTemplateFunctionArgs): Promise {
+ const input = String(args.values.input);
+ const key = String(args.values.key);
+ const encoding = String(args.values.encoding) as typeof encodings[number];
+
+ return createHmac(algorithm, key, {})
+ .update(input)
+ .digest(encoding);
+ },
+}));
+
+export const plugin: PluginDefinition = {
+ templateFunctions: [...hashFunctions, ...hmacFunctions],
+};
+
+function capitalize(str: string): string {
+ return str.charAt(0).toUpperCase() + str.slice(1);
+}
diff --git a/src-tauri/vendored/plugins/template-function-json/package.json b/plugins/template-function-json/package.json
similarity index 100%
rename from src-tauri/vendored/plugins/template-function-json/package.json
rename to plugins/template-function-json/package.json
diff --git a/plugins/template-function-json/src/index.ts b/plugins/template-function-json/src/index.ts
new file mode 100755
index 00000000..8383a0a1
--- /dev/null
+++ b/plugins/template-function-json/src/index.ts
@@ -0,0 +1,48 @@
+import { CallTemplateFunctionArgs, Context, PluginDefinition } from '@yaakapp/api';
+import { JSONPath } from 'jsonpath-plus';
+
+export const plugin: PluginDefinition = {
+ templateFunctions: [
+ {
+ name: 'json.jsonpath',
+ description: 'Filter JSON-formatted text using JSONPath syntax',
+ args: [
+ { type: 'text', name: 'input', label: 'Input', multiLine: true, placeholder: '{ "foo": "bar" }' },
+ { type: 'text', name: 'query', label: 'Query', placeholder: '$..foo' },
+ { type: 'checkbox', name: 'formatted', label: 'Format Output' },
+ ],
+ async onRender(_ctx: Context, args: CallTemplateFunctionArgs): Promise {
+ try {
+ const parsed = JSON.parse(String(args.values.input));
+ const query = String(args.values.query ?? '$').trim();
+ let filtered = JSONPath({ path: query, json: parsed });
+ if (Array.isArray(filtered)) {
+ filtered = filtered[0];
+ }
+ if (typeof filtered === 'string') {
+ return filtered;
+ }
+
+ if (args.values.formatted) {
+ return JSON.stringify(filtered, null, 2);
+ } else {
+ return JSON.stringify(filtered);
+ }
+ } catch (e) {
+ return null;
+ }
+ },
+ },
+ {
+ name: 'json.escape',
+ description: 'Escape a JSON string, useful when using the output in JSON values',
+ args: [
+ { type: 'text', name: 'input', label: 'Input', multiLine: true, placeholder: 'Hello "World"' },
+ ],
+ async onRender(_ctx: Context, args: CallTemplateFunctionArgs): Promise {
+ const input = String(args.values.input ?? '');
+ return input.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
+ },
+ },
+ ],
+};
diff --git a/src-tauri/vendored/plugins/template-function-prompt/package.json b/plugins/template-function-prompt/package.json
similarity index 100%
rename from src-tauri/vendored/plugins/template-function-prompt/package.json
rename to plugins/template-function-prompt/package.json
diff --git a/plugins/template-function-prompt/src/index.ts b/plugins/template-function-prompt/src/index.ts
new file mode 100644
index 00000000..a40ce13e
--- /dev/null
+++ b/plugins/template-function-prompt/src/index.ts
@@ -0,0 +1,25 @@
+import { CallTemplateFunctionArgs, Context, PluginDefinition } from '@yaakapp/api';
+
+export const plugin: PluginDefinition = {
+ templateFunctions: [{
+ name: 'prompt.text',
+ description: 'Prompt the user for input when sending a request',
+ args: [
+ { type: 'text', name: 'title', label: 'Title' },
+ { type: 'text', name: 'label', label: 'Label', optional: true },
+ { type: 'text', name: 'defaultValue', label: 'Default Value', optional: true },
+ { type: 'text', name: 'placeholder', label: 'Placeholder', optional: true },
+ ],
+ async onRender(ctx: Context, args: CallTemplateFunctionArgs): Promise {
+ if (args.purpose !== 'send') return null;
+
+ return await ctx.prompt.text({
+ id: `prompt-${args.values.label}`,
+ label: args.values.title ?? '',
+ title: args.values.title ?? '',
+ defaultValue: args.values.defaultValue,
+ placeholder: args.values.placeholder,
+ });
+ },
+ }],
+};
diff --git a/src-tauri/vendored/plugins/template-function-regex/package.json b/plugins/template-function-regex/package.json
similarity index 100%
rename from src-tauri/vendored/plugins/template-function-regex/package.json
rename to plugins/template-function-regex/package.json
diff --git a/plugins/template-function-regex/src/index.ts b/plugins/template-function-regex/src/index.ts
new file mode 100644
index 00000000..a62367cc
--- /dev/null
+++ b/plugins/template-function-regex/src/index.ts
@@ -0,0 +1,28 @@
+import { CallTemplateFunctionArgs, Context, PluginDefinition } from '@yaakapp/api';
+
+export const plugin: PluginDefinition = {
+ templateFunctions: [{
+ name: 'regex.match',
+ description: 'Extract',
+ args: [
+ {
+ type: 'text',
+ name: 'regex',
+ label: 'Regular Expression',
+ placeholder: '^\w+=(?\w*)$',
+ defaultValue: '^(.*)$',
+ description: 'A JavaScript regular expression, evaluated using the Node.js RegExp engine. Capture groups or named groups can be used to extract values.',
+ },
+ { type: 'text', name: 'input', label: 'Input Text', multiLine: true },
+ ],
+ async onRender(_ctx: Context, args: CallTemplateFunctionArgs): Promise {
+ if (!args.values.regex) return '';
+
+ const regex = new RegExp(String(args.values.regex));
+ const match = args.values.input?.match(regex);
+ return match?.groups
+ ? Object.values(match.groups)[0] ?? ''
+ : match?.[1] ?? match?.[0] ?? '';
+ },
+ }],
+};
diff --git a/src-tauri/vendored/plugins/template-function-request/package.json b/plugins/template-function-request/package.json
similarity index 100%
rename from src-tauri/vendored/plugins/template-function-request/package.json
rename to plugins/template-function-request/package.json
diff --git a/plugins/template-function-request/src/index.ts b/plugins/template-function-request/src/index.ts
new file mode 100755
index 00000000..0567d587
--- /dev/null
+++ b/plugins/template-function-request/src/index.ts
@@ -0,0 +1,45 @@
+import { CallTemplateFunctionArgs, Context, PluginDefinition } from '@yaakapp/api';
+
+export const plugin: PluginDefinition = {
+ templateFunctions: [
+ {
+ name: 'request.body',
+ args: [{
+ name: 'requestId',
+ label: 'Http Request',
+ type: 'http_request',
+ }],
+ async onRender(ctx: Context, args: CallTemplateFunctionArgs): Promise {
+ const httpRequest = await ctx.httpRequest.getById({ id: args.values.requestId ?? 'n/a' });
+ if (httpRequest == null) return null;
+ return String(await ctx.templates.render({
+ data: httpRequest.body?.text ?? '',
+ purpose: args.purpose,
+ }));
+ },
+ },
+ {
+ name: 'request.header',
+ args: [
+ {
+ name: 'requestId',
+ label: 'Http Request',
+ type: 'http_request',
+ },
+ {
+ name: 'header',
+ label: 'Header Name',
+ type: 'text',
+ }],
+ async onRender(ctx: Context, args: CallTemplateFunctionArgs): Promise {
+ const httpRequest = await ctx.httpRequest.getById({ id: args.values.requestId ?? 'n/a' });
+ if (httpRequest == null) return null;
+ const header = httpRequest.headers.find(h => h.name.toLowerCase() === args.values.header?.toLowerCase());
+ return String(await ctx.templates.render({
+ data: header?.value ?? '',
+ purpose: args.purpose,
+ }));
+ },
+ },
+ ],
+};
diff --git a/src-tauri/vendored/plugins/template-function-response/package.json b/plugins/template-function-response/package.json
similarity index 100%
rename from src-tauri/vendored/plugins/template-function-response/package.json
rename to plugins/template-function-response/package.json
diff --git a/plugins/template-function-response/src/index.ts b/plugins/template-function-response/src/index.ts
new file mode 100644
index 00000000..0e8c8909
--- /dev/null
+++ b/plugins/template-function-response/src/index.ts
@@ -0,0 +1,210 @@
+import { DOMParser } from '@xmldom/xmldom';
+import {
+ CallTemplateFunctionArgs,
+ Context,
+ FormInput,
+ HttpResponse,
+ PluginDefinition,
+ RenderPurpose,
+} from '@yaakapp/api';
+import { JSONPath } from 'jsonpath-plus';
+import { readFileSync } from 'node:fs';
+import xpath from 'xpath';
+
+const behaviorArg: FormInput = {
+ type: 'select',
+ name: 'behavior',
+ label: 'Sending Behavior',
+ defaultValue: 'smart',
+ options: [
+ { label: 'When no responses', value: 'smart' },
+ { label: 'Always', value: 'always' },
+ ],
+};
+
+const requestArg: FormInput = {
+ type: 'http_request',
+ name: 'request',
+ label: 'Request',
+};
+
+export const plugin: PluginDefinition = {
+ templateFunctions: [
+ {
+ name: 'response.header',
+ description: 'Read the value of a response header, by name',
+ args: [
+ requestArg,
+ {
+ type: 'text',
+ name: 'header',
+ label: 'Header Name',
+ placeholder: 'Content-Type',
+ },
+ behaviorArg,
+ ],
+ async onRender(ctx: Context, args: CallTemplateFunctionArgs): Promise {
+ if (!args.values.request || !args.values.header) return null;
+
+ const response = await getResponse(ctx, {
+ requestId: args.values.request,
+ purpose: args.purpose,
+ behavior: args.values.behavior ?? null,
+ });
+ if (response == null) return null;
+
+ const header = response.headers.find(
+ h => h.name.toLowerCase() === String(args.values.header ?? '').toLowerCase(),
+ );
+ return header?.value ?? null;
+ },
+ },
+ {
+ name: 'response.body.path',
+ description: 'Access a field of the response body using JsonPath or XPath',
+ aliases: ['response'],
+ args: [
+ requestArg,
+ {
+ type: 'text',
+ name: 'path',
+ label: 'JSONPath or XPath',
+ placeholder: '$.books[0].id or /books[0]/id',
+ },
+ behaviorArg,
+ ],
+ async onRender(ctx: Context, args: CallTemplateFunctionArgs): Promise {
+ if (!args.values.request || !args.values.path) return null;
+
+ const response = await getResponse(ctx, {
+ requestId: args.values.request,
+ purpose: args.purpose,
+ behavior: args.values.behavior ?? null,
+ });
+ if (response == null) return null;
+
+ if (response.bodyPath == null) {
+ return null;
+ }
+
+ let body;
+ try {
+ body = readFileSync(response.bodyPath, 'utf-8');
+ } catch (_) {
+ return null;
+ }
+
+ try {
+ return filterJSONPath(body, args.values.path);
+ } catch (err) {
+ // Probably not JSON, try XPath
+ }
+
+ try {
+ return filterXPath(body, args.values.path);
+ } catch (err) {
+ // Probably not XML
+ }
+
+ return null; // Bail out
+ },
+ },
+ {
+ name: 'response.body.raw',
+ description: 'Access the entire response body, as text',
+ aliases: ['response'],
+ args: [
+ requestArg,
+ behaviorArg,
+ ],
+ async onRender(ctx: Context, args: CallTemplateFunctionArgs): Promise {
+ if (!args.values.request) return null;
+
+ const response = await getResponse(ctx, {
+ requestId: args.values.request,
+ purpose: args.purpose,
+ behavior: args.values.behavior ?? null,
+ });
+ if (response == null) return null;
+
+ if (response.bodyPath == null) {
+ return null;
+ }
+
+ let body;
+ try {
+ body = readFileSync(response.bodyPath, 'utf-8');
+ } catch (_) {
+ return null;
+ }
+
+ return body;
+ },
+ },
+ ],
+};
+
+function filterJSONPath(body: string, path: string): string {
+ const parsed = JSON.parse(body);
+ const items = JSONPath({ path, json: parsed })[0];
+ if (items == null) {
+ return '';
+ }
+
+ if (
+ Object.prototype.toString.call(items) === '[object Array]' ||
+ Object.prototype.toString.call(items) === '[object Object]'
+ ) {
+ return JSON.stringify(items);
+ } else {
+ return String(items);
+ }
+}
+
+function filterXPath(body: string, path: string): string {
+ const doc = new DOMParser().parseFromString(body, 'text/xml');
+ const items = xpath.select(path, doc, false);
+
+ if (Array.isArray(items)) {
+ return items[0] != null ? String(items[0].firstChild ?? '') : '';
+ } else {
+ // Not sure what cases this happens in (?)
+ return String(items);
+ }
+}
+
+async function getResponse(ctx: Context, { requestId, behavior, purpose }: {
+ requestId: string,
+ behavior: string | null,
+ purpose: RenderPurpose,
+}): Promise {
+ if (!requestId) return null;
+
+ const httpRequest = await ctx.httpRequest.getById({ id: requestId ?? 'n/a' });
+ if (httpRequest == null) {
+ return null;
+ }
+
+ const responses = await ctx.httpResponse.find({ requestId: httpRequest.id, limit: 1 });
+
+ if (behavior === 'never' && responses.length === 0) {
+ return null;
+ }
+
+ let response: HttpResponse | null = responses[0] ?? null;
+
+ // Previews happen a ton, and we don't want to send too many times on "always," so treat
+ // it as "smart" during preview.
+ let finalBehavior = (behavior === 'always' && purpose === 'preview')
+ ? 'smart'
+ : behavior;
+
+ // Send if no responses and "smart," or "always"
+ if ((finalBehavior === 'smart' && response == null) || finalBehavior === 'always') {
+ // NOTE: Render inside this conditional, or we'll get infinite recursion (render->render->...)
+ const renderedHttpRequest = await ctx.httpRequest.render({ httpRequest, purpose });
+ response = await ctx.httpRequest.send({ httpRequest: renderedHttpRequest });
+ }
+
+ return response;
+}
diff --git a/src-tauri/vendored/plugins/template-function-uuid/package.json b/plugins/template-function-uuid/package.json
similarity index 100%
rename from src-tauri/vendored/plugins/template-function-uuid/package.json
rename to plugins/template-function-uuid/package.json
diff --git a/plugins/template-function-uuid/src/index.ts b/plugins/template-function-uuid/src/index.ts
new file mode 100644
index 00000000..88e3449b
--- /dev/null
+++ b/plugins/template-function-uuid/src/index.ts
@@ -0,0 +1,76 @@
+import { CallTemplateFunctionArgs, Context, PluginDefinition } from '@yaakapp/api';
+import { v1, v3, v4, v5, v6, v7 } from 'uuid';
+
+export const plugin: PluginDefinition = {
+ templateFunctions: [
+ {
+ name: 'uuid.v1',
+ description: 'Generate a UUID V1',
+ args: [],
+ async onRender(_ctx: Context, _args: CallTemplateFunctionArgs): Promise {
+ return v1();
+ },
+ },
+ {
+ name: 'uuid.v3',
+ description: 'Generate a UUID V3',
+ args: [
+ { type: 'text', name: 'name', label: 'Name' },
+ {
+ type: 'text',
+ name: 'namespace',
+ label: 'Namespace UUID',
+ description: 'A valid UUID to use as the namespace',
+ placeholder: '24ced880-3bf4-11f0-8329-cd053d577f0e',
+ },
+ ],
+ async onRender(_ctx: Context, args: CallTemplateFunctionArgs): Promise {
+ return v3(String(args.values.name), String(args.values.namespace));
+ },
+ },
+ {
+ name: 'uuid.v4',
+ description: 'Generate a UUID V4',
+ args: [],
+ async onRender(_ctx: Context, _args: CallTemplateFunctionArgs): Promise {
+ return v4();
+ },
+ },
+ {
+ name: 'uuid.v5',
+ description: 'Generate a UUID V5',
+ args: [
+ { type: 'text', name: 'name', label: 'Name' },
+ { type: 'text', name: 'namespace', label: 'Namespace' },
+ ],
+ async onRender(_ctx: Context, args: CallTemplateFunctionArgs): Promise {
+ return v5(String(args.values.name), String(args.values.namespace));
+ },
+ },
+ {
+ name: 'uuid.v6',
+ description: 'Generate a UUID V6',
+ args: [
+ {
+ type: 'text',
+ name: 'timestamp',
+ label: 'Timestamp',
+ optional: true,
+ description: 'Can be any format that can be parsed by JavaScript new Date(...)',
+ placeholder: '2025-05-28T11:15:00Z',
+ },
+ ],
+ async onRender(_ctx: Context, args: CallTemplateFunctionArgs): Promise {
+ return v6({ msecs: new Date(String(args.values.timestamp)).getTime() });
+ },
+ },
+ {
+ name: 'uuid.v7',
+ description: 'Generate a UUID V7',
+ args: [],
+ async onRender(_ctx: Context, _args: CallTemplateFunctionArgs): Promise {
+ return v7();
+ },
+ },
+ ],
+};
diff --git a/src-tauri/vendored/plugins/template-function-xml/package.json b/plugins/template-function-xml/package.json
similarity index 100%
rename from src-tauri/vendored/plugins/template-function-xml/package.json
rename to plugins/template-function-xml/package.json
diff --git a/plugins/template-function-xml/src/index.ts b/plugins/template-function-xml/src/index.ts
new file mode 100755
index 00000000..b6595e5a
--- /dev/null
+++ b/plugins/template-function-xml/src/index.ts
@@ -0,0 +1,29 @@
+import { DOMParser } from '@xmldom/xmldom';
+import { CallTemplateFunctionArgs, Context, PluginDefinition } from '@yaakapp/api';
+import xpath from 'xpath';
+
+export const plugin: PluginDefinition = {
+ templateFunctions: [{
+ name: 'xml.xpath',
+ description: 'Filter XML-formatted text using XPath syntax',
+ args: [
+ { type: 'text', name: 'input', label: 'Input', multiLine: true, placeholder: '' },
+ { type: 'text', name: 'query', label: 'Query', placeholder: '//foo' },
+ ],
+ async onRender(_ctx: Context, args: CallTemplateFunctionArgs): Promise {
+ try {
+ const doc = new DOMParser().parseFromString(String(args.values.input), 'text/xml');
+ let result = xpath.select(String(args.values.query), doc, false);
+ if (Array.isArray(result)) {
+ return String(result.map(c => String(c.firstChild))[0] ?? '');
+ } else if (result instanceof Node) {
+ return String(result.firstChild);
+ } else {
+ return String(result);
+ }
+ } catch (e) {
+ return null;
+ }
+ },
+ }],
+};
diff --git a/plugins_/_package.json b/plugins_/_package.json
new file mode 100644
index 00000000..33edba00
--- /dev/null
+++ b/plugins_/_package.json
@@ -0,0 +1,25 @@
+{
+ "name": "@yaakapp/plugins",
+ "repository": "https://github.com/yaakapp/plugins",
+ "workspaces": [
+ "plugins/*"
+ ],
+ "private": true,
+ "scripts": {
+ "build": "workspaces-run --parallel -- npm run --workspaces build",
+ "dev": "workspaces-run --parallel -- npm run --workspaces dev",
+ "test": "vitest run",
+ "lint": "tsc"
+ },
+ "devDependencies": {
+ "@types/node": "^22.7.4",
+ "jsonpath": "^1.1.1",
+ "typescript": "^5.6.2",
+ "vitest": "^2.0.4",
+ "workspaces-run": "^1.0.2",
+ "@yaakapp/cli": "^0.1.5"
+ },
+ "dependencies": {
+ "@yaakapp/api": "^0.6.0"
+ }
+}
diff --git a/scripts/vendor-plugins.cjs b/scripts/vendor-plugins.cjs
index bd32d39b..4a50159d 100644
--- a/scripts/vendor-plugins.cjs
+++ b/scripts/vendor-plugins.cjs
@@ -1,23 +1,16 @@
const { readdirSync, cpSync } = require('node:fs');
const path = require('node:path');
const { execSync } = require('node:child_process');
-const pluginsDir = process.env.YAAK_PLUGINS_DIR;
-if (!pluginsDir) {
- console.log('Skipping bundled plugins build because YAAK_PLUGINS_DIR is not set');
- return;
-}
-console.log('Installing Yaak plugins dependencies', pluginsDir);
-execSync('npm ci', { cwd: pluginsDir });
-console.log('Building Yaak plugins', pluginsDir);
-execSync('npm run build', { cwd: pluginsDir });
+const pluginsDir = path.join(__dirname, '..', 'plugins');
console.log('Copying Yaak plugins to', pluginsDir);
-const pluginsRoot = path.join(pluginsDir, 'plugins');
-for (const name of readdirSync(pluginsRoot)) {
- const dir = path.join(pluginsRoot, name);
+for (const name of readdirSync(pluginsDir)) {
+ const dir = path.join(pluginsDir, name);
if (name.startsWith('.')) continue;
+ console.log('Building plugin', dir);
+ execSync('npm run build', { cwd: dir });
const destDir = path.join(__dirname, '../src-tauri/vendored/plugins/', name);
console.log(`Copying ${name} to ${destDir}`);
cpSync(path.join(dir, 'package.json'), path.join(destDir, 'package.json'));
diff --git a/src-tauri/.gitignore b/src-tauri/.gitignore
index ecaa84b9..69bebf61 100644
--- a/src-tauri/.gitignore
+++ b/src-tauri/.gitignore
@@ -3,7 +3,6 @@
target/
vendored/*
-!vendored/plugins
gen/*
diff --git a/src-tauri/vendored/plugins/auth-basic/build/index.js b/src-tauri/vendored/plugins/auth-basic/build/index.js
deleted file mode 100644
index a0ea83b1..00000000
--- a/src-tauri/vendored/plugins/auth-basic/build/index.js
+++ /dev/null
@@ -1,53 +0,0 @@
-"use strict";
-var __defProp = Object.defineProperty;
-var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
-var __getOwnPropNames = Object.getOwnPropertyNames;
-var __hasOwnProp = Object.prototype.hasOwnProperty;
-var __export = (target, all) => {
- for (var name in all)
- __defProp(target, name, { get: all[name], enumerable: true });
-};
-var __copyProps = (to, from, except, desc) => {
- if (from && typeof from === "object" || typeof from === "function") {
- for (let key of __getOwnPropNames(from))
- if (!__hasOwnProp.call(to, key) && key !== except)
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
- }
- return to;
-};
-var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
-
-// src/index.ts
-var src_exports = {};
-__export(src_exports, {
- plugin: () => plugin
-});
-module.exports = __toCommonJS(src_exports);
-var plugin = {
- authentication: {
- name: "basic",
- label: "Basic Auth",
- shortLabel: "Basic",
- args: [{
- type: "text",
- name: "username",
- label: "Username",
- optional: true
- }, {
- type: "text",
- name: "password",
- label: "Password",
- optional: true,
- password: true
- }],
- async onApply(_ctx, { values }) {
- const { username, password } = values;
- const value = "Basic " + Buffer.from(`${username}:${password}`).toString("base64");
- return { setHeaders: [{ name: "Authorization", value }] };
- }
- }
-};
-// Annotate the CommonJS export names for ESM import in node:
-0 && (module.exports = {
- plugin
-});
diff --git a/src-tauri/vendored/plugins/auth-bearer/build/index.js b/src-tauri/vendored/plugins/auth-bearer/build/index.js
deleted file mode 100644
index 9604c9b1..00000000
--- a/src-tauri/vendored/plugins/auth-bearer/build/index.js
+++ /dev/null
@@ -1,48 +0,0 @@
-"use strict";
-var __defProp = Object.defineProperty;
-var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
-var __getOwnPropNames = Object.getOwnPropertyNames;
-var __hasOwnProp = Object.prototype.hasOwnProperty;
-var __export = (target, all) => {
- for (var name in all)
- __defProp(target, name, { get: all[name], enumerable: true });
-};
-var __copyProps = (to, from, except, desc) => {
- if (from && typeof from === "object" || typeof from === "function") {
- for (let key of __getOwnPropNames(from))
- if (!__hasOwnProp.call(to, key) && key !== except)
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
- }
- return to;
-};
-var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
-
-// src/index.ts
-var src_exports = {};
-__export(src_exports, {
- plugin: () => plugin
-});
-module.exports = __toCommonJS(src_exports);
-var plugin = {
- authentication: {
- name: "bearer",
- label: "Bearer Token",
- shortLabel: "Bearer",
- args: [{
- type: "text",
- name: "token",
- label: "Token",
- optional: true,
- password: true
- }],
- async onApply(_ctx, { values }) {
- const { token } = values;
- const value = `Bearer ${token}`.trim();
- return { setHeaders: [{ name: "Authorization", value }] };
- }
- }
-};
-// Annotate the CommonJS export names for ESM import in node:
-0 && (module.exports = {
- plugin
-});
diff --git a/src-tauri/vendored/plugins/auth-jwt/build/index.js b/src-tauri/vendored/plugins/auth-jwt/build/index.js
deleted file mode 100644
index 42955a52..00000000
--- a/src-tauri/vendored/plugins/auth-jwt/build/index.js
+++ /dev/null
@@ -1,3881 +0,0 @@
-"use strict";
-var __create = Object.create;
-var __defProp = Object.defineProperty;
-var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
-var __getOwnPropNames = Object.getOwnPropertyNames;
-var __getProtoOf = Object.getPrototypeOf;
-var __hasOwnProp = Object.prototype.hasOwnProperty;
-var __commonJS = (cb, mod) => function __require() {
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
-};
-var __export = (target, all) => {
- for (var name in all)
- __defProp(target, name, { get: all[name], enumerable: true });
-};
-var __copyProps = (to, from, except, desc) => {
- if (from && typeof from === "object" || typeof from === "function") {
- for (let key of __getOwnPropNames(from))
- if (!__hasOwnProp.call(to, key) && key !== except)
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
- }
- return to;
-};
-var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
- // If the importer is in node compatibility mode or this is not an ESM
- // file that has been converted to a CommonJS file using a Babel-
- // compatible transform (i.e. "__esModule" has not been set), then set
- // "default" to the CommonJS "module.exports" for node compatibility.
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
- mod
-));
-var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
-
-// ../../node_modules/safe-buffer/index.js
-var require_safe_buffer = __commonJS({
- "../../node_modules/safe-buffer/index.js"(exports2, module2) {
- var buffer = require("buffer");
- var Buffer2 = buffer.Buffer;
- function copyProps(src, dst) {
- for (var key in src) {
- dst[key] = src[key];
- }
- }
- if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
- module2.exports = buffer;
- } else {
- copyProps(buffer, exports2);
- exports2.Buffer = SafeBuffer;
- }
- function SafeBuffer(arg, encodingOrOffset, length) {
- return Buffer2(arg, encodingOrOffset, length);
- }
- SafeBuffer.prototype = Object.create(Buffer2.prototype);
- copyProps(Buffer2, SafeBuffer);
- SafeBuffer.from = function(arg, encodingOrOffset, length) {
- if (typeof arg === "number") {
- throw new TypeError("Argument must not be a number");
- }
- return Buffer2(arg, encodingOrOffset, length);
- };
- SafeBuffer.alloc = function(size, fill, encoding) {
- if (typeof size !== "number") {
- throw new TypeError("Argument must be a number");
- }
- var buf = Buffer2(size);
- if (fill !== void 0) {
- if (typeof encoding === "string") {
- buf.fill(fill, encoding);
- } else {
- buf.fill(fill);
- }
- } else {
- buf.fill(0);
- }
- return buf;
- };
- SafeBuffer.allocUnsafe = function(size) {
- if (typeof size !== "number") {
- throw new TypeError("Argument must be a number");
- }
- return Buffer2(size);
- };
- SafeBuffer.allocUnsafeSlow = function(size) {
- if (typeof size !== "number") {
- throw new TypeError("Argument must be a number");
- }
- return buffer.SlowBuffer(size);
- };
- }
-});
-
-// ../../node_modules/jws/lib/data-stream.js
-var require_data_stream = __commonJS({
- "../../node_modules/jws/lib/data-stream.js"(exports2, module2) {
- var Buffer2 = require_safe_buffer().Buffer;
- var Stream = require("stream");
- var util = require("util");
- function DataStream(data) {
- this.buffer = null;
- this.writable = true;
- this.readable = true;
- if (!data) {
- this.buffer = Buffer2.alloc(0);
- return this;
- }
- if (typeof data.pipe === "function") {
- this.buffer = Buffer2.alloc(0);
- data.pipe(this);
- return this;
- }
- if (data.length || typeof data === "object") {
- this.buffer = data;
- this.writable = false;
- process.nextTick(function() {
- this.emit("end", data);
- this.readable = false;
- this.emit("close");
- }.bind(this));
- return this;
- }
- throw new TypeError("Unexpected data type (" + typeof data + ")");
- }
- util.inherits(DataStream, Stream);
- DataStream.prototype.write = function write(data) {
- this.buffer = Buffer2.concat([this.buffer, Buffer2.from(data)]);
- this.emit("data", data);
- };
- DataStream.prototype.end = function end(data) {
- if (data)
- this.write(data);
- this.emit("end", data);
- this.emit("close");
- this.writable = false;
- this.readable = false;
- };
- module2.exports = DataStream;
- }
-});
-
-// ../../node_modules/buffer-equal-constant-time/index.js
-var require_buffer_equal_constant_time = __commonJS({
- "../../node_modules/buffer-equal-constant-time/index.js"(exports2, module2) {
- "use strict";
- var Buffer2 = require("buffer").Buffer;
- var SlowBuffer = require("buffer").SlowBuffer;
- module2.exports = bufferEq;
- function bufferEq(a, b) {
- if (!Buffer2.isBuffer(a) || !Buffer2.isBuffer(b)) {
- return false;
- }
- if (a.length !== b.length) {
- return false;
- }
- var c = 0;
- for (var i = 0; i < a.length; i++) {
- c |= a[i] ^ b[i];
- }
- return c === 0;
- }
- bufferEq.install = function() {
- Buffer2.prototype.equal = SlowBuffer.prototype.equal = function equal(that) {
- return bufferEq(this, that);
- };
- };
- var origBufEqual = Buffer2.prototype.equal;
- var origSlowBufEqual = SlowBuffer.prototype.equal;
- bufferEq.restore = function() {
- Buffer2.prototype.equal = origBufEqual;
- SlowBuffer.prototype.equal = origSlowBufEqual;
- };
- }
-});
-
-// ../../node_modules/ecdsa-sig-formatter/src/param-bytes-for-alg.js
-var require_param_bytes_for_alg = __commonJS({
- "../../node_modules/ecdsa-sig-formatter/src/param-bytes-for-alg.js"(exports2, module2) {
- "use strict";
- function getParamSize(keySize) {
- var result = (keySize / 8 | 0) + (keySize % 8 === 0 ? 0 : 1);
- return result;
- }
- var paramBytesForAlg = {
- ES256: getParamSize(256),
- ES384: getParamSize(384),
- ES512: getParamSize(521)
- };
- function getParamBytesForAlg(alg) {
- var paramBytes = paramBytesForAlg[alg];
- if (paramBytes) {
- return paramBytes;
- }
- throw new Error('Unknown algorithm "' + alg + '"');
- }
- module2.exports = getParamBytesForAlg;
- }
-});
-
-// ../../node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.js
-var require_ecdsa_sig_formatter = __commonJS({
- "../../node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.js"(exports2, module2) {
- "use strict";
- var Buffer2 = require_safe_buffer().Buffer;
- var getParamBytesForAlg = require_param_bytes_for_alg();
- var MAX_OCTET = 128;
- var CLASS_UNIVERSAL = 0;
- var PRIMITIVE_BIT = 32;
- var TAG_SEQ = 16;
- var TAG_INT = 2;
- var ENCODED_TAG_SEQ = TAG_SEQ | PRIMITIVE_BIT | CLASS_UNIVERSAL << 6;
- var ENCODED_TAG_INT = TAG_INT | CLASS_UNIVERSAL << 6;
- function base64Url(base64) {
- return base64.replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
- }
- function signatureAsBuffer(signature) {
- if (Buffer2.isBuffer(signature)) {
- return signature;
- } else if ("string" === typeof signature) {
- return Buffer2.from(signature, "base64");
- }
- throw new TypeError("ECDSA signature must be a Base64 string or a Buffer");
- }
- function derToJose(signature, alg) {
- signature = signatureAsBuffer(signature);
- var paramBytes = getParamBytesForAlg(alg);
- var maxEncodedParamLength = paramBytes + 1;
- var inputLength = signature.length;
- var offset = 0;
- if (signature[offset++] !== ENCODED_TAG_SEQ) {
- throw new Error('Could not find expected "seq"');
- }
- var seqLength = signature[offset++];
- if (seqLength === (MAX_OCTET | 1)) {
- seqLength = signature[offset++];
- }
- if (inputLength - offset < seqLength) {
- throw new Error('"seq" specified length of "' + seqLength + '", only "' + (inputLength - offset) + '" remaining');
- }
- if (signature[offset++] !== ENCODED_TAG_INT) {
- throw new Error('Could not find expected "int" for "r"');
- }
- var rLength = signature[offset++];
- if (inputLength - offset - 2 < rLength) {
- throw new Error('"r" specified length of "' + rLength + '", only "' + (inputLength - offset - 2) + '" available');
- }
- if (maxEncodedParamLength < rLength) {
- throw new Error('"r" specified length of "' + rLength + '", max of "' + maxEncodedParamLength + '" is acceptable');
- }
- var rOffset = offset;
- offset += rLength;
- if (signature[offset++] !== ENCODED_TAG_INT) {
- throw new Error('Could not find expected "int" for "s"');
- }
- var sLength = signature[offset++];
- if (inputLength - offset !== sLength) {
- throw new Error('"s" specified length of "' + sLength + '", expected "' + (inputLength - offset) + '"');
- }
- if (maxEncodedParamLength < sLength) {
- throw new Error('"s" specified length of "' + sLength + '", max of "' + maxEncodedParamLength + '" is acceptable');
- }
- var sOffset = offset;
- offset += sLength;
- if (offset !== inputLength) {
- throw new Error('Expected to consume entire buffer, but "' + (inputLength - offset) + '" bytes remain');
- }
- var rPadding = paramBytes - rLength, sPadding = paramBytes - sLength;
- var dst = Buffer2.allocUnsafe(rPadding + rLength + sPadding + sLength);
- for (offset = 0; offset < rPadding; ++offset) {
- dst[offset] = 0;
- }
- signature.copy(dst, offset, rOffset + Math.max(-rPadding, 0), rOffset + rLength);
- offset = paramBytes;
- for (var o = offset; offset < o + sPadding; ++offset) {
- dst[offset] = 0;
- }
- signature.copy(dst, offset, sOffset + Math.max(-sPadding, 0), sOffset + sLength);
- dst = dst.toString("base64");
- dst = base64Url(dst);
- return dst;
- }
- function countPadding(buf, start, stop) {
- var padding = 0;
- while (start + padding < stop && buf[start + padding] === 0) {
- ++padding;
- }
- var needsSign = buf[start + padding] >= MAX_OCTET;
- if (needsSign) {
- --padding;
- }
- return padding;
- }
- function joseToDer(signature, alg) {
- signature = signatureAsBuffer(signature);
- var paramBytes = getParamBytesForAlg(alg);
- var signatureBytes = signature.length;
- if (signatureBytes !== paramBytes * 2) {
- throw new TypeError('"' + alg + '" signatures must be "' + paramBytes * 2 + '" bytes, saw "' + signatureBytes + '"');
- }
- var rPadding = countPadding(signature, 0, paramBytes);
- var sPadding = countPadding(signature, paramBytes, signature.length);
- var rLength = paramBytes - rPadding;
- var sLength = paramBytes - sPadding;
- var rsBytes = 1 + 1 + rLength + 1 + 1 + sLength;
- var shortLength = rsBytes < MAX_OCTET;
- var dst = Buffer2.allocUnsafe((shortLength ? 2 : 3) + rsBytes);
- var offset = 0;
- dst[offset++] = ENCODED_TAG_SEQ;
- if (shortLength) {
- dst[offset++] = rsBytes;
- } else {
- dst[offset++] = MAX_OCTET | 1;
- dst[offset++] = rsBytes & 255;
- }
- dst[offset++] = ENCODED_TAG_INT;
- dst[offset++] = rLength;
- if (rPadding < 0) {
- dst[offset++] = 0;
- offset += signature.copy(dst, offset, 0, paramBytes);
- } else {
- offset += signature.copy(dst, offset, rPadding, paramBytes);
- }
- dst[offset++] = ENCODED_TAG_INT;
- dst[offset++] = sLength;
- if (sPadding < 0) {
- dst[offset++] = 0;
- signature.copy(dst, offset, paramBytes);
- } else {
- signature.copy(dst, offset, paramBytes + sPadding);
- }
- return dst;
- }
- module2.exports = {
- derToJose,
- joseToDer
- };
- }
-});
-
-// ../../node_modules/jwa/index.js
-var require_jwa = __commonJS({
- "../../node_modules/jwa/index.js"(exports2, module2) {
- var bufferEqual = require_buffer_equal_constant_time();
- var Buffer2 = require_safe_buffer().Buffer;
- var crypto = require("crypto");
- var formatEcdsa = require_ecdsa_sig_formatter();
- var util = require("util");
- var MSG_INVALID_ALGORITHM = '"%s" is not a valid algorithm.\n Supported algorithms are:\n "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".';
- var MSG_INVALID_SECRET = "secret must be a string or buffer";
- var MSG_INVALID_VERIFIER_KEY = "key must be a string or a buffer";
- var MSG_INVALID_SIGNER_KEY = "key must be a string, a buffer or an object";
- var supportsKeyObjects = typeof crypto.createPublicKey === "function";
- if (supportsKeyObjects) {
- MSG_INVALID_VERIFIER_KEY += " or a KeyObject";
- MSG_INVALID_SECRET += "or a KeyObject";
- }
- function checkIsPublicKey(key) {
- if (Buffer2.isBuffer(key)) {
- return;
- }
- if (typeof key === "string") {
- return;
- }
- if (!supportsKeyObjects) {
- throw typeError(MSG_INVALID_VERIFIER_KEY);
- }
- if (typeof key !== "object") {
- throw typeError(MSG_INVALID_VERIFIER_KEY);
- }
- if (typeof key.type !== "string") {
- throw typeError(MSG_INVALID_VERIFIER_KEY);
- }
- if (typeof key.asymmetricKeyType !== "string") {
- throw typeError(MSG_INVALID_VERIFIER_KEY);
- }
- if (typeof key.export !== "function") {
- throw typeError(MSG_INVALID_VERIFIER_KEY);
- }
- }
- function checkIsPrivateKey(key) {
- if (Buffer2.isBuffer(key)) {
- return;
- }
- if (typeof key === "string") {
- return;
- }
- if (typeof key === "object") {
- return;
- }
- throw typeError(MSG_INVALID_SIGNER_KEY);
- }
- function checkIsSecretKey(key) {
- if (Buffer2.isBuffer(key)) {
- return;
- }
- if (typeof key === "string") {
- return key;
- }
- if (!supportsKeyObjects) {
- throw typeError(MSG_INVALID_SECRET);
- }
- if (typeof key !== "object") {
- throw typeError(MSG_INVALID_SECRET);
- }
- if (key.type !== "secret") {
- throw typeError(MSG_INVALID_SECRET);
- }
- if (typeof key.export !== "function") {
- throw typeError(MSG_INVALID_SECRET);
- }
- }
- function fromBase64(base64) {
- return base64.replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
- }
- function toBase64(base64url) {
- base64url = base64url.toString();
- var padding = 4 - base64url.length % 4;
- if (padding !== 4) {
- for (var i = 0; i < padding; ++i) {
- base64url += "=";
- }
- }
- return base64url.replace(/\-/g, "+").replace(/_/g, "/");
- }
- function typeError(template) {
- var args = [].slice.call(arguments, 1);
- var errMsg = util.format.bind(util, template).apply(null, args);
- return new TypeError(errMsg);
- }
- function bufferOrString(obj) {
- return Buffer2.isBuffer(obj) || typeof obj === "string";
- }
- function normalizeInput(thing) {
- if (!bufferOrString(thing))
- thing = JSON.stringify(thing);
- return thing;
- }
- function createHmacSigner(bits) {
- return function sign(thing, secret) {
- checkIsSecretKey(secret);
- thing = normalizeInput(thing);
- var hmac = crypto.createHmac("sha" + bits, secret);
- var sig = (hmac.update(thing), hmac.digest("base64"));
- return fromBase64(sig);
- };
- }
- function createHmacVerifier(bits) {
- return function verify(thing, signature, secret) {
- var computedSig = createHmacSigner(bits)(thing, secret);
- return bufferEqual(Buffer2.from(signature), Buffer2.from(computedSig));
- };
- }
- function createKeySigner(bits) {
- return function sign(thing, privateKey) {
- checkIsPrivateKey(privateKey);
- thing = normalizeInput(thing);
- var signer = crypto.createSign("RSA-SHA" + bits);
- var sig = (signer.update(thing), signer.sign(privateKey, "base64"));
- return fromBase64(sig);
- };
- }
- function createKeyVerifier(bits) {
- return function verify(thing, signature, publicKey) {
- checkIsPublicKey(publicKey);
- thing = normalizeInput(thing);
- signature = toBase64(signature);
- var verifier = crypto.createVerify("RSA-SHA" + bits);
- verifier.update(thing);
- return verifier.verify(publicKey, signature, "base64");
- };
- }
- function createPSSKeySigner(bits) {
- return function sign(thing, privateKey) {
- checkIsPrivateKey(privateKey);
- thing = normalizeInput(thing);
- var signer = crypto.createSign("RSA-SHA" + bits);
- var sig = (signer.update(thing), signer.sign({
- key: privateKey,
- padding: crypto.constants.RSA_PKCS1_PSS_PADDING,
- saltLength: crypto.constants.RSA_PSS_SALTLEN_DIGEST
- }, "base64"));
- return fromBase64(sig);
- };
- }
- function createPSSKeyVerifier(bits) {
- return function verify(thing, signature, publicKey) {
- checkIsPublicKey(publicKey);
- thing = normalizeInput(thing);
- signature = toBase64(signature);
- var verifier = crypto.createVerify("RSA-SHA" + bits);
- verifier.update(thing);
- return verifier.verify({
- key: publicKey,
- padding: crypto.constants.RSA_PKCS1_PSS_PADDING,
- saltLength: crypto.constants.RSA_PSS_SALTLEN_DIGEST
- }, signature, "base64");
- };
- }
- function createECDSASigner(bits) {
- var inner = createKeySigner(bits);
- return function sign() {
- var signature = inner.apply(null, arguments);
- signature = formatEcdsa.derToJose(signature, "ES" + bits);
- return signature;
- };
- }
- function createECDSAVerifer(bits) {
- var inner = createKeyVerifier(bits);
- return function verify(thing, signature, publicKey) {
- signature = formatEcdsa.joseToDer(signature, "ES" + bits).toString("base64");
- var result = inner(thing, signature, publicKey);
- return result;
- };
- }
- function createNoneSigner() {
- return function sign() {
- return "";
- };
- }
- function createNoneVerifier() {
- return function verify(thing, signature) {
- return signature === "";
- };
- }
- module2.exports = function jwa(algorithm) {
- var signerFactories = {
- hs: createHmacSigner,
- rs: createKeySigner,
- ps: createPSSKeySigner,
- es: createECDSASigner,
- none: createNoneSigner
- };
- var verifierFactories = {
- hs: createHmacVerifier,
- rs: createKeyVerifier,
- ps: createPSSKeyVerifier,
- es: createECDSAVerifer,
- none: createNoneVerifier
- };
- var match = algorithm.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/i);
- if (!match)
- throw typeError(MSG_INVALID_ALGORITHM, algorithm);
- var algo = (match[1] || match[3]).toLowerCase();
- var bits = match[2];
- return {
- sign: signerFactories[algo](bits),
- verify: verifierFactories[algo](bits)
- };
- };
- }
-});
-
-// ../../node_modules/jws/lib/tostring.js
-var require_tostring = __commonJS({
- "../../node_modules/jws/lib/tostring.js"(exports2, module2) {
- var Buffer2 = require("buffer").Buffer;
- module2.exports = function toString(obj) {
- if (typeof obj === "string")
- return obj;
- if (typeof obj === "number" || Buffer2.isBuffer(obj))
- return obj.toString();
- return JSON.stringify(obj);
- };
- }
-});
-
-// ../../node_modules/jws/lib/sign-stream.js
-var require_sign_stream = __commonJS({
- "../../node_modules/jws/lib/sign-stream.js"(exports2, module2) {
- var Buffer2 = require_safe_buffer().Buffer;
- var DataStream = require_data_stream();
- var jwa = require_jwa();
- var Stream = require("stream");
- var toString = require_tostring();
- var util = require("util");
- function base64url(string, encoding) {
- return Buffer2.from(string, encoding).toString("base64").replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
- }
- function jwsSecuredInput(header, payload, encoding) {
- encoding = encoding || "utf8";
- var encodedHeader = base64url(toString(header), "binary");
- var encodedPayload = base64url(toString(payload), encoding);
- return util.format("%s.%s", encodedHeader, encodedPayload);
- }
- function jwsSign(opts) {
- var header = opts.header;
- var payload = opts.payload;
- var secretOrKey = opts.secret || opts.privateKey;
- var encoding = opts.encoding;
- var algo = jwa(header.alg);
- var securedInput = jwsSecuredInput(header, payload, encoding);
- var signature = algo.sign(securedInput, secretOrKey);
- return util.format("%s.%s", securedInput, signature);
- }
- function SignStream(opts) {
- var secret = opts.secret || opts.privateKey || opts.key;
- var secretStream = new DataStream(secret);
- this.readable = true;
- this.header = opts.header;
- this.encoding = opts.encoding;
- this.secret = this.privateKey = this.key = secretStream;
- this.payload = new DataStream(opts.payload);
- this.secret.once("close", function() {
- if (!this.payload.writable && this.readable)
- this.sign();
- }.bind(this));
- this.payload.once("close", function() {
- if (!this.secret.writable && this.readable)
- this.sign();
- }.bind(this));
- }
- util.inherits(SignStream, Stream);
- SignStream.prototype.sign = function sign() {
- try {
- var signature = jwsSign({
- header: this.header,
- payload: this.payload.buffer,
- secret: this.secret.buffer,
- encoding: this.encoding
- });
- this.emit("done", signature);
- this.emit("data", signature);
- this.emit("end");
- this.readable = false;
- return signature;
- } catch (e) {
- this.readable = false;
- this.emit("error", e);
- this.emit("close");
- }
- };
- SignStream.sign = jwsSign;
- module2.exports = SignStream;
- }
-});
-
-// ../../node_modules/jws/lib/verify-stream.js
-var require_verify_stream = __commonJS({
- "../../node_modules/jws/lib/verify-stream.js"(exports2, module2) {
- var Buffer2 = require_safe_buffer().Buffer;
- var DataStream = require_data_stream();
- var jwa = require_jwa();
- var Stream = require("stream");
- var toString = require_tostring();
- var util = require("util");
- var JWS_REGEX = /^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;
- function isObject(thing) {
- return Object.prototype.toString.call(thing) === "[object Object]";
- }
- function safeJsonParse(thing) {
- if (isObject(thing))
- return thing;
- try {
- return JSON.parse(thing);
- } catch (e) {
- return void 0;
- }
- }
- function headerFromJWS(jwsSig) {
- var encodedHeader = jwsSig.split(".", 1)[0];
- return safeJsonParse(Buffer2.from(encodedHeader, "base64").toString("binary"));
- }
- function securedInputFromJWS(jwsSig) {
- return jwsSig.split(".", 2).join(".");
- }
- function signatureFromJWS(jwsSig) {
- return jwsSig.split(".")[2];
- }
- function payloadFromJWS(jwsSig, encoding) {
- encoding = encoding || "utf8";
- var payload = jwsSig.split(".")[1];
- return Buffer2.from(payload, "base64").toString(encoding);
- }
- function isValidJws(string) {
- return JWS_REGEX.test(string) && !!headerFromJWS(string);
- }
- function jwsVerify(jwsSig, algorithm, secretOrKey) {
- if (!algorithm) {
- var err = new Error("Missing algorithm parameter for jws.verify");
- err.code = "MISSING_ALGORITHM";
- throw err;
- }
- jwsSig = toString(jwsSig);
- var signature = signatureFromJWS(jwsSig);
- var securedInput = securedInputFromJWS(jwsSig);
- var algo = jwa(algorithm);
- return algo.verify(securedInput, signature, secretOrKey);
- }
- function jwsDecode(jwsSig, opts) {
- opts = opts || {};
- jwsSig = toString(jwsSig);
- if (!isValidJws(jwsSig))
- return null;
- var header = headerFromJWS(jwsSig);
- if (!header)
- return null;
- var payload = payloadFromJWS(jwsSig);
- if (header.typ === "JWT" || opts.json)
- payload = JSON.parse(payload, opts.encoding);
- return {
- header,
- payload,
- signature: signatureFromJWS(jwsSig)
- };
- }
- function VerifyStream(opts) {
- opts = opts || {};
- var secretOrKey = opts.secret || opts.publicKey || opts.key;
- var secretStream = new DataStream(secretOrKey);
- this.readable = true;
- this.algorithm = opts.algorithm;
- this.encoding = opts.encoding;
- this.secret = this.publicKey = this.key = secretStream;
- this.signature = new DataStream(opts.signature);
- this.secret.once("close", function() {
- if (!this.signature.writable && this.readable)
- this.verify();
- }.bind(this));
- this.signature.once("close", function() {
- if (!this.secret.writable && this.readable)
- this.verify();
- }.bind(this));
- }
- util.inherits(VerifyStream, Stream);
- VerifyStream.prototype.verify = function verify() {
- try {
- var valid = jwsVerify(this.signature.buffer, this.algorithm, this.key.buffer);
- var obj = jwsDecode(this.signature.buffer, this.encoding);
- this.emit("done", valid, obj);
- this.emit("data", valid);
- this.emit("end");
- this.readable = false;
- return valid;
- } catch (e) {
- this.readable = false;
- this.emit("error", e);
- this.emit("close");
- }
- };
- VerifyStream.decode = jwsDecode;
- VerifyStream.isValid = isValidJws;
- VerifyStream.verify = jwsVerify;
- module2.exports = VerifyStream;
- }
-});
-
-// ../../node_modules/jws/index.js
-var require_jws = __commonJS({
- "../../node_modules/jws/index.js"(exports2) {
- var SignStream = require_sign_stream();
- var VerifyStream = require_verify_stream();
- var ALGORITHMS = [
- "HS256",
- "HS384",
- "HS512",
- "RS256",
- "RS384",
- "RS512",
- "PS256",
- "PS384",
- "PS512",
- "ES256",
- "ES384",
- "ES512"
- ];
- exports2.ALGORITHMS = ALGORITHMS;
- exports2.sign = SignStream.sign;
- exports2.verify = VerifyStream.verify;
- exports2.decode = VerifyStream.decode;
- exports2.isValid = VerifyStream.isValid;
- exports2.createSign = function createSign(opts) {
- return new SignStream(opts);
- };
- exports2.createVerify = function createVerify(opts) {
- return new VerifyStream(opts);
- };
- }
-});
-
-// ../../node_modules/jsonwebtoken/decode.js
-var require_decode = __commonJS({
- "../../node_modules/jsonwebtoken/decode.js"(exports2, module2) {
- var jws = require_jws();
- module2.exports = function(jwt2, options) {
- options = options || {};
- var decoded = jws.decode(jwt2, options);
- if (!decoded) {
- return null;
- }
- var payload = decoded.payload;
- if (typeof payload === "string") {
- try {
- var obj = JSON.parse(payload);
- if (obj !== null && typeof obj === "object") {
- payload = obj;
- }
- } catch (e) {
- }
- }
- if (options.complete === true) {
- return {
- header: decoded.header,
- payload,
- signature: decoded.signature
- };
- }
- return payload;
- };
- }
-});
-
-// ../../node_modules/jsonwebtoken/lib/JsonWebTokenError.js
-var require_JsonWebTokenError = __commonJS({
- "../../node_modules/jsonwebtoken/lib/JsonWebTokenError.js"(exports2, module2) {
- var JsonWebTokenError = function(message, error) {
- Error.call(this, message);
- if (Error.captureStackTrace) {
- Error.captureStackTrace(this, this.constructor);
- }
- this.name = "JsonWebTokenError";
- this.message = message;
- if (error) this.inner = error;
- };
- JsonWebTokenError.prototype = Object.create(Error.prototype);
- JsonWebTokenError.prototype.constructor = JsonWebTokenError;
- module2.exports = JsonWebTokenError;
- }
-});
-
-// ../../node_modules/jsonwebtoken/lib/NotBeforeError.js
-var require_NotBeforeError = __commonJS({
- "../../node_modules/jsonwebtoken/lib/NotBeforeError.js"(exports2, module2) {
- var JsonWebTokenError = require_JsonWebTokenError();
- var NotBeforeError = function(message, date) {
- JsonWebTokenError.call(this, message);
- this.name = "NotBeforeError";
- this.date = date;
- };
- NotBeforeError.prototype = Object.create(JsonWebTokenError.prototype);
- NotBeforeError.prototype.constructor = NotBeforeError;
- module2.exports = NotBeforeError;
- }
-});
-
-// ../../node_modules/jsonwebtoken/lib/TokenExpiredError.js
-var require_TokenExpiredError = __commonJS({
- "../../node_modules/jsonwebtoken/lib/TokenExpiredError.js"(exports2, module2) {
- var JsonWebTokenError = require_JsonWebTokenError();
- var TokenExpiredError = function(message, expiredAt) {
- JsonWebTokenError.call(this, message);
- this.name = "TokenExpiredError";
- this.expiredAt = expiredAt;
- };
- TokenExpiredError.prototype = Object.create(JsonWebTokenError.prototype);
- TokenExpiredError.prototype.constructor = TokenExpiredError;
- module2.exports = TokenExpiredError;
- }
-});
-
-// ../../node_modules/ms/index.js
-var require_ms = __commonJS({
- "../../node_modules/ms/index.js"(exports2, module2) {
- var s = 1e3;
- var m = s * 60;
- var h = m * 60;
- var d = h * 24;
- var w = d * 7;
- var y = d * 365.25;
- module2.exports = function(val, options) {
- options = options || {};
- var type = typeof val;
- if (type === "string" && val.length > 0) {
- return parse(val);
- } else if (type === "number" && isFinite(val)) {
- return options.long ? fmtLong(val) : fmtShort(val);
- }
- throw new Error(
- "val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
- );
- };
- function parse(str) {
- str = String(str);
- if (str.length > 100) {
- return;
- }
- var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
- str
- );
- if (!match) {
- return;
- }
- var n = parseFloat(match[1]);
- var type = (match[2] || "ms").toLowerCase();
- switch (type) {
- case "years":
- case "year":
- case "yrs":
- case "yr":
- case "y":
- return n * y;
- case "weeks":
- case "week":
- case "w":
- return n * w;
- case "days":
- case "day":
- case "d":
- return n * d;
- case "hours":
- case "hour":
- case "hrs":
- case "hr":
- case "h":
- return n * h;
- case "minutes":
- case "minute":
- case "mins":
- case "min":
- case "m":
- return n * m;
- case "seconds":
- case "second":
- case "secs":
- case "sec":
- case "s":
- return n * s;
- case "milliseconds":
- case "millisecond":
- case "msecs":
- case "msec":
- case "ms":
- return n;
- default:
- return void 0;
- }
- }
- function fmtShort(ms) {
- var msAbs = Math.abs(ms);
- if (msAbs >= d) {
- return Math.round(ms / d) + "d";
- }
- if (msAbs >= h) {
- return Math.round(ms / h) + "h";
- }
- if (msAbs >= m) {
- return Math.round(ms / m) + "m";
- }
- if (msAbs >= s) {
- return Math.round(ms / s) + "s";
- }
- return ms + "ms";
- }
- function fmtLong(ms) {
- var msAbs = Math.abs(ms);
- if (msAbs >= d) {
- return plural(ms, msAbs, d, "day");
- }
- if (msAbs >= h) {
- return plural(ms, msAbs, h, "hour");
- }
- if (msAbs >= m) {
- return plural(ms, msAbs, m, "minute");
- }
- if (msAbs >= s) {
- return plural(ms, msAbs, s, "second");
- }
- return ms + " ms";
- }
- function plural(ms, msAbs, n, name) {
- var isPlural = msAbs >= n * 1.5;
- return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
- }
- }
-});
-
-// ../../node_modules/jsonwebtoken/lib/timespan.js
-var require_timespan = __commonJS({
- "../../node_modules/jsonwebtoken/lib/timespan.js"(exports2, module2) {
- var ms = require_ms();
- module2.exports = function(time, iat) {
- var timestamp = iat || Math.floor(Date.now() / 1e3);
- if (typeof time === "string") {
- var milliseconds = ms(time);
- if (typeof milliseconds === "undefined") {
- return;
- }
- return Math.floor(timestamp + milliseconds / 1e3);
- } else if (typeof time === "number") {
- return timestamp + time;
- } else {
- return;
- }
- };
- }
-});
-
-// ../../node_modules/semver/internal/constants.js
-var require_constants = __commonJS({
- "../../node_modules/semver/internal/constants.js"(exports2, module2) {
- var SEMVER_SPEC_VERSION = "2.0.0";
- var MAX_LENGTH = 256;
- var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
- 9007199254740991;
- var MAX_SAFE_COMPONENT_LENGTH = 16;
- var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
- var RELEASE_TYPES = [
- "major",
- "premajor",
- "minor",
- "preminor",
- "patch",
- "prepatch",
- "prerelease"
- ];
- module2.exports = {
- MAX_LENGTH,
- MAX_SAFE_COMPONENT_LENGTH,
- MAX_SAFE_BUILD_LENGTH,
- MAX_SAFE_INTEGER,
- RELEASE_TYPES,
- SEMVER_SPEC_VERSION,
- FLAG_INCLUDE_PRERELEASE: 1,
- FLAG_LOOSE: 2
- };
- }
-});
-
-// ../../node_modules/semver/internal/debug.js
-var require_debug = __commonJS({
- "../../node_modules/semver/internal/debug.js"(exports2, module2) {
- var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
- };
- module2.exports = debug;
- }
-});
-
-// ../../node_modules/semver/internal/re.js
-var require_re = __commonJS({
- "../../node_modules/semver/internal/re.js"(exports2, module2) {
- var {
- MAX_SAFE_COMPONENT_LENGTH,
- MAX_SAFE_BUILD_LENGTH,
- MAX_LENGTH
- } = require_constants();
- var debug = require_debug();
- exports2 = module2.exports = {};
- var re = exports2.re = [];
- var safeRe = exports2.safeRe = [];
- var src = exports2.src = [];
- var safeSrc = exports2.safeSrc = [];
- var t = exports2.t = {};
- var R = 0;
- var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
- var safeRegexReplacements = [
- ["\\s", 1],
- ["\\d", MAX_LENGTH],
- [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
- ];
- var makeSafeRegex = (value) => {
- for (const [token, max] of safeRegexReplacements) {
- value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
- }
- return value;
- };
- var createToken = (name, value, isGlobal) => {
- const safe = makeSafeRegex(value);
- const index = R++;
- debug(name, index, value);
- t[name] = index;
- src[index] = value;
- safeSrc[index] = safe;
- re[index] = new RegExp(value, isGlobal ? "g" : void 0);
- safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
- };
- createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
- createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
- createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
- createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
- createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
- createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NUMERICIDENTIFIER]}|${src[t.NONNUMERICIDENTIFIER]})`);
- createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NUMERICIDENTIFIERLOOSE]}|${src[t.NONNUMERICIDENTIFIER]})`);
- createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
- createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
- createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
- createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
- createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
- createToken("FULL", `^${src[t.FULLPLAIN]}$`);
- createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
- createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
- createToken("GTLT", "((?:<|>)?=?)");
- createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
- createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
- createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
- createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
- createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
- createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
- createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
- createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
- createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
- createToken("COERCERTL", src[t.COERCE], true);
- createToken("COERCERTLFULL", src[t.COERCEFULL], true);
- createToken("LONETILDE", "(?:~>?)");
- createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
- exports2.tildeTrimReplace = "$1~";
- createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
- createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
- createToken("LONECARET", "(?:\\^)");
- createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
- exports2.caretTrimReplace = "$1^";
- createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
- createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
- createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
- createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
- createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
- exports2.comparatorTrimReplace = "$1$2$3";
- createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
- createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
- createToken("STAR", "(<|>)?=?\\s*\\*");
- createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
- createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
- }
-});
-
-// ../../node_modules/semver/internal/parse-options.js
-var require_parse_options = __commonJS({
- "../../node_modules/semver/internal/parse-options.js"(exports2, module2) {
- var looseOption = Object.freeze({ loose: true });
- var emptyOpts = Object.freeze({});
- var parseOptions = (options) => {
- if (!options) {
- return emptyOpts;
- }
- if (typeof options !== "object") {
- return looseOption;
- }
- return options;
- };
- module2.exports = parseOptions;
- }
-});
-
-// ../../node_modules/semver/internal/identifiers.js
-var require_identifiers = __commonJS({
- "../../node_modules/semver/internal/identifiers.js"(exports2, module2) {
- var numeric = /^[0-9]+$/;
- var compareIdentifiers = (a, b) => {
- const anum = numeric.test(a);
- const bnum = numeric.test(b);
- if (anum && bnum) {
- a = +a;
- b = +b;
- }
- return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
- };
- var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
- module2.exports = {
- compareIdentifiers,
- rcompareIdentifiers
- };
- }
-});
-
-// ../../node_modules/semver/classes/semver.js
-var require_semver = __commonJS({
- "../../node_modules/semver/classes/semver.js"(exports2, module2) {
- var debug = require_debug();
- var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
- var { safeRe: re, safeSrc: src, t } = require_re();
- var parseOptions = require_parse_options();
- var { compareIdentifiers } = require_identifiers();
- var SemVer = class _SemVer {
- constructor(version, options) {
- options = parseOptions(options);
- if (version instanceof _SemVer) {
- if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
- return version;
- } else {
- version = version.version;
- }
- } else if (typeof version !== "string") {
- throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
- }
- if (version.length > MAX_LENGTH) {
- throw new TypeError(
- `version is longer than ${MAX_LENGTH} characters`
- );
- }
- debug("SemVer", version, options);
- this.options = options;
- this.loose = !!options.loose;
- this.includePrerelease = !!options.includePrerelease;
- const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
- if (!m) {
- throw new TypeError(`Invalid Version: ${version}`);
- }
- this.raw = version;
- this.major = +m[1];
- this.minor = +m[2];
- this.patch = +m[3];
- if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
- throw new TypeError("Invalid major version");
- }
- if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
- throw new TypeError("Invalid minor version");
- }
- if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
- throw new TypeError("Invalid patch version");
- }
- if (!m[4]) {
- this.prerelease = [];
- } else {
- this.prerelease = m[4].split(".").map((id) => {
- if (/^[0-9]+$/.test(id)) {
- const num = +id;
- if (num >= 0 && num < MAX_SAFE_INTEGER) {
- return num;
- }
- }
- return id;
- });
- }
- this.build = m[5] ? m[5].split(".") : [];
- this.format();
- }
- format() {
- this.version = `${this.major}.${this.minor}.${this.patch}`;
- if (this.prerelease.length) {
- this.version += `-${this.prerelease.join(".")}`;
- }
- return this.version;
- }
- toString() {
- return this.version;
- }
- compare(other) {
- debug("SemVer.compare", this.version, this.options, other);
- if (!(other instanceof _SemVer)) {
- if (typeof other === "string" && other === this.version) {
- return 0;
- }
- other = new _SemVer(other, this.options);
- }
- if (other.version === this.version) {
- return 0;
- }
- return this.compareMain(other) || this.comparePre(other);
- }
- compareMain(other) {
- if (!(other instanceof _SemVer)) {
- other = new _SemVer(other, this.options);
- }
- return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
- }
- comparePre(other) {
- if (!(other instanceof _SemVer)) {
- other = new _SemVer(other, this.options);
- }
- if (this.prerelease.length && !other.prerelease.length) {
- return -1;
- } else if (!this.prerelease.length && other.prerelease.length) {
- return 1;
- } else if (!this.prerelease.length && !other.prerelease.length) {
- return 0;
- }
- let i = 0;
- do {
- const a = this.prerelease[i];
- const b = other.prerelease[i];
- debug("prerelease compare", i, a, b);
- if (a === void 0 && b === void 0) {
- return 0;
- } else if (b === void 0) {
- return 1;
- } else if (a === void 0) {
- return -1;
- } else if (a === b) {
- continue;
- } else {
- return compareIdentifiers(a, b);
- }
- } while (++i);
- }
- compareBuild(other) {
- if (!(other instanceof _SemVer)) {
- other = new _SemVer(other, this.options);
- }
- let i = 0;
- do {
- const a = this.build[i];
- const b = other.build[i];
- debug("build compare", i, a, b);
- if (a === void 0 && b === void 0) {
- return 0;
- } else if (b === void 0) {
- return 1;
- } else if (a === void 0) {
- return -1;
- } else if (a === b) {
- continue;
- } else {
- return compareIdentifiers(a, b);
- }
- } while (++i);
- }
- // preminor will bump the version up to the next minor release, and immediately
- // down to pre-release. premajor and prepatch work the same way.
- inc(release, identifier, identifierBase) {
- if (release.startsWith("pre")) {
- if (!identifier && identifierBase === false) {
- throw new Error("invalid increment argument: identifier is empty");
- }
- if (identifier) {
- const r = new RegExp(`^${this.options.loose ? src[t.PRERELEASELOOSE] : src[t.PRERELEASE]}$`);
- const match = `-${identifier}`.match(r);
- if (!match || match[1] !== identifier) {
- throw new Error(`invalid identifier: ${identifier}`);
- }
- }
- }
- switch (release) {
- case "premajor":
- this.prerelease.length = 0;
- this.patch = 0;
- this.minor = 0;
- this.major++;
- this.inc("pre", identifier, identifierBase);
- break;
- case "preminor":
- this.prerelease.length = 0;
- this.patch = 0;
- this.minor++;
- this.inc("pre", identifier, identifierBase);
- break;
- case "prepatch":
- this.prerelease.length = 0;
- this.inc("patch", identifier, identifierBase);
- this.inc("pre", identifier, identifierBase);
- break;
- case "prerelease":
- if (this.prerelease.length === 0) {
- this.inc("patch", identifier, identifierBase);
- }
- this.inc("pre", identifier, identifierBase);
- break;
- case "release":
- if (this.prerelease.length === 0) {
- throw new Error(`version ${this.raw} is not a prerelease`);
- }
- this.prerelease.length = 0;
- break;
- case "major":
- if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
- this.major++;
- }
- this.minor = 0;
- this.patch = 0;
- this.prerelease = [];
- break;
- case "minor":
- if (this.patch !== 0 || this.prerelease.length === 0) {
- this.minor++;
- }
- this.patch = 0;
- this.prerelease = [];
- break;
- case "patch":
- if (this.prerelease.length === 0) {
- this.patch++;
- }
- this.prerelease = [];
- break;
- case "pre": {
- const base = Number(identifierBase) ? 1 : 0;
- if (this.prerelease.length === 0) {
- this.prerelease = [base];
- } else {
- let i = this.prerelease.length;
- while (--i >= 0) {
- if (typeof this.prerelease[i] === "number") {
- this.prerelease[i]++;
- i = -2;
- }
- }
- if (i === -1) {
- if (identifier === this.prerelease.join(".") && identifierBase === false) {
- throw new Error("invalid increment argument: identifier already exists");
- }
- this.prerelease.push(base);
- }
- }
- if (identifier) {
- let prerelease = [identifier, base];
- if (identifierBase === false) {
- prerelease = [identifier];
- }
- if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
- if (isNaN(this.prerelease[1])) {
- this.prerelease = prerelease;
- }
- } else {
- this.prerelease = prerelease;
- }
- }
- break;
- }
- default:
- throw new Error(`invalid increment argument: ${release}`);
- }
- this.raw = this.format();
- if (this.build.length) {
- this.raw += `+${this.build.join(".")}`;
- }
- return this;
- }
- };
- module2.exports = SemVer;
- }
-});
-
-// ../../node_modules/semver/functions/parse.js
-var require_parse = __commonJS({
- "../../node_modules/semver/functions/parse.js"(exports2, module2) {
- var SemVer = require_semver();
- var parse = (version, options, throwErrors = false) => {
- if (version instanceof SemVer) {
- return version;
- }
- try {
- return new SemVer(version, options);
- } catch (er) {
- if (!throwErrors) {
- return null;
- }
- throw er;
- }
- };
- module2.exports = parse;
- }
-});
-
-// ../../node_modules/semver/functions/valid.js
-var require_valid = __commonJS({
- "../../node_modules/semver/functions/valid.js"(exports2, module2) {
- var parse = require_parse();
- var valid = (version, options) => {
- const v = parse(version, options);
- return v ? v.version : null;
- };
- module2.exports = valid;
- }
-});
-
-// ../../node_modules/semver/functions/clean.js
-var require_clean = __commonJS({
- "../../node_modules/semver/functions/clean.js"(exports2, module2) {
- var parse = require_parse();
- var clean = (version, options) => {
- const s = parse(version.trim().replace(/^[=v]+/, ""), options);
- return s ? s.version : null;
- };
- module2.exports = clean;
- }
-});
-
-// ../../node_modules/semver/functions/inc.js
-var require_inc = __commonJS({
- "../../node_modules/semver/functions/inc.js"(exports2, module2) {
- var SemVer = require_semver();
- var inc = (version, release, options, identifier, identifierBase) => {
- if (typeof options === "string") {
- identifierBase = identifier;
- identifier = options;
- options = void 0;
- }
- try {
- return new SemVer(
- version instanceof SemVer ? version.version : version,
- options
- ).inc(release, identifier, identifierBase).version;
- } catch (er) {
- return null;
- }
- };
- module2.exports = inc;
- }
-});
-
-// ../../node_modules/semver/functions/diff.js
-var require_diff = __commonJS({
- "../../node_modules/semver/functions/diff.js"(exports2, module2) {
- var parse = require_parse();
- var diff = (version1, version2) => {
- const v1 = parse(version1, null, true);
- const v2 = parse(version2, null, true);
- const comparison = v1.compare(v2);
- if (comparison === 0) {
- return null;
- }
- const v1Higher = comparison > 0;
- const highVersion = v1Higher ? v1 : v2;
- const lowVersion = v1Higher ? v2 : v1;
- const highHasPre = !!highVersion.prerelease.length;
- const lowHasPre = !!lowVersion.prerelease.length;
- if (lowHasPre && !highHasPre) {
- if (!lowVersion.patch && !lowVersion.minor) {
- return "major";
- }
- if (lowVersion.compareMain(highVersion) === 0) {
- if (lowVersion.minor && !lowVersion.patch) {
- return "minor";
- }
- return "patch";
- }
- }
- const prefix = highHasPre ? "pre" : "";
- if (v1.major !== v2.major) {
- return prefix + "major";
- }
- if (v1.minor !== v2.minor) {
- return prefix + "minor";
- }
- if (v1.patch !== v2.patch) {
- return prefix + "patch";
- }
- return "prerelease";
- };
- module2.exports = diff;
- }
-});
-
-// ../../node_modules/semver/functions/major.js
-var require_major = __commonJS({
- "../../node_modules/semver/functions/major.js"(exports2, module2) {
- var SemVer = require_semver();
- var major = (a, loose) => new SemVer(a, loose).major;
- module2.exports = major;
- }
-});
-
-// ../../node_modules/semver/functions/minor.js
-var require_minor = __commonJS({
- "../../node_modules/semver/functions/minor.js"(exports2, module2) {
- var SemVer = require_semver();
- var minor = (a, loose) => new SemVer(a, loose).minor;
- module2.exports = minor;
- }
-});
-
-// ../../node_modules/semver/functions/patch.js
-var require_patch = __commonJS({
- "../../node_modules/semver/functions/patch.js"(exports2, module2) {
- var SemVer = require_semver();
- var patch = (a, loose) => new SemVer(a, loose).patch;
- module2.exports = patch;
- }
-});
-
-// ../../node_modules/semver/functions/prerelease.js
-var require_prerelease = __commonJS({
- "../../node_modules/semver/functions/prerelease.js"(exports2, module2) {
- var parse = require_parse();
- var prerelease = (version, options) => {
- const parsed = parse(version, options);
- return parsed && parsed.prerelease.length ? parsed.prerelease : null;
- };
- module2.exports = prerelease;
- }
-});
-
-// ../../node_modules/semver/functions/compare.js
-var require_compare = __commonJS({
- "../../node_modules/semver/functions/compare.js"(exports2, module2) {
- var SemVer = require_semver();
- var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
- module2.exports = compare;
- }
-});
-
-// ../../node_modules/semver/functions/rcompare.js
-var require_rcompare = __commonJS({
- "../../node_modules/semver/functions/rcompare.js"(exports2, module2) {
- var compare = require_compare();
- var rcompare = (a, b, loose) => compare(b, a, loose);
- module2.exports = rcompare;
- }
-});
-
-// ../../node_modules/semver/functions/compare-loose.js
-var require_compare_loose = __commonJS({
- "../../node_modules/semver/functions/compare-loose.js"(exports2, module2) {
- var compare = require_compare();
- var compareLoose = (a, b) => compare(a, b, true);
- module2.exports = compareLoose;
- }
-});
-
-// ../../node_modules/semver/functions/compare-build.js
-var require_compare_build = __commonJS({
- "../../node_modules/semver/functions/compare-build.js"(exports2, module2) {
- var SemVer = require_semver();
- var compareBuild = (a, b, loose) => {
- const versionA = new SemVer(a, loose);
- const versionB = new SemVer(b, loose);
- return versionA.compare(versionB) || versionA.compareBuild(versionB);
- };
- module2.exports = compareBuild;
- }
-});
-
-// ../../node_modules/semver/functions/sort.js
-var require_sort = __commonJS({
- "../../node_modules/semver/functions/sort.js"(exports2, module2) {
- var compareBuild = require_compare_build();
- var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
- module2.exports = sort;
- }
-});
-
-// ../../node_modules/semver/functions/rsort.js
-var require_rsort = __commonJS({
- "../../node_modules/semver/functions/rsort.js"(exports2, module2) {
- var compareBuild = require_compare_build();
- var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
- module2.exports = rsort;
- }
-});
-
-// ../../node_modules/semver/functions/gt.js
-var require_gt = __commonJS({
- "../../node_modules/semver/functions/gt.js"(exports2, module2) {
- var compare = require_compare();
- var gt = (a, b, loose) => compare(a, b, loose) > 0;
- module2.exports = gt;
- }
-});
-
-// ../../node_modules/semver/functions/lt.js
-var require_lt = __commonJS({
- "../../node_modules/semver/functions/lt.js"(exports2, module2) {
- var compare = require_compare();
- var lt = (a, b, loose) => compare(a, b, loose) < 0;
- module2.exports = lt;
- }
-});
-
-// ../../node_modules/semver/functions/eq.js
-var require_eq = __commonJS({
- "../../node_modules/semver/functions/eq.js"(exports2, module2) {
- var compare = require_compare();
- var eq = (a, b, loose) => compare(a, b, loose) === 0;
- module2.exports = eq;
- }
-});
-
-// ../../node_modules/semver/functions/neq.js
-var require_neq = __commonJS({
- "../../node_modules/semver/functions/neq.js"(exports2, module2) {
- var compare = require_compare();
- var neq = (a, b, loose) => compare(a, b, loose) !== 0;
- module2.exports = neq;
- }
-});
-
-// ../../node_modules/semver/functions/gte.js
-var require_gte = __commonJS({
- "../../node_modules/semver/functions/gte.js"(exports2, module2) {
- var compare = require_compare();
- var gte = (a, b, loose) => compare(a, b, loose) >= 0;
- module2.exports = gte;
- }
-});
-
-// ../../node_modules/semver/functions/lte.js
-var require_lte = __commonJS({
- "../../node_modules/semver/functions/lte.js"(exports2, module2) {
- var compare = require_compare();
- var lte = (a, b, loose) => compare(a, b, loose) <= 0;
- module2.exports = lte;
- }
-});
-
-// ../../node_modules/semver/functions/cmp.js
-var require_cmp = __commonJS({
- "../../node_modules/semver/functions/cmp.js"(exports2, module2) {
- var eq = require_eq();
- var neq = require_neq();
- var gt = require_gt();
- var gte = require_gte();
- var lt = require_lt();
- var lte = require_lte();
- var cmp = (a, op, b, loose) => {
- switch (op) {
- case "===":
- if (typeof a === "object") {
- a = a.version;
- }
- if (typeof b === "object") {
- b = b.version;
- }
- return a === b;
- case "!==":
- if (typeof a === "object") {
- a = a.version;
- }
- if (typeof b === "object") {
- b = b.version;
- }
- return a !== b;
- case "":
- case "=":
- case "==":
- return eq(a, b, loose);
- case "!=":
- return neq(a, b, loose);
- case ">":
- return gt(a, b, loose);
- case ">=":
- return gte(a, b, loose);
- case "<":
- return lt(a, b, loose);
- case "<=":
- return lte(a, b, loose);
- default:
- throw new TypeError(`Invalid operator: ${op}`);
- }
- };
- module2.exports = cmp;
- }
-});
-
-// ../../node_modules/semver/functions/coerce.js
-var require_coerce = __commonJS({
- "../../node_modules/semver/functions/coerce.js"(exports2, module2) {
- var SemVer = require_semver();
- var parse = require_parse();
- var { safeRe: re, t } = require_re();
- var coerce = (version, options) => {
- if (version instanceof SemVer) {
- return version;
- }
- if (typeof version === "number") {
- version = String(version);
- }
- if (typeof version !== "string") {
- return null;
- }
- options = options || {};
- let match = null;
- if (!options.rtl) {
- match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
- } else {
- const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
- let next;
- while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
- if (!match || next.index + next[0].length !== match.index + match[0].length) {
- match = next;
- }
- coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
- }
- coerceRtlRegex.lastIndex = -1;
- }
- if (match === null) {
- return null;
- }
- const major = match[2];
- const minor = match[3] || "0";
- const patch = match[4] || "0";
- const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
- const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
- return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options);
- };
- module2.exports = coerce;
- }
-});
-
-// ../../node_modules/semver/internal/lrucache.js
-var require_lrucache = __commonJS({
- "../../node_modules/semver/internal/lrucache.js"(exports2, module2) {
- var LRUCache = class {
- constructor() {
- this.max = 1e3;
- this.map = /* @__PURE__ */ new Map();
- }
- get(key) {
- const value = this.map.get(key);
- if (value === void 0) {
- return void 0;
- } else {
- this.map.delete(key);
- this.map.set(key, value);
- return value;
- }
- }
- delete(key) {
- return this.map.delete(key);
- }
- set(key, value) {
- const deleted = this.delete(key);
- if (!deleted && value !== void 0) {
- if (this.map.size >= this.max) {
- const firstKey = this.map.keys().next().value;
- this.delete(firstKey);
- }
- this.map.set(key, value);
- }
- return this;
- }
- };
- module2.exports = LRUCache;
- }
-});
-
-// ../../node_modules/semver/classes/range.js
-var require_range = __commonJS({
- "../../node_modules/semver/classes/range.js"(exports2, module2) {
- var SPACE_CHARACTERS = /\s+/g;
- var Range = class _Range {
- constructor(range, options) {
- options = parseOptions(options);
- if (range instanceof _Range) {
- if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
- return range;
- } else {
- return new _Range(range.raw, options);
- }
- }
- if (range instanceof Comparator) {
- this.raw = range.value;
- this.set = [[range]];
- this.formatted = void 0;
- return this;
- }
- this.options = options;
- this.loose = !!options.loose;
- this.includePrerelease = !!options.includePrerelease;
- this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
- this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
- if (!this.set.length) {
- throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
- }
- if (this.set.length > 1) {
- const first = this.set[0];
- this.set = this.set.filter((c) => !isNullSet(c[0]));
- if (this.set.length === 0) {
- this.set = [first];
- } else if (this.set.length > 1) {
- for (const c of this.set) {
- if (c.length === 1 && isAny(c[0])) {
- this.set = [c];
- break;
- }
- }
- }
- }
- this.formatted = void 0;
- }
- get range() {
- if (this.formatted === void 0) {
- this.formatted = "";
- for (let i = 0; i < this.set.length; i++) {
- if (i > 0) {
- this.formatted += "||";
- }
- const comps = this.set[i];
- for (let k = 0; k < comps.length; k++) {
- if (k > 0) {
- this.formatted += " ";
- }
- this.formatted += comps[k].toString().trim();
- }
- }
- }
- return this.formatted;
- }
- format() {
- return this.range;
- }
- toString() {
- return this.range;
- }
- parseRange(range) {
- const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
- const memoKey = memoOpts + ":" + range;
- const cached = cache.get(memoKey);
- if (cached) {
- return cached;
- }
- const loose = this.options.loose;
- const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
- range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
- debug("hyphen replace", range);
- range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
- debug("comparator trim", range);
- range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
- debug("tilde trim", range);
- range = range.replace(re[t.CARETTRIM], caretTrimReplace);
- debug("caret trim", range);
- let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
- if (loose) {
- rangeList = rangeList.filter((comp) => {
- debug("loose invalid filter", comp, this.options);
- return !!comp.match(re[t.COMPARATORLOOSE]);
- });
- }
- debug("range list", rangeList);
- const rangeMap = /* @__PURE__ */ new Map();
- const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
- for (const comp of comparators) {
- if (isNullSet(comp)) {
- return [comp];
- }
- rangeMap.set(comp.value, comp);
- }
- if (rangeMap.size > 1 && rangeMap.has("")) {
- rangeMap.delete("");
- }
- const result = [...rangeMap.values()];
- cache.set(memoKey, result);
- return result;
- }
- intersects(range, options) {
- if (!(range instanceof _Range)) {
- throw new TypeError("a Range is required");
- }
- return this.set.some((thisComparators) => {
- return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
- return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
- return rangeComparators.every((rangeComparator) => {
- return thisComparator.intersects(rangeComparator, options);
- });
- });
- });
- });
- }
- // if ANY of the sets match ALL of its comparators, then pass
- test(version) {
- if (!version) {
- return false;
- }
- if (typeof version === "string") {
- try {
- version = new SemVer(version, this.options);
- } catch (er) {
- return false;
- }
- }
- for (let i = 0; i < this.set.length; i++) {
- if (testSet(this.set[i], version, this.options)) {
- return true;
- }
- }
- return false;
- }
- };
- module2.exports = Range;
- var LRU = require_lrucache();
- var cache = new LRU();
- var parseOptions = require_parse_options();
- var Comparator = require_comparator();
- var debug = require_debug();
- var SemVer = require_semver();
- var {
- safeRe: re,
- t,
- comparatorTrimReplace,
- tildeTrimReplace,
- caretTrimReplace
- } = require_re();
- var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
- var isNullSet = (c) => c.value === "<0.0.0-0";
- var isAny = (c) => c.value === "";
- var isSatisfiable = (comparators, options) => {
- let result = true;
- const remainingComparators = comparators.slice();
- let testComparator = remainingComparators.pop();
- while (result && remainingComparators.length) {
- result = remainingComparators.every((otherComparator) => {
- return testComparator.intersects(otherComparator, options);
- });
- testComparator = remainingComparators.pop();
- }
- return result;
- };
- var parseComparator = (comp, options) => {
- debug("comp", comp, options);
- comp = replaceCarets(comp, options);
- debug("caret", comp);
- comp = replaceTildes(comp, options);
- debug("tildes", comp);
- comp = replaceXRanges(comp, options);
- debug("xrange", comp);
- comp = replaceStars(comp, options);
- debug("stars", comp);
- return comp;
- };
- var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
- var replaceTildes = (comp, options) => {
- return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
- };
- var replaceTilde = (comp, options) => {
- const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
- return comp.replace(r, (_, M, m, p, pr) => {
- debug("tilde", comp, _, M, m, p, pr);
- let ret;
- if (isX(M)) {
- ret = "";
- } else if (isX(m)) {
- ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
- } else if (isX(p)) {
- ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
- } else if (pr) {
- debug("replaceTilde pr", pr);
- ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
- } else {
- ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
- }
- debug("tilde return", ret);
- return ret;
- });
- };
- var replaceCarets = (comp, options) => {
- return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
- };
- var replaceCaret = (comp, options) => {
- debug("caret", comp, options);
- const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
- const z = options.includePrerelease ? "-0" : "";
- return comp.replace(r, (_, M, m, p, pr) => {
- debug("caret", comp, _, M, m, p, pr);
- let ret;
- if (isX(M)) {
- ret = "";
- } else if (isX(m)) {
- ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
- } else if (isX(p)) {
- if (M === "0") {
- ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
- } else {
- ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
- }
- } else if (pr) {
- debug("replaceCaret pr", pr);
- if (M === "0") {
- if (m === "0") {
- ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
- } else {
- ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
- }
- } else {
- ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
- }
- } else {
- debug("no pr");
- if (M === "0") {
- if (m === "0") {
- ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
- } else {
- ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
- }
- } else {
- ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
- }
- }
- debug("caret return", ret);
- return ret;
- });
- };
- var replaceXRanges = (comp, options) => {
- debug("replaceXRanges", comp, options);
- return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
- };
- var replaceXRange = (comp, options) => {
- comp = comp.trim();
- const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
- return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
- debug("xRange", comp, ret, gtlt, M, m, p, pr);
- const xM = isX(M);
- const xm = xM || isX(m);
- const xp = xm || isX(p);
- const anyX = xp;
- if (gtlt === "=" && anyX) {
- gtlt = "";
- }
- pr = options.includePrerelease ? "-0" : "";
- if (xM) {
- if (gtlt === ">" || gtlt === "<") {
- ret = "<0.0.0-0";
- } else {
- ret = "*";
- }
- } else if (gtlt && anyX) {
- if (xm) {
- m = 0;
- }
- p = 0;
- if (gtlt === ">") {
- gtlt = ">=";
- if (xm) {
- M = +M + 1;
- m = 0;
- p = 0;
- } else {
- m = +m + 1;
- p = 0;
- }
- } else if (gtlt === "<=") {
- gtlt = "<";
- if (xm) {
- M = +M + 1;
- } else {
- m = +m + 1;
- }
- }
- if (gtlt === "<") {
- pr = "-0";
- }
- ret = `${gtlt + M}.${m}.${p}${pr}`;
- } else if (xm) {
- ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
- } else if (xp) {
- ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
- }
- debug("xRange return", ret);
- return ret;
- });
- };
- var replaceStars = (comp, options) => {
- debug("replaceStars", comp, options);
- return comp.trim().replace(re[t.STAR], "");
- };
- var replaceGTE0 = (comp, options) => {
- debug("replaceGTE0", comp, options);
- return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
- };
- var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
- if (isX(fM)) {
- from = "";
- } else if (isX(fm)) {
- from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
- } else if (isX(fp)) {
- from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
- } else if (fpr) {
- from = `>=${from}`;
- } else {
- from = `>=${from}${incPr ? "-0" : ""}`;
- }
- if (isX(tM)) {
- to = "";
- } else if (isX(tm)) {
- to = `<${+tM + 1}.0.0-0`;
- } else if (isX(tp)) {
- to = `<${tM}.${+tm + 1}.0-0`;
- } else if (tpr) {
- to = `<=${tM}.${tm}.${tp}-${tpr}`;
- } else if (incPr) {
- to = `<${tM}.${tm}.${+tp + 1}-0`;
- } else {
- to = `<=${to}`;
- }
- return `${from} ${to}`.trim();
- };
- var testSet = (set, version, options) => {
- for (let i = 0; i < set.length; i++) {
- if (!set[i].test(version)) {
- return false;
- }
- }
- if (version.prerelease.length && !options.includePrerelease) {
- for (let i = 0; i < set.length; i++) {
- debug(set[i].semver);
- if (set[i].semver === Comparator.ANY) {
- continue;
- }
- if (set[i].semver.prerelease.length > 0) {
- const allowed = set[i].semver;
- if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
- return true;
- }
- }
- }
- return false;
- }
- return true;
- };
- }
-});
-
-// ../../node_modules/semver/classes/comparator.js
-var require_comparator = __commonJS({
- "../../node_modules/semver/classes/comparator.js"(exports2, module2) {
- var ANY = Symbol("SemVer ANY");
- var Comparator = class _Comparator {
- static get ANY() {
- return ANY;
- }
- constructor(comp, options) {
- options = parseOptions(options);
- if (comp instanceof _Comparator) {
- if (comp.loose === !!options.loose) {
- return comp;
- } else {
- comp = comp.value;
- }
- }
- comp = comp.trim().split(/\s+/).join(" ");
- debug("comparator", comp, options);
- this.options = options;
- this.loose = !!options.loose;
- this.parse(comp);
- if (this.semver === ANY) {
- this.value = "";
- } else {
- this.value = this.operator + this.semver.version;
- }
- debug("comp", this);
- }
- parse(comp) {
- const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
- const m = comp.match(r);
- if (!m) {
- throw new TypeError(`Invalid comparator: ${comp}`);
- }
- this.operator = m[1] !== void 0 ? m[1] : "";
- if (this.operator === "=") {
- this.operator = "";
- }
- if (!m[2]) {
- this.semver = ANY;
- } else {
- this.semver = new SemVer(m[2], this.options.loose);
- }
- }
- toString() {
- return this.value;
- }
- test(version) {
- debug("Comparator.test", version, this.options.loose);
- if (this.semver === ANY || version === ANY) {
- return true;
- }
- if (typeof version === "string") {
- try {
- version = new SemVer(version, this.options);
- } catch (er) {
- return false;
- }
- }
- return cmp(version, this.operator, this.semver, this.options);
- }
- intersects(comp, options) {
- if (!(comp instanceof _Comparator)) {
- throw new TypeError("a Comparator is required");
- }
- if (this.operator === "") {
- if (this.value === "") {
- return true;
- }
- return new Range(comp.value, options).test(this.value);
- } else if (comp.operator === "") {
- if (comp.value === "") {
- return true;
- }
- return new Range(this.value, options).test(comp.semver);
- }
- options = parseOptions(options);
- if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
- return false;
- }
- if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
- return false;
- }
- if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
- return true;
- }
- if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
- return true;
- }
- if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
- return true;
- }
- if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
- return true;
- }
- if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
- return true;
- }
- return false;
- }
- };
- module2.exports = Comparator;
- var parseOptions = require_parse_options();
- var { safeRe: re, t } = require_re();
- var cmp = require_cmp();
- var debug = require_debug();
- var SemVer = require_semver();
- var Range = require_range();
- }
-});
-
-// ../../node_modules/semver/functions/satisfies.js
-var require_satisfies = __commonJS({
- "../../node_modules/semver/functions/satisfies.js"(exports2, module2) {
- var Range = require_range();
- var satisfies = (version, range, options) => {
- try {
- range = new Range(range, options);
- } catch (er) {
- return false;
- }
- return range.test(version);
- };
- module2.exports = satisfies;
- }
-});
-
-// ../../node_modules/semver/ranges/to-comparators.js
-var require_to_comparators = __commonJS({
- "../../node_modules/semver/ranges/to-comparators.js"(exports2, module2) {
- var Range = require_range();
- var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
- module2.exports = toComparators;
- }
-});
-
-// ../../node_modules/semver/ranges/max-satisfying.js
-var require_max_satisfying = __commonJS({
- "../../node_modules/semver/ranges/max-satisfying.js"(exports2, module2) {
- var SemVer = require_semver();
- var Range = require_range();
- var maxSatisfying = (versions, range, options) => {
- let max = null;
- let maxSV = null;
- let rangeObj = null;
- try {
- rangeObj = new Range(range, options);
- } catch (er) {
- return null;
- }
- versions.forEach((v) => {
- if (rangeObj.test(v)) {
- if (!max || maxSV.compare(v) === -1) {
- max = v;
- maxSV = new SemVer(max, options);
- }
- }
- });
- return max;
- };
- module2.exports = maxSatisfying;
- }
-});
-
-// ../../node_modules/semver/ranges/min-satisfying.js
-var require_min_satisfying = __commonJS({
- "../../node_modules/semver/ranges/min-satisfying.js"(exports2, module2) {
- var SemVer = require_semver();
- var Range = require_range();
- var minSatisfying = (versions, range, options) => {
- let min = null;
- let minSV = null;
- let rangeObj = null;
- try {
- rangeObj = new Range(range, options);
- } catch (er) {
- return null;
- }
- versions.forEach((v) => {
- if (rangeObj.test(v)) {
- if (!min || minSV.compare(v) === 1) {
- min = v;
- minSV = new SemVer(min, options);
- }
- }
- });
- return min;
- };
- module2.exports = minSatisfying;
- }
-});
-
-// ../../node_modules/semver/ranges/min-version.js
-var require_min_version = __commonJS({
- "../../node_modules/semver/ranges/min-version.js"(exports2, module2) {
- var SemVer = require_semver();
- var Range = require_range();
- var gt = require_gt();
- var minVersion = (range, loose) => {
- range = new Range(range, loose);
- let minver = new SemVer("0.0.0");
- if (range.test(minver)) {
- return minver;
- }
- minver = new SemVer("0.0.0-0");
- if (range.test(minver)) {
- return minver;
- }
- minver = null;
- for (let i = 0; i < range.set.length; ++i) {
- const comparators = range.set[i];
- let setMin = null;
- comparators.forEach((comparator) => {
- const compver = new SemVer(comparator.semver.version);
- switch (comparator.operator) {
- case ">":
- if (compver.prerelease.length === 0) {
- compver.patch++;
- } else {
- compver.prerelease.push(0);
- }
- compver.raw = compver.format();
- case "":
- case ">=":
- if (!setMin || gt(compver, setMin)) {
- setMin = compver;
- }
- break;
- case "<":
- case "<=":
- break;
- default:
- throw new Error(`Unexpected operation: ${comparator.operator}`);
- }
- });
- if (setMin && (!minver || gt(minver, setMin))) {
- minver = setMin;
- }
- }
- if (minver && range.test(minver)) {
- return minver;
- }
- return null;
- };
- module2.exports = minVersion;
- }
-});
-
-// ../../node_modules/semver/ranges/valid.js
-var require_valid2 = __commonJS({
- "../../node_modules/semver/ranges/valid.js"(exports2, module2) {
- var Range = require_range();
- var validRange = (range, options) => {
- try {
- return new Range(range, options).range || "*";
- } catch (er) {
- return null;
- }
- };
- module2.exports = validRange;
- }
-});
-
-// ../../node_modules/semver/ranges/outside.js
-var require_outside = __commonJS({
- "../../node_modules/semver/ranges/outside.js"(exports2, module2) {
- var SemVer = require_semver();
- var Comparator = require_comparator();
- var { ANY } = Comparator;
- var Range = require_range();
- var satisfies = require_satisfies();
- var gt = require_gt();
- var lt = require_lt();
- var lte = require_lte();
- var gte = require_gte();
- var outside = (version, range, hilo, options) => {
- version = new SemVer(version, options);
- range = new Range(range, options);
- let gtfn, ltefn, ltfn, comp, ecomp;
- switch (hilo) {
- case ">":
- gtfn = gt;
- ltefn = lte;
- ltfn = lt;
- comp = ">";
- ecomp = ">=";
- break;
- case "<":
- gtfn = lt;
- ltefn = gte;
- ltfn = gt;
- comp = "<";
- ecomp = "<=";
- break;
- default:
- throw new TypeError('Must provide a hilo val of "<" or ">"');
- }
- if (satisfies(version, range, options)) {
- return false;
- }
- for (let i = 0; i < range.set.length; ++i) {
- const comparators = range.set[i];
- let high = null;
- let low = null;
- comparators.forEach((comparator) => {
- if (comparator.semver === ANY) {
- comparator = new Comparator(">=0.0.0");
- }
- high = high || comparator;
- low = low || comparator;
- if (gtfn(comparator.semver, high.semver, options)) {
- high = comparator;
- } else if (ltfn(comparator.semver, low.semver, options)) {
- low = comparator;
- }
- });
- if (high.operator === comp || high.operator === ecomp) {
- return false;
- }
- if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
- return false;
- } else if (low.operator === ecomp && ltfn(version, low.semver)) {
- return false;
- }
- }
- return true;
- };
- module2.exports = outside;
- }
-});
-
-// ../../node_modules/semver/ranges/gtr.js
-var require_gtr = __commonJS({
- "../../node_modules/semver/ranges/gtr.js"(exports2, module2) {
- var outside = require_outside();
- var gtr = (version, range, options) => outside(version, range, ">", options);
- module2.exports = gtr;
- }
-});
-
-// ../../node_modules/semver/ranges/ltr.js
-var require_ltr = __commonJS({
- "../../node_modules/semver/ranges/ltr.js"(exports2, module2) {
- var outside = require_outside();
- var ltr = (version, range, options) => outside(version, range, "<", options);
- module2.exports = ltr;
- }
-});
-
-// ../../node_modules/semver/ranges/intersects.js
-var require_intersects = __commonJS({
- "../../node_modules/semver/ranges/intersects.js"(exports2, module2) {
- var Range = require_range();
- var intersects = (r1, r2, options) => {
- r1 = new Range(r1, options);
- r2 = new Range(r2, options);
- return r1.intersects(r2, options);
- };
- module2.exports = intersects;
- }
-});
-
-// ../../node_modules/semver/ranges/simplify.js
-var require_simplify = __commonJS({
- "../../node_modules/semver/ranges/simplify.js"(exports2, module2) {
- var satisfies = require_satisfies();
- var compare = require_compare();
- module2.exports = (versions, range, options) => {
- const set = [];
- let first = null;
- let prev = null;
- const v = versions.sort((a, b) => compare(a, b, options));
- for (const version of v) {
- const included = satisfies(version, range, options);
- if (included) {
- prev = version;
- if (!first) {
- first = version;
- }
- } else {
- if (prev) {
- set.push([first, prev]);
- }
- prev = null;
- first = null;
- }
- }
- if (first) {
- set.push([first, null]);
- }
- const ranges = [];
- for (const [min, max] of set) {
- if (min === max) {
- ranges.push(min);
- } else if (!max && min === v[0]) {
- ranges.push("*");
- } else if (!max) {
- ranges.push(`>=${min}`);
- } else if (min === v[0]) {
- ranges.push(`<=${max}`);
- } else {
- ranges.push(`${min} - ${max}`);
- }
- }
- const simplified = ranges.join(" || ");
- const original = typeof range.raw === "string" ? range.raw : String(range);
- return simplified.length < original.length ? simplified : range;
- };
- }
-});
-
-// ../../node_modules/semver/ranges/subset.js
-var require_subset = __commonJS({
- "../../node_modules/semver/ranges/subset.js"(exports2, module2) {
- var Range = require_range();
- var Comparator = require_comparator();
- var { ANY } = Comparator;
- var satisfies = require_satisfies();
- var compare = require_compare();
- var subset = (sub, dom, options = {}) => {
- if (sub === dom) {
- return true;
- }
- sub = new Range(sub, options);
- dom = new Range(dom, options);
- let sawNonNull = false;
- OUTER: for (const simpleSub of sub.set) {
- for (const simpleDom of dom.set) {
- const isSub = simpleSubset(simpleSub, simpleDom, options);
- sawNonNull = sawNonNull || isSub !== null;
- if (isSub) {
- continue OUTER;
- }
- }
- if (sawNonNull) {
- return false;
- }
- }
- return true;
- };
- var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
- var minimumVersion = [new Comparator(">=0.0.0")];
- var simpleSubset = (sub, dom, options) => {
- if (sub === dom) {
- return true;
- }
- if (sub.length === 1 && sub[0].semver === ANY) {
- if (dom.length === 1 && dom[0].semver === ANY) {
- return true;
- } else if (options.includePrerelease) {
- sub = minimumVersionWithPreRelease;
- } else {
- sub = minimumVersion;
- }
- }
- if (dom.length === 1 && dom[0].semver === ANY) {
- if (options.includePrerelease) {
- return true;
- } else {
- dom = minimumVersion;
- }
- }
- const eqSet = /* @__PURE__ */ new Set();
- let gt, lt;
- for (const c of sub) {
- if (c.operator === ">" || c.operator === ">=") {
- gt = higherGT(gt, c, options);
- } else if (c.operator === "<" || c.operator === "<=") {
- lt = lowerLT(lt, c, options);
- } else {
- eqSet.add(c.semver);
- }
- }
- if (eqSet.size > 1) {
- return null;
- }
- let gtltComp;
- if (gt && lt) {
- gtltComp = compare(gt.semver, lt.semver, options);
- if (gtltComp > 0) {
- return null;
- } else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
- return null;
- }
- }
- for (const eq of eqSet) {
- if (gt && !satisfies(eq, String(gt), options)) {
- return null;
- }
- if (lt && !satisfies(eq, String(lt), options)) {
- return null;
- }
- for (const c of dom) {
- if (!satisfies(eq, String(c), options)) {
- return false;
- }
- }
- return true;
- }
- let higher, lower;
- let hasDomLT, hasDomGT;
- let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
- let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
- if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
- needDomLTPre = false;
- }
- for (const c of dom) {
- hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
- hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
- if (gt) {
- if (needDomGTPre) {
- if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) {
- needDomGTPre = false;
- }
- }
- if (c.operator === ">" || c.operator === ">=") {
- higher = higherGT(gt, c, options);
- if (higher === c && higher !== gt) {
- return false;
- }
- } else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) {
- return false;
- }
- }
- if (lt) {
- if (needDomLTPre) {
- if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) {
- needDomLTPre = false;
- }
- }
- if (c.operator === "<" || c.operator === "<=") {
- lower = lowerLT(lt, c, options);
- if (lower === c && lower !== lt) {
- return false;
- }
- } else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) {
- return false;
- }
- }
- if (!c.operator && (lt || gt) && gtltComp !== 0) {
- return false;
- }
- }
- if (gt && hasDomLT && !lt && gtltComp !== 0) {
- return false;
- }
- if (lt && hasDomGT && !gt && gtltComp !== 0) {
- return false;
- }
- if (needDomGTPre || needDomLTPre) {
- return false;
- }
- return true;
- };
- var higherGT = (a, b, options) => {
- if (!a) {
- return b;
- }
- const comp = compare(a.semver, b.semver, options);
- return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
- };
- var lowerLT = (a, b, options) => {
- if (!a) {
- return b;
- }
- const comp = compare(a.semver, b.semver, options);
- return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
- };
- module2.exports = subset;
- }
-});
-
-// ../../node_modules/semver/index.js
-var require_semver2 = __commonJS({
- "../../node_modules/semver/index.js"(exports2, module2) {
- var internalRe = require_re();
- var constants = require_constants();
- var SemVer = require_semver();
- var identifiers = require_identifiers();
- var parse = require_parse();
- var valid = require_valid();
- var clean = require_clean();
- var inc = require_inc();
- var diff = require_diff();
- var major = require_major();
- var minor = require_minor();
- var patch = require_patch();
- var prerelease = require_prerelease();
- var compare = require_compare();
- var rcompare = require_rcompare();
- var compareLoose = require_compare_loose();
- var compareBuild = require_compare_build();
- var sort = require_sort();
- var rsort = require_rsort();
- var gt = require_gt();
- var lt = require_lt();
- var eq = require_eq();
- var neq = require_neq();
- var gte = require_gte();
- var lte = require_lte();
- var cmp = require_cmp();
- var coerce = require_coerce();
- var Comparator = require_comparator();
- var Range = require_range();
- var satisfies = require_satisfies();
- var toComparators = require_to_comparators();
- var maxSatisfying = require_max_satisfying();
- var minSatisfying = require_min_satisfying();
- var minVersion = require_min_version();
- var validRange = require_valid2();
- var outside = require_outside();
- var gtr = require_gtr();
- var ltr = require_ltr();
- var intersects = require_intersects();
- var simplifyRange = require_simplify();
- var subset = require_subset();
- module2.exports = {
- parse,
- valid,
- clean,
- inc,
- diff,
- major,
- minor,
- patch,
- prerelease,
- compare,
- rcompare,
- compareLoose,
- compareBuild,
- sort,
- rsort,
- gt,
- lt,
- eq,
- neq,
- gte,
- lte,
- cmp,
- coerce,
- Comparator,
- Range,
- satisfies,
- toComparators,
- maxSatisfying,
- minSatisfying,
- minVersion,
- validRange,
- outside,
- gtr,
- ltr,
- intersects,
- simplifyRange,
- subset,
- SemVer,
- re: internalRe.re,
- src: internalRe.src,
- tokens: internalRe.t,
- SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
- RELEASE_TYPES: constants.RELEASE_TYPES,
- compareIdentifiers: identifiers.compareIdentifiers,
- rcompareIdentifiers: identifiers.rcompareIdentifiers
- };
- }
-});
-
-// ../../node_modules/jsonwebtoken/lib/asymmetricKeyDetailsSupported.js
-var require_asymmetricKeyDetailsSupported = __commonJS({
- "../../node_modules/jsonwebtoken/lib/asymmetricKeyDetailsSupported.js"(exports2, module2) {
- var semver = require_semver2();
- module2.exports = semver.satisfies(process.version, ">=15.7.0");
- }
-});
-
-// ../../node_modules/jsonwebtoken/lib/rsaPssKeyDetailsSupported.js
-var require_rsaPssKeyDetailsSupported = __commonJS({
- "../../node_modules/jsonwebtoken/lib/rsaPssKeyDetailsSupported.js"(exports2, module2) {
- var semver = require_semver2();
- module2.exports = semver.satisfies(process.version, ">=16.9.0");
- }
-});
-
-// ../../node_modules/jsonwebtoken/lib/validateAsymmetricKey.js
-var require_validateAsymmetricKey = __commonJS({
- "../../node_modules/jsonwebtoken/lib/validateAsymmetricKey.js"(exports2, module2) {
- var ASYMMETRIC_KEY_DETAILS_SUPPORTED = require_asymmetricKeyDetailsSupported();
- var RSA_PSS_KEY_DETAILS_SUPPORTED = require_rsaPssKeyDetailsSupported();
- var allowedAlgorithmsForKeys = {
- "ec": ["ES256", "ES384", "ES512"],
- "rsa": ["RS256", "PS256", "RS384", "PS384", "RS512", "PS512"],
- "rsa-pss": ["PS256", "PS384", "PS512"]
- };
- var allowedCurves = {
- ES256: "prime256v1",
- ES384: "secp384r1",
- ES512: "secp521r1"
- };
- module2.exports = function(algorithm, key) {
- if (!algorithm || !key) return;
- const keyType = key.asymmetricKeyType;
- if (!keyType) return;
- const allowedAlgorithms = allowedAlgorithmsForKeys[keyType];
- if (!allowedAlgorithms) {
- throw new Error(`Unknown key type "${keyType}".`);
- }
- if (!allowedAlgorithms.includes(algorithm)) {
- throw new Error(`"alg" parameter for "${keyType}" key type must be one of: ${allowedAlgorithms.join(", ")}.`);
- }
- if (ASYMMETRIC_KEY_DETAILS_SUPPORTED) {
- switch (keyType) {
- case "ec":
- const keyCurve = key.asymmetricKeyDetails.namedCurve;
- const allowedCurve = allowedCurves[algorithm];
- if (keyCurve !== allowedCurve) {
- throw new Error(`"alg" parameter "${algorithm}" requires curve "${allowedCurve}".`);
- }
- break;
- case "rsa-pss":
- if (RSA_PSS_KEY_DETAILS_SUPPORTED) {
- const length = parseInt(algorithm.slice(-3), 10);
- const { hashAlgorithm, mgf1HashAlgorithm, saltLength } = key.asymmetricKeyDetails;
- if (hashAlgorithm !== `sha${length}` || mgf1HashAlgorithm !== hashAlgorithm) {
- throw new Error(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${algorithm}.`);
- }
- if (saltLength !== void 0 && saltLength > length >> 3) {
- throw new Error(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${algorithm}.`);
- }
- }
- break;
- }
- }
- };
- }
-});
-
-// ../../node_modules/jsonwebtoken/lib/psSupported.js
-var require_psSupported = __commonJS({
- "../../node_modules/jsonwebtoken/lib/psSupported.js"(exports2, module2) {
- var semver = require_semver2();
- module2.exports = semver.satisfies(process.version, "^6.12.0 || >=8.0.0");
- }
-});
-
-// ../../node_modules/jsonwebtoken/verify.js
-var require_verify = __commonJS({
- "../../node_modules/jsonwebtoken/verify.js"(exports2, module2) {
- var JsonWebTokenError = require_JsonWebTokenError();
- var NotBeforeError = require_NotBeforeError();
- var TokenExpiredError = require_TokenExpiredError();
- var decode = require_decode();
- var timespan = require_timespan();
- var validateAsymmetricKey = require_validateAsymmetricKey();
- var PS_SUPPORTED = require_psSupported();
- var jws = require_jws();
- var { KeyObject, createSecretKey, createPublicKey } = require("crypto");
- var PUB_KEY_ALGS = ["RS256", "RS384", "RS512"];
- var EC_KEY_ALGS = ["ES256", "ES384", "ES512"];
- var RSA_KEY_ALGS = ["RS256", "RS384", "RS512"];
- var HS_ALGS = ["HS256", "HS384", "HS512"];
- if (PS_SUPPORTED) {
- PUB_KEY_ALGS.splice(PUB_KEY_ALGS.length, 0, "PS256", "PS384", "PS512");
- RSA_KEY_ALGS.splice(RSA_KEY_ALGS.length, 0, "PS256", "PS384", "PS512");
- }
- module2.exports = function(jwtString, secretOrPublicKey, options, callback) {
- if (typeof options === "function" && !callback) {
- callback = options;
- options = {};
- }
- if (!options) {
- options = {};
- }
- options = Object.assign({}, options);
- let done;
- if (callback) {
- done = callback;
- } else {
- done = function(err, data) {
- if (err) throw err;
- return data;
- };
- }
- if (options.clockTimestamp && typeof options.clockTimestamp !== "number") {
- return done(new JsonWebTokenError("clockTimestamp must be a number"));
- }
- if (options.nonce !== void 0 && (typeof options.nonce !== "string" || options.nonce.trim() === "")) {
- return done(new JsonWebTokenError("nonce must be a non-empty string"));
- }
- if (options.allowInvalidAsymmetricKeyTypes !== void 0 && typeof options.allowInvalidAsymmetricKeyTypes !== "boolean") {
- return done(new JsonWebTokenError("allowInvalidAsymmetricKeyTypes must be a boolean"));
- }
- const clockTimestamp = options.clockTimestamp || Math.floor(Date.now() / 1e3);
- if (!jwtString) {
- return done(new JsonWebTokenError("jwt must be provided"));
- }
- if (typeof jwtString !== "string") {
- return done(new JsonWebTokenError("jwt must be a string"));
- }
- const parts = jwtString.split(".");
- if (parts.length !== 3) {
- return done(new JsonWebTokenError("jwt malformed"));
- }
- let decodedToken;
- try {
- decodedToken = decode(jwtString, { complete: true });
- } catch (err) {
- return done(err);
- }
- if (!decodedToken) {
- return done(new JsonWebTokenError("invalid token"));
- }
- const header = decodedToken.header;
- let getSecret;
- if (typeof secretOrPublicKey === "function") {
- if (!callback) {
- return done(new JsonWebTokenError("verify must be called asynchronous if secret or public key is provided as a callback"));
- }
- getSecret = secretOrPublicKey;
- } else {
- getSecret = function(header2, secretCallback) {
- return secretCallback(null, secretOrPublicKey);
- };
- }
- return getSecret(header, function(err, secretOrPublicKey2) {
- if (err) {
- return done(new JsonWebTokenError("error in secret or public key callback: " + err.message));
- }
- const hasSignature = parts[2].trim() !== "";
- if (!hasSignature && secretOrPublicKey2) {
- return done(new JsonWebTokenError("jwt signature is required"));
- }
- if (hasSignature && !secretOrPublicKey2) {
- return done(new JsonWebTokenError("secret or public key must be provided"));
- }
- if (!hasSignature && !options.algorithms) {
- return done(new JsonWebTokenError('please specify "none" in "algorithms" to verify unsigned tokens'));
- }
- if (secretOrPublicKey2 != null && !(secretOrPublicKey2 instanceof KeyObject)) {
- try {
- secretOrPublicKey2 = createPublicKey(secretOrPublicKey2);
- } catch (_) {
- try {
- secretOrPublicKey2 = createSecretKey(typeof secretOrPublicKey2 === "string" ? Buffer.from(secretOrPublicKey2) : secretOrPublicKey2);
- } catch (_2) {
- return done(new JsonWebTokenError("secretOrPublicKey is not valid key material"));
- }
- }
- }
- if (!options.algorithms) {
- if (secretOrPublicKey2.type === "secret") {
- options.algorithms = HS_ALGS;
- } else if (["rsa", "rsa-pss"].includes(secretOrPublicKey2.asymmetricKeyType)) {
- options.algorithms = RSA_KEY_ALGS;
- } else if (secretOrPublicKey2.asymmetricKeyType === "ec") {
- options.algorithms = EC_KEY_ALGS;
- } else {
- options.algorithms = PUB_KEY_ALGS;
- }
- }
- if (options.algorithms.indexOf(decodedToken.header.alg) === -1) {
- return done(new JsonWebTokenError("invalid algorithm"));
- }
- if (header.alg.startsWith("HS") && secretOrPublicKey2.type !== "secret") {
- return done(new JsonWebTokenError(`secretOrPublicKey must be a symmetric key when using ${header.alg}`));
- } else if (/^(?:RS|PS|ES)/.test(header.alg) && secretOrPublicKey2.type !== "public") {
- return done(new JsonWebTokenError(`secretOrPublicKey must be an asymmetric key when using ${header.alg}`));
- }
- if (!options.allowInvalidAsymmetricKeyTypes) {
- try {
- validateAsymmetricKey(header.alg, secretOrPublicKey2);
- } catch (e) {
- return done(e);
- }
- }
- let valid;
- try {
- valid = jws.verify(jwtString, decodedToken.header.alg, secretOrPublicKey2);
- } catch (e) {
- return done(e);
- }
- if (!valid) {
- return done(new JsonWebTokenError("invalid signature"));
- }
- const payload = decodedToken.payload;
- if (typeof payload.nbf !== "undefined" && !options.ignoreNotBefore) {
- if (typeof payload.nbf !== "number") {
- return done(new JsonWebTokenError("invalid nbf value"));
- }
- if (payload.nbf > clockTimestamp + (options.clockTolerance || 0)) {
- return done(new NotBeforeError("jwt not active", new Date(payload.nbf * 1e3)));
- }
- }
- if (typeof payload.exp !== "undefined" && !options.ignoreExpiration) {
- if (typeof payload.exp !== "number") {
- return done(new JsonWebTokenError("invalid exp value"));
- }
- if (clockTimestamp >= payload.exp + (options.clockTolerance || 0)) {
- return done(new TokenExpiredError("jwt expired", new Date(payload.exp * 1e3)));
- }
- }
- if (options.audience) {
- const audiences = Array.isArray(options.audience) ? options.audience : [options.audience];
- const target = Array.isArray(payload.aud) ? payload.aud : [payload.aud];
- const match = target.some(function(targetAudience) {
- return audiences.some(function(audience) {
- return audience instanceof RegExp ? audience.test(targetAudience) : audience === targetAudience;
- });
- });
- if (!match) {
- return done(new JsonWebTokenError("jwt audience invalid. expected: " + audiences.join(" or ")));
- }
- }
- if (options.issuer) {
- const invalid_issuer = typeof options.issuer === "string" && payload.iss !== options.issuer || Array.isArray(options.issuer) && options.issuer.indexOf(payload.iss) === -1;
- if (invalid_issuer) {
- return done(new JsonWebTokenError("jwt issuer invalid. expected: " + options.issuer));
- }
- }
- if (options.subject) {
- if (payload.sub !== options.subject) {
- return done(new JsonWebTokenError("jwt subject invalid. expected: " + options.subject));
- }
- }
- if (options.jwtid) {
- if (payload.jti !== options.jwtid) {
- return done(new JsonWebTokenError("jwt jwtid invalid. expected: " + options.jwtid));
- }
- }
- if (options.nonce) {
- if (payload.nonce !== options.nonce) {
- return done(new JsonWebTokenError("jwt nonce invalid. expected: " + options.nonce));
- }
- }
- if (options.maxAge) {
- if (typeof payload.iat !== "number") {
- return done(new JsonWebTokenError("iat required when maxAge is specified"));
- }
- const maxAgeTimestamp = timespan(options.maxAge, payload.iat);
- if (typeof maxAgeTimestamp === "undefined") {
- return done(new JsonWebTokenError('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));
- }
- if (clockTimestamp >= maxAgeTimestamp + (options.clockTolerance || 0)) {
- return done(new TokenExpiredError("maxAge exceeded", new Date(maxAgeTimestamp * 1e3)));
- }
- }
- if (options.complete === true) {
- const signature = decodedToken.signature;
- return done(null, {
- header,
- payload,
- signature
- });
- }
- return done(null, payload);
- });
- };
- }
-});
-
-// ../../node_modules/lodash.includes/index.js
-var require_lodash = __commonJS({
- "../../node_modules/lodash.includes/index.js"(exports2, module2) {
- var INFINITY = 1 / 0;
- var MAX_SAFE_INTEGER = 9007199254740991;
- var MAX_INTEGER = 17976931348623157e292;
- var NAN = 0 / 0;
- var argsTag = "[object Arguments]";
- var funcTag = "[object Function]";
- var genTag = "[object GeneratorFunction]";
- var stringTag = "[object String]";
- var symbolTag = "[object Symbol]";
- var reTrim = /^\s+|\s+$/g;
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
- var reIsBinary = /^0b[01]+$/i;
- var reIsOctal = /^0o[0-7]+$/i;
- var reIsUint = /^(?:0|[1-9]\d*)$/;
- var freeParseInt = parseInt;
- function arrayMap(array, iteratee) {
- var index = -1, length = array ? array.length : 0, result = Array(length);
- while (++index < length) {
- result[index] = iteratee(array[index], index, array);
- }
- return result;
- }
- function baseFindIndex(array, predicate, fromIndex, fromRight) {
- var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
- while (fromRight ? index-- : ++index < length) {
- if (predicate(array[index], index, array)) {
- return index;
- }
- }
- return -1;
- }
- function baseIndexOf(array, value, fromIndex) {
- if (value !== value) {
- return baseFindIndex(array, baseIsNaN, fromIndex);
- }
- var index = fromIndex - 1, length = array.length;
- while (++index < length) {
- if (array[index] === value) {
- return index;
- }
- }
- return -1;
- }
- function baseIsNaN(value) {
- return value !== value;
- }
- function baseTimes(n, iteratee) {
- var index = -1, result = Array(n);
- while (++index < n) {
- result[index] = iteratee(index);
- }
- return result;
- }
- function baseValues(object, props) {
- return arrayMap(props, function(key) {
- return object[key];
- });
- }
- function overArg(func, transform) {
- return function(arg) {
- return func(transform(arg));
- };
- }
- var objectProto = Object.prototype;
- var hasOwnProperty = objectProto.hasOwnProperty;
- var objectToString = objectProto.toString;
- var propertyIsEnumerable = objectProto.propertyIsEnumerable;
- var nativeKeys = overArg(Object.keys, Object);
- var nativeMax = Math.max;
- function arrayLikeKeys(value, inherited) {
- var result = isArray(value) || isArguments(value) ? baseTimes(value.length, String) : [];
- var length = result.length, skipIndexes = !!length;
- for (var key in value) {
- if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && (key == "length" || isIndex(key, length)))) {
- result.push(key);
- }
- }
- return result;
- }
- function baseKeys(object) {
- if (!isPrototype(object)) {
- return nativeKeys(object);
- }
- var result = [];
- for (var key in Object(object)) {
- if (hasOwnProperty.call(object, key) && key != "constructor") {
- result.push(key);
- }
- }
- return result;
- }
- function isIndex(value, length) {
- length = length == null ? MAX_SAFE_INTEGER : length;
- return !!length && (typeof value == "number" || reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
- }
- function isPrototype(value) {
- var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
- return value === proto;
- }
- function includes(collection, value, fromIndex, guard) {
- collection = isArrayLike(collection) ? collection : values(collection);
- fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
- var length = collection.length;
- if (fromIndex < 0) {
- fromIndex = nativeMax(length + fromIndex, 0);
- }
- return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
- }
- function isArguments(value) {
- return isArrayLikeObject(value) && hasOwnProperty.call(value, "callee") && (!propertyIsEnumerable.call(value, "callee") || objectToString.call(value) == argsTag);
- }
- var isArray = Array.isArray;
- function isArrayLike(value) {
- return value != null && isLength(value.length) && !isFunction(value);
- }
- function isArrayLikeObject(value) {
- return isObjectLike(value) && isArrayLike(value);
- }
- function isFunction(value) {
- var tag = isObject(value) ? objectToString.call(value) : "";
- return tag == funcTag || tag == genTag;
- }
- function isLength(value) {
- return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
- }
- function isObject(value) {
- var type = typeof value;
- return !!value && (type == "object" || type == "function");
- }
- function isObjectLike(value) {
- return !!value && typeof value == "object";
- }
- function isString(value) {
- return typeof value == "string" || !isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag;
- }
- function isSymbol(value) {
- return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag;
- }
- function toFinite(value) {
- if (!value) {
- return value === 0 ? value : 0;
- }
- value = toNumber(value);
- if (value === INFINITY || value === -INFINITY) {
- var sign = value < 0 ? -1 : 1;
- return sign * MAX_INTEGER;
- }
- return value === value ? value : 0;
- }
- function toInteger(value) {
- var result = toFinite(value), remainder = result % 1;
- return result === result ? remainder ? result - remainder : result : 0;
- }
- function toNumber(value) {
- if (typeof value == "number") {
- return value;
- }
- if (isSymbol(value)) {
- return NAN;
- }
- if (isObject(value)) {
- var other = typeof value.valueOf == "function" ? value.valueOf() : value;
- value = isObject(other) ? other + "" : other;
- }
- if (typeof value != "string") {
- return value === 0 ? value : +value;
- }
- value = value.replace(reTrim, "");
- var isBinary = reIsBinary.test(value);
- return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
- }
- function keys(object) {
- return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
- }
- function values(object) {
- return object ? baseValues(object, keys(object)) : [];
- }
- module2.exports = includes;
- }
-});
-
-// ../../node_modules/lodash.isboolean/index.js
-var require_lodash2 = __commonJS({
- "../../node_modules/lodash.isboolean/index.js"(exports2, module2) {
- var boolTag = "[object Boolean]";
- var objectProto = Object.prototype;
- var objectToString = objectProto.toString;
- function isBoolean(value) {
- return value === true || value === false || isObjectLike(value) && objectToString.call(value) == boolTag;
- }
- function isObjectLike(value) {
- return !!value && typeof value == "object";
- }
- module2.exports = isBoolean;
- }
-});
-
-// ../../node_modules/lodash.isinteger/index.js
-var require_lodash3 = __commonJS({
- "../../node_modules/lodash.isinteger/index.js"(exports2, module2) {
- var INFINITY = 1 / 0;
- var MAX_INTEGER = 17976931348623157e292;
- var NAN = 0 / 0;
- var symbolTag = "[object Symbol]";
- var reTrim = /^\s+|\s+$/g;
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
- var reIsBinary = /^0b[01]+$/i;
- var reIsOctal = /^0o[0-7]+$/i;
- var freeParseInt = parseInt;
- var objectProto = Object.prototype;
- var objectToString = objectProto.toString;
- function isInteger(value) {
- return typeof value == "number" && value == toInteger(value);
- }
- function isObject(value) {
- var type = typeof value;
- return !!value && (type == "object" || type == "function");
- }
- function isObjectLike(value) {
- return !!value && typeof value == "object";
- }
- function isSymbol(value) {
- return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag;
- }
- function toFinite(value) {
- if (!value) {
- return value === 0 ? value : 0;
- }
- value = toNumber(value);
- if (value === INFINITY || value === -INFINITY) {
- var sign = value < 0 ? -1 : 1;
- return sign * MAX_INTEGER;
- }
- return value === value ? value : 0;
- }
- function toInteger(value) {
- var result = toFinite(value), remainder = result % 1;
- return result === result ? remainder ? result - remainder : result : 0;
- }
- function toNumber(value) {
- if (typeof value == "number") {
- return value;
- }
- if (isSymbol(value)) {
- return NAN;
- }
- if (isObject(value)) {
- var other = typeof value.valueOf == "function" ? value.valueOf() : value;
- value = isObject(other) ? other + "" : other;
- }
- if (typeof value != "string") {
- return value === 0 ? value : +value;
- }
- value = value.replace(reTrim, "");
- var isBinary = reIsBinary.test(value);
- return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
- }
- module2.exports = isInteger;
- }
-});
-
-// ../../node_modules/lodash.isnumber/index.js
-var require_lodash4 = __commonJS({
- "../../node_modules/lodash.isnumber/index.js"(exports2, module2) {
- var numberTag = "[object Number]";
- var objectProto = Object.prototype;
- var objectToString = objectProto.toString;
- function isObjectLike(value) {
- return !!value && typeof value == "object";
- }
- function isNumber(value) {
- return typeof value == "number" || isObjectLike(value) && objectToString.call(value) == numberTag;
- }
- module2.exports = isNumber;
- }
-});
-
-// ../../node_modules/lodash.isplainobject/index.js
-var require_lodash5 = __commonJS({
- "../../node_modules/lodash.isplainobject/index.js"(exports2, module2) {
- var objectTag = "[object Object]";
- function isHostObject(value) {
- var result = false;
- if (value != null && typeof value.toString != "function") {
- try {
- result = !!(value + "");
- } catch (e) {
- }
- }
- return result;
- }
- function overArg(func, transform) {
- return function(arg) {
- return func(transform(arg));
- };
- }
- var funcProto = Function.prototype;
- var objectProto = Object.prototype;
- var funcToString = funcProto.toString;
- var hasOwnProperty = objectProto.hasOwnProperty;
- var objectCtorString = funcToString.call(Object);
- var objectToString = objectProto.toString;
- var getPrototype = overArg(Object.getPrototypeOf, Object);
- function isObjectLike(value) {
- return !!value && typeof value == "object";
- }
- function isPlainObject(value) {
- if (!isObjectLike(value) || objectToString.call(value) != objectTag || isHostObject(value)) {
- return false;
- }
- var proto = getPrototype(value);
- if (proto === null) {
- return true;
- }
- var Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor;
- return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
- }
- module2.exports = isPlainObject;
- }
-});
-
-// ../../node_modules/lodash.isstring/index.js
-var require_lodash6 = __commonJS({
- "../../node_modules/lodash.isstring/index.js"(exports2, module2) {
- var stringTag = "[object String]";
- var objectProto = Object.prototype;
- var objectToString = objectProto.toString;
- var isArray = Array.isArray;
- function isObjectLike(value) {
- return !!value && typeof value == "object";
- }
- function isString(value) {
- return typeof value == "string" || !isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag;
- }
- module2.exports = isString;
- }
-});
-
-// ../../node_modules/lodash.once/index.js
-var require_lodash7 = __commonJS({
- "../../node_modules/lodash.once/index.js"(exports2, module2) {
- var FUNC_ERROR_TEXT = "Expected a function";
- var INFINITY = 1 / 0;
- var MAX_INTEGER = 17976931348623157e292;
- var NAN = 0 / 0;
- var symbolTag = "[object Symbol]";
- var reTrim = /^\s+|\s+$/g;
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
- var reIsBinary = /^0b[01]+$/i;
- var reIsOctal = /^0o[0-7]+$/i;
- var freeParseInt = parseInt;
- var objectProto = Object.prototype;
- var objectToString = objectProto.toString;
- function before(n, func) {
- var result;
- if (typeof func != "function") {
- throw new TypeError(FUNC_ERROR_TEXT);
- }
- n = toInteger(n);
- return function() {
- if (--n > 0) {
- result = func.apply(this, arguments);
- }
- if (n <= 1) {
- func = void 0;
- }
- return result;
- };
- }
- function once(func) {
- return before(2, func);
- }
- function isObject(value) {
- var type = typeof value;
- return !!value && (type == "object" || type == "function");
- }
- function isObjectLike(value) {
- return !!value && typeof value == "object";
- }
- function isSymbol(value) {
- return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag;
- }
- function toFinite(value) {
- if (!value) {
- return value === 0 ? value : 0;
- }
- value = toNumber(value);
- if (value === INFINITY || value === -INFINITY) {
- var sign = value < 0 ? -1 : 1;
- return sign * MAX_INTEGER;
- }
- return value === value ? value : 0;
- }
- function toInteger(value) {
- var result = toFinite(value), remainder = result % 1;
- return result === result ? remainder ? result - remainder : result : 0;
- }
- function toNumber(value) {
- if (typeof value == "number") {
- return value;
- }
- if (isSymbol(value)) {
- return NAN;
- }
- if (isObject(value)) {
- var other = typeof value.valueOf == "function" ? value.valueOf() : value;
- value = isObject(other) ? other + "" : other;
- }
- if (typeof value != "string") {
- return value === 0 ? value : +value;
- }
- value = value.replace(reTrim, "");
- var isBinary = reIsBinary.test(value);
- return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
- }
- module2.exports = once;
- }
-});
-
-// ../../node_modules/jsonwebtoken/sign.js
-var require_sign = __commonJS({
- "../../node_modules/jsonwebtoken/sign.js"(exports2, module2) {
- var timespan = require_timespan();
- var PS_SUPPORTED = require_psSupported();
- var validateAsymmetricKey = require_validateAsymmetricKey();
- var jws = require_jws();
- var includes = require_lodash();
- var isBoolean = require_lodash2();
- var isInteger = require_lodash3();
- var isNumber = require_lodash4();
- var isPlainObject = require_lodash5();
- var isString = require_lodash6();
- var once = require_lodash7();
- var { KeyObject, createSecretKey, createPrivateKey } = require("crypto");
- var SUPPORTED_ALGS = ["RS256", "RS384", "RS512", "ES256", "ES384", "ES512", "HS256", "HS384", "HS512", "none"];
- if (PS_SUPPORTED) {
- SUPPORTED_ALGS.splice(3, 0, "PS256", "PS384", "PS512");
- }
- var sign_options_schema = {
- expiresIn: { isValid: function(value) {
- return isInteger(value) || isString(value) && value;
- }, message: '"expiresIn" should be a number of seconds or string representing a timespan' },
- notBefore: { isValid: function(value) {
- return isInteger(value) || isString(value) && value;
- }, message: '"notBefore" should be a number of seconds or string representing a timespan' },
- audience: { isValid: function(value) {
- return isString(value) || Array.isArray(value);
- }, message: '"audience" must be a string or array' },
- algorithm: { isValid: includes.bind(null, SUPPORTED_ALGS), message: '"algorithm" must be a valid string enum value' },
- header: { isValid: isPlainObject, message: '"header" must be an object' },
- encoding: { isValid: isString, message: '"encoding" must be a string' },
- issuer: { isValid: isString, message: '"issuer" must be a string' },
- subject: { isValid: isString, message: '"subject" must be a string' },
- jwtid: { isValid: isString, message: '"jwtid" must be a string' },
- noTimestamp: { isValid: isBoolean, message: '"noTimestamp" must be a boolean' },
- keyid: { isValid: isString, message: '"keyid" must be a string' },
- mutatePayload: { isValid: isBoolean, message: '"mutatePayload" must be a boolean' },
- allowInsecureKeySizes: { isValid: isBoolean, message: '"allowInsecureKeySizes" must be a boolean' },
- allowInvalidAsymmetricKeyTypes: { isValid: isBoolean, message: '"allowInvalidAsymmetricKeyTypes" must be a boolean' }
- };
- var registered_claims_schema = {
- iat: { isValid: isNumber, message: '"iat" should be a number of seconds' },
- exp: { isValid: isNumber, message: '"exp" should be a number of seconds' },
- nbf: { isValid: isNumber, message: '"nbf" should be a number of seconds' }
- };
- function validate(schema, allowUnknown, object, parameterName) {
- if (!isPlainObject(object)) {
- throw new Error('Expected "' + parameterName + '" to be a plain object.');
- }
- Object.keys(object).forEach(function(key) {
- const validator = schema[key];
- if (!validator) {
- if (!allowUnknown) {
- throw new Error('"' + key + '" is not allowed in "' + parameterName + '"');
- }
- return;
- }
- if (!validator.isValid(object[key])) {
- throw new Error(validator.message);
- }
- });
- }
- function validateOptions(options) {
- return validate(sign_options_schema, false, options, "options");
- }
- function validatePayload(payload) {
- return validate(registered_claims_schema, true, payload, "payload");
- }
- var options_to_payload = {
- "audience": "aud",
- "issuer": "iss",
- "subject": "sub",
- "jwtid": "jti"
- };
- var options_for_objects = [
- "expiresIn",
- "notBefore",
- "noTimestamp",
- "audience",
- "issuer",
- "subject",
- "jwtid"
- ];
- module2.exports = function(payload, secretOrPrivateKey, options, callback) {
- if (typeof options === "function") {
- callback = options;
- options = {};
- } else {
- options = options || {};
- }
- const isObjectPayload = typeof payload === "object" && !Buffer.isBuffer(payload);
- const header = Object.assign({
- alg: options.algorithm || "HS256",
- typ: isObjectPayload ? "JWT" : void 0,
- kid: options.keyid
- }, options.header);
- function failure(err) {
- if (callback) {
- return callback(err);
- }
- throw err;
- }
- if (!secretOrPrivateKey && options.algorithm !== "none") {
- return failure(new Error("secretOrPrivateKey must have a value"));
- }
- if (secretOrPrivateKey != null && !(secretOrPrivateKey instanceof KeyObject)) {
- try {
- secretOrPrivateKey = createPrivateKey(secretOrPrivateKey);
- } catch (_) {
- try {
- secretOrPrivateKey = createSecretKey(typeof secretOrPrivateKey === "string" ? Buffer.from(secretOrPrivateKey) : secretOrPrivateKey);
- } catch (_2) {
- return failure(new Error("secretOrPrivateKey is not valid key material"));
- }
- }
- }
- if (header.alg.startsWith("HS") && secretOrPrivateKey.type !== "secret") {
- return failure(new Error(`secretOrPrivateKey must be a symmetric key when using ${header.alg}`));
- } else if (/^(?:RS|PS|ES)/.test(header.alg)) {
- if (secretOrPrivateKey.type !== "private") {
- return failure(new Error(`secretOrPrivateKey must be an asymmetric key when using ${header.alg}`));
- }
- if (!options.allowInsecureKeySizes && !header.alg.startsWith("ES") && secretOrPrivateKey.asymmetricKeyDetails !== void 0 && //KeyObject.asymmetricKeyDetails is supported in Node 15+
- secretOrPrivateKey.asymmetricKeyDetails.modulusLength < 2048) {
- return failure(new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${header.alg}`));
- }
- }
- if (typeof payload === "undefined") {
- return failure(new Error("payload is required"));
- } else if (isObjectPayload) {
- try {
- validatePayload(payload);
- } catch (error) {
- return failure(error);
- }
- if (!options.mutatePayload) {
- payload = Object.assign({}, payload);
- }
- } else {
- const invalid_options = options_for_objects.filter(function(opt) {
- return typeof options[opt] !== "undefined";
- });
- if (invalid_options.length > 0) {
- return failure(new Error("invalid " + invalid_options.join(",") + " option for " + typeof payload + " payload"));
- }
- }
- if (typeof payload.exp !== "undefined" && typeof options.expiresIn !== "undefined") {
- return failure(new Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));
- }
- if (typeof payload.nbf !== "undefined" && typeof options.notBefore !== "undefined") {
- return failure(new Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));
- }
- try {
- validateOptions(options);
- } catch (error) {
- return failure(error);
- }
- if (!options.allowInvalidAsymmetricKeyTypes) {
- try {
- validateAsymmetricKey(header.alg, secretOrPrivateKey);
- } catch (error) {
- return failure(error);
- }
- }
- const timestamp = payload.iat || Math.floor(Date.now() / 1e3);
- if (options.noTimestamp) {
- delete payload.iat;
- } else if (isObjectPayload) {
- payload.iat = timestamp;
- }
- if (typeof options.notBefore !== "undefined") {
- try {
- payload.nbf = timespan(options.notBefore, timestamp);
- } catch (err) {
- return failure(err);
- }
- if (typeof payload.nbf === "undefined") {
- return failure(new Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));
- }
- }
- if (typeof options.expiresIn !== "undefined" && typeof payload === "object") {
- try {
- payload.exp = timespan(options.expiresIn, timestamp);
- } catch (err) {
- return failure(err);
- }
- if (typeof payload.exp === "undefined") {
- return failure(new Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));
- }
- }
- Object.keys(options_to_payload).forEach(function(key) {
- const claim = options_to_payload[key];
- if (typeof options[key] !== "undefined") {
- if (typeof payload[claim] !== "undefined") {
- return failure(new Error('Bad "options.' + key + '" option. The payload already has an "' + claim + '" property.'));
- }
- payload[claim] = options[key];
- }
- });
- const encoding = options.encoding || "utf8";
- if (typeof callback === "function") {
- callback = callback && once(callback);
- jws.createSign({
- header,
- privateKey: secretOrPrivateKey,
- payload,
- encoding
- }).once("error", callback).once("done", function(signature) {
- if (!options.allowInsecureKeySizes && /^(?:RS|PS)/.test(header.alg) && signature.length < 256) {
- return callback(new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${header.alg}`));
- }
- callback(null, signature);
- });
- } else {
- let signature = jws.sign({ header, payload, secret: secretOrPrivateKey, encoding });
- if (!options.allowInsecureKeySizes && /^(?:RS|PS)/.test(header.alg) && signature.length < 256) {
- throw new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${header.alg}`);
- }
- return signature;
- }
- };
- }
-});
-
-// ../../node_modules/jsonwebtoken/index.js
-var require_jsonwebtoken = __commonJS({
- "../../node_modules/jsonwebtoken/index.js"(exports2, module2) {
- module2.exports = {
- decode: require_decode(),
- verify: require_verify(),
- sign: require_sign(),
- JsonWebTokenError: require_JsonWebTokenError(),
- NotBeforeError: require_NotBeforeError(),
- TokenExpiredError: require_TokenExpiredError()
- };
- }
-});
-
-// src/index.ts
-var src_exports = {};
-__export(src_exports, {
- plugin: () => plugin
-});
-module.exports = __toCommonJS(src_exports);
-var import_jsonwebtoken = __toESM(require_jsonwebtoken());
-var algorithms = [
- "HS256",
- "HS384",
- "HS512",
- "RS256",
- "RS384",
- "RS512",
- "PS256",
- "PS384",
- "PS512",
- "ES256",
- "ES384",
- "ES512",
- "none"
-];
-var defaultAlgorithm = algorithms[0];
-var plugin = {
- authentication: {
- name: "jwt",
- label: "JWT Bearer",
- shortLabel: "JWT",
- args: [
- {
- type: "select",
- name: "algorithm",
- label: "Algorithm",
- hideLabel: true,
- defaultValue: defaultAlgorithm,
- options: algorithms.map((value) => ({ label: value === "none" ? "None" : value, value }))
- },
- {
- type: "text",
- name: "secret",
- label: "Secret or Private Key",
- password: true,
- optional: true,
- multiLine: true
- },
- {
- type: "checkbox",
- name: "secretBase64",
- label: "Secret is base64 encoded"
- },
- {
- type: "editor",
- name: "payload",
- label: "Payload",
- language: "json",
- defaultValue: '{\n "foo": "bar"\n}',
- placeholder: "{ }"
- }
- ],
- async onApply(_ctx, { values }) {
- const { algorithm, secret: _secret, secretBase64, payload } = values;
- const secret = secretBase64 ? Buffer.from(`${_secret}`, "base64") : `${_secret}`;
- const token = import_jsonwebtoken.default.sign(`${payload}`, secret, { algorithm });
- const value = `Bearer ${token}`;
- return { setHeaders: [{ name: "Authorization", value }] };
- }
- }
-};
-// Annotate the CommonJS export names for ESM import in node:
-0 && (module.exports = {
- plugin
-});
-/*! Bundled license information:
-
-safe-buffer/index.js:
- (*! safe-buffer. MIT License. Feross Aboukhadijeh *)
-*/
diff --git a/src-tauri/vendored/plugins/auth-oauth2/build/index.js b/src-tauri/vendored/plugins/auth-oauth2/build/index.js
deleted file mode 100644
index bbd05584..00000000
--- a/src-tauri/vendored/plugins/auth-oauth2/build/index.js
+++ /dev/null
@@ -1,728 +0,0 @@
-"use strict";
-var __defProp = Object.defineProperty;
-var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
-var __getOwnPropNames = Object.getOwnPropertyNames;
-var __hasOwnProp = Object.prototype.hasOwnProperty;
-var __export = (target, all) => {
- for (var name in all)
- __defProp(target, name, { get: all[name], enumerable: true });
-};
-var __copyProps = (to, from, except, desc) => {
- if (from && typeof from === "object" || typeof from === "function") {
- for (let key of __getOwnPropNames(from))
- if (!__hasOwnProp.call(to, key) && key !== except)
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
- }
- return to;
-};
-var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
-
-// src/index.ts
-var src_exports = {};
-__export(src_exports, {
- plugin: () => plugin
-});
-module.exports = __toCommonJS(src_exports);
-
-// src/grants/authorizationCode.ts
-var import_node_crypto = require("node:crypto");
-
-// src/getAccessToken.ts
-var import_node_fs = require("node:fs");
-async function getAccessToken(ctx, {
- accessTokenUrl,
- scope,
- audience,
- params,
- grantType,
- credentialsInBody,
- clientId,
- clientSecret
-}) {
- console.log("Getting access token", accessTokenUrl);
- const httpRequest = {
- method: "POST",
- url: accessTokenUrl,
- bodyType: "application/x-www-form-urlencoded",
- body: {
- form: [
- { name: "grant_type", value: grantType },
- ...params
- ]
- },
- headers: [
- { name: "User-Agent", value: "yaak" },
- { name: "Accept", value: "application/x-www-form-urlencoded, application/json" },
- { name: "Content-Type", value: "application/x-www-form-urlencoded" }
- ]
- };
- if (scope) httpRequest.body.form.push({ name: "scope", value: scope });
- if (scope) httpRequest.body.form.push({ name: "audience", value: audience });
- if (credentialsInBody) {
- httpRequest.body.form.push({ name: "client_id", value: clientId });
- httpRequest.body.form.push({ name: "client_secret", value: clientSecret });
- } else {
- const value = "Basic " + Buffer.from(`${clientId}:${clientSecret}`).toString("base64");
- httpRequest.headers.push({ name: "Authorization", value });
- }
- const resp = await ctx.httpRequest.send({ httpRequest });
- const body = resp.bodyPath ? (0, import_node_fs.readFileSync)(resp.bodyPath, "utf8") : "";
- if (resp.status < 200 || resp.status >= 300) {
- throw new Error("Failed to fetch access token with status=" + resp.status + " and body=" + body);
- }
- let response;
- try {
- response = JSON.parse(body);
- } catch {
- response = Object.fromEntries(new URLSearchParams(body));
- }
- if (response.error) {
- throw new Error("Failed to fetch access token with " + response.error);
- }
- return response;
-}
-
-// src/getOrRefreshAccessToken.ts
-var import_node_fs2 = require("node:fs");
-
-// src/store.ts
-async function storeToken(ctx, contextId, response) {
- if (!response.access_token) {
- throw new Error(`Token not found in response`);
- }
- const expiresAt = response.expires_in ? Date.now() + response.expires_in * 1e3 : null;
- const token = {
- response,
- expiresAt
- };
- await ctx.store.set(tokenStoreKey(contextId), token);
- return token;
-}
-async function getToken(ctx, contextId) {
- return ctx.store.get(tokenStoreKey(contextId));
-}
-async function deleteToken(ctx, contextId) {
- return ctx.store.delete(tokenStoreKey(contextId));
-}
-async function resetDataDirKey(ctx, contextId) {
- const key = (/* @__PURE__ */ new Date()).toISOString();
- return ctx.store.set(dataDirStoreKey(contextId), key);
-}
-async function getDataDirKey(ctx, contextId) {
- const key = await ctx.store.get(dataDirStoreKey(contextId)) ?? "default";
- return `${contextId}::${key}`;
-}
-function tokenStoreKey(context_id) {
- return ["token", context_id].join("::");
-}
-function dataDirStoreKey(context_id) {
- return ["data_dir", context_id].join("::");
-}
-
-// src/getOrRefreshAccessToken.ts
-async function getOrRefreshAccessToken(ctx, contextId, {
- scope,
- accessTokenUrl,
- credentialsInBody,
- clientId,
- clientSecret,
- forceRefresh
-}) {
- const token = await getToken(ctx, contextId);
- if (token == null) {
- return null;
- }
- const now = Date.now();
- const isExpired = token.expiresAt && now > token.expiresAt;
- if (!isExpired && !forceRefresh) {
- return token;
- }
- if (!token.response.refresh_token) {
- return null;
- }
- const httpRequest = {
- method: "POST",
- url: accessTokenUrl,
- bodyType: "application/x-www-form-urlencoded",
- body: {
- form: [
- { name: "grant_type", value: "refresh_token" },
- { name: "refresh_token", value: token.response.refresh_token }
- ]
- },
- headers: [
- { name: "User-Agent", value: "yaak" },
- { name: "Accept", value: "application/x-www-form-urlencoded, application/json" },
- { name: "Content-Type", value: "application/x-www-form-urlencoded" }
- ]
- };
- if (scope) httpRequest.body.form.push({ name: "scope", value: scope });
- if (credentialsInBody) {
- httpRequest.body.form.push({ name: "client_id", value: clientId });
- httpRequest.body.form.push({ name: "client_secret", value: clientSecret });
- } else {
- const value = "Basic " + Buffer.from(`${clientId}:${clientSecret}`).toString("base64");
- httpRequest.headers.push({ name: "Authorization", value });
- }
- const resp = await ctx.httpRequest.send({ httpRequest });
- if (resp.status === 401) {
- console.log("Unauthorized refresh_token request");
- await deleteToken(ctx, contextId);
- return null;
- }
- const body = resp.bodyPath ? (0, import_node_fs2.readFileSync)(resp.bodyPath, "utf8") : "";
- if (resp.status < 200 || resp.status >= 300) {
- throw new Error("Failed to refresh access token with status=" + resp.status + " and body=" + body);
- }
- let response;
- try {
- response = JSON.parse(body);
- } catch {
- response = Object.fromEntries(new URLSearchParams(body));
- }
- if (response.error) {
- throw new Error(`Failed to fetch access token with ${response.error} -> ${response.error_description}`);
- }
- const newResponse = {
- ...response,
- // Assign a new one or keep the old one,
- refresh_token: response.refresh_token ?? token.response.refresh_token
- };
- return storeToken(ctx, contextId, newResponse);
-}
-
-// src/grants/authorizationCode.ts
-var PKCE_SHA256 = "S256";
-var PKCE_PLAIN = "plain";
-var DEFAULT_PKCE_METHOD = PKCE_SHA256;
-async function getAuthorizationCode(ctx, contextId, {
- authorizationUrl: authorizationUrlRaw,
- accessTokenUrl,
- clientId,
- clientSecret,
- redirectUri,
- scope,
- state,
- audience,
- credentialsInBody,
- pkce
-}) {
- const token = await getOrRefreshAccessToken(ctx, contextId, {
- accessTokenUrl,
- scope,
- clientId,
- clientSecret,
- credentialsInBody
- });
- if (token != null) {
- return token;
- }
- const authorizationUrl = new URL(`${authorizationUrlRaw ?? ""}`);
- authorizationUrl.searchParams.set("response_type", "code");
- authorizationUrl.searchParams.set("client_id", clientId);
- if (redirectUri) authorizationUrl.searchParams.set("redirect_uri", redirectUri);
- if (scope) authorizationUrl.searchParams.set("scope", scope);
- if (state) authorizationUrl.searchParams.set("state", state);
- if (audience) authorizationUrl.searchParams.set("audience", audience);
- if (pkce) {
- const verifier = pkce.codeVerifier || createPkceCodeVerifier();
- const challengeMethod = pkce.challengeMethod || DEFAULT_PKCE_METHOD;
- authorizationUrl.searchParams.set("code_challenge", createPkceCodeChallenge(verifier, challengeMethod));
- authorizationUrl.searchParams.set("code_challenge_method", challengeMethod);
- }
- return new Promise(async (resolve, reject) => {
- const authorizationUrlStr = authorizationUrl.toString();
- console.log("Authorizing", authorizationUrlStr);
- let foundCode = false;
- let { close } = await ctx.window.openUrl({
- url: authorizationUrlStr,
- label: "oauth-authorization-url",
- dataDirKey: await getDataDirKey(ctx, contextId),
- async onClose() {
- if (!foundCode) {
- reject(new Error("Authorization window closed"));
- }
- },
- async onNavigate({ url: urlStr }) {
- const url = new URL(urlStr);
- if (url.searchParams.has("error")) {
- return reject(new Error(`Failed to authorize: ${url.searchParams.get("error")}`));
- }
- const code = url.searchParams.get("code");
- if (!code) {
- return;
- }
- foundCode = true;
- close();
- const response = await getAccessToken(ctx, {
- grantType: "authorization_code",
- accessTokenUrl,
- clientId,
- clientSecret,
- scope,
- audience,
- credentialsInBody,
- params: [
- { name: "code", value: code },
- ...redirectUri ? [{ name: "redirect_uri", value: redirectUri }] : []
- ]
- });
- try {
- resolve(await storeToken(ctx, contextId, response));
- } catch (err) {
- reject(err);
- }
- }
- });
- });
-}
-function createPkceCodeVerifier() {
- return encodeForPkce((0, import_node_crypto.randomBytes)(32));
-}
-function createPkceCodeChallenge(verifier, method) {
- if (method === "plain") {
- return verifier;
- }
- const hash = encodeForPkce((0, import_node_crypto.createHash)("sha256").update(verifier).digest());
- return hash.replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
-}
-function encodeForPkce(bytes) {
- return bytes.toString("base64").replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
-}
-
-// src/grants/clientCredentials.ts
-async function getClientCredentials(ctx, contextId, {
- accessTokenUrl,
- clientId,
- clientSecret,
- scope,
- audience,
- credentialsInBody
-}) {
- const token = await getToken(ctx, contextId);
- if (token) {
- }
- const response = await getAccessToken(ctx, {
- grantType: "client_credentials",
- accessTokenUrl,
- audience,
- clientId,
- clientSecret,
- scope,
- credentialsInBody,
- params: []
- });
- return storeToken(ctx, contextId, response);
-}
-
-// src/grants/implicit.ts
-function getImplicit(ctx, contextId, {
- authorizationUrl: authorizationUrlRaw,
- responseType,
- clientId,
- redirectUri,
- scope,
- state,
- audience
-}) {
- return new Promise(async (resolve, reject) => {
- const token = await getToken(ctx, contextId);
- if (token) {
- }
- const authorizationUrl = new URL(`${authorizationUrlRaw ?? ""}`);
- authorizationUrl.searchParams.set("response_type", "token");
- authorizationUrl.searchParams.set("client_id", clientId);
- if (redirectUri) authorizationUrl.searchParams.set("redirect_uri", redirectUri);
- if (scope) authorizationUrl.searchParams.set("scope", scope);
- if (state) authorizationUrl.searchParams.set("state", state);
- if (audience) authorizationUrl.searchParams.set("audience", audience);
- if (responseType.includes("id_token")) {
- authorizationUrl.searchParams.set("nonce", String(Math.floor(Math.random() * 9999999999999) + 1));
- }
- const authorizationUrlStr = authorizationUrl.toString();
- let foundAccessToken = false;
- let { close } = await ctx.window.openUrl({
- url: authorizationUrlStr,
- label: "oauth-authorization-url",
- async onClose() {
- if (!foundAccessToken) {
- reject(new Error("Authorization window closed"));
- }
- },
- async onNavigate({ url: urlStr }) {
- const url = new URL(urlStr);
- if (url.searchParams.has("error")) {
- return reject(Error(`Failed to authorize: ${url.searchParams.get("error")}`));
- }
- const hash = url.hash.slice(1);
- const params = new URLSearchParams(hash);
- const accessToken = params.get("access_token");
- if (!accessToken) {
- return;
- }
- foundAccessToken = true;
- close();
- const response = Object.fromEntries(params);
- try {
- resolve(await storeToken(ctx, contextId, response));
- } catch (err) {
- reject(err);
- }
- }
- });
- });
-}
-
-// src/grants/password.ts
-async function getPassword(ctx, contextId, {
- accessTokenUrl,
- clientId,
- clientSecret,
- username,
- password,
- credentialsInBody,
- audience,
- scope
-}) {
- const token = await getOrRefreshAccessToken(ctx, contextId, {
- accessTokenUrl,
- scope,
- clientId,
- clientSecret,
- credentialsInBody
- });
- if (token != null) {
- return token;
- }
- const response = await getAccessToken(ctx, {
- accessTokenUrl,
- clientId,
- clientSecret,
- scope,
- audience,
- grantType: "password",
- credentialsInBody,
- params: [
- { name: "username", value: username },
- { name: "password", value: password }
- ]
- });
- return storeToken(ctx, contextId, response);
-}
-
-// src/index.ts
-var grantTypes = [
- { label: "Authorization Code", value: "authorization_code" },
- { label: "Implicit", value: "implicit" },
- { label: "Resource Owner Password Credential", value: "password" },
- { label: "Client Credentials", value: "client_credentials" }
-];
-var defaultGrantType = grantTypes[0].value;
-function hiddenIfNot(grantTypes2, ...other) {
- return (_ctx, { values }) => {
- const hasGrantType = grantTypes2.find((t) => t === String(values.grantType ?? defaultGrantType));
- const hasOtherBools = other.every((t) => t(values));
- const show = hasGrantType && hasOtherBools;
- return { hidden: !show };
- };
-}
-var authorizationUrls = [
- "https://github.com/login/oauth/authorize",
- "https://account.box.com/api/oauth2/authorize",
- "https://accounts.google.com/o/oauth2/v2/auth",
- "https://api.imgur.com/oauth2/authorize",
- "https://bitly.com/oauth/authorize",
- "https://gitlab.example.com/oauth/authorize",
- "https://medium.com/m/oauth/authorize",
- "https://public-api.wordpress.com/oauth2/authorize",
- "https://slack.com/oauth/authorize",
- "https://todoist.com/oauth/authorize",
- "https://www.dropbox.com/oauth2/authorize",
- "https://www.linkedin.com/oauth/v2/authorization",
- "https://MY_SHOP.myshopify.com/admin/oauth/access_token"
-];
-var accessTokenUrls = [
- "https://github.com/login/oauth/access_token",
- "https://api-ssl.bitly.com/oauth/access_token",
- "https://api.box.com/oauth2/token",
- "https://api.dropboxapi.com/oauth2/token",
- "https://api.imgur.com/oauth2/token",
- "https://api.medium.com/v1/tokens",
- "https://gitlab.example.com/oauth/token",
- "https://public-api.wordpress.com/oauth2/token",
- "https://slack.com/api/oauth.access",
- "https://todoist.com/oauth/access_token",
- "https://www.googleapis.com/oauth2/v4/token",
- "https://www.linkedin.com/oauth/v2/accessToken",
- "https://MY_SHOP.myshopify.com/admin/oauth/authorize"
-];
-var plugin = {
- authentication: {
- name: "oauth2",
- label: "OAuth 2.0",
- shortLabel: "OAuth 2",
- actions: [
- {
- label: "Copy Current Token",
- async onSelect(ctx, { contextId }) {
- const token = await getToken(ctx, contextId);
- if (token == null) {
- await ctx.toast.show({ message: "No token to copy", color: "warning" });
- } else {
- await ctx.clipboard.copyText(token.response.access_token);
- await ctx.toast.show({ message: "Token copied to clipboard", icon: "copy", color: "success" });
- }
- }
- },
- {
- label: "Delete Token",
- async onSelect(ctx, { contextId }) {
- if (await deleteToken(ctx, contextId)) {
- await ctx.toast.show({ message: "Token deleted", color: "success" });
- } else {
- await ctx.toast.show({ message: "No token to delete", color: "warning" });
- }
- }
- },
- {
- label: "Clear Window Session",
- async onSelect(ctx, { contextId }) {
- await resetDataDirKey(ctx, contextId);
- }
- }
- ],
- args: [
- {
- type: "select",
- name: "grantType",
- label: "Grant Type",
- hideLabel: true,
- defaultValue: defaultGrantType,
- options: grantTypes
- },
- // Always-present fields
- {
- type: "text",
- name: "clientId",
- label: "Client ID",
- optional: true
- },
- {
- type: "text",
- name: "clientSecret",
- label: "Client Secret",
- optional: true,
- password: true,
- dynamic: hiddenIfNot(["authorization_code", "password", "client_credentials"])
- },
- {
- type: "text",
- name: "authorizationUrl",
- optional: true,
- label: "Authorization URL",
- dynamic: hiddenIfNot(["authorization_code", "implicit"]),
- placeholder: authorizationUrls[0],
- completionOptions: authorizationUrls.map((url) => ({ label: url, value: url }))
- },
- {
- type: "text",
- name: "accessTokenUrl",
- optional: true,
- label: "Access Token URL",
- placeholder: accessTokenUrls[0],
- dynamic: hiddenIfNot(["authorization_code", "password", "client_credentials"]),
- completionOptions: accessTokenUrls.map((url) => ({ label: url, value: url }))
- },
- {
- type: "text",
- name: "redirectUri",
- label: "Redirect URI",
- optional: true,
- dynamic: hiddenIfNot(["authorization_code", "implicit"])
- },
- {
- type: "text",
- name: "state",
- label: "State",
- optional: true,
- dynamic: hiddenIfNot(["authorization_code", "implicit"])
- },
- {
- type: "text",
- name: "audience",
- label: "Audience",
- optional: true
- },
- {
- type: "checkbox",
- name: "usePkce",
- label: "Use PKCE",
- dynamic: hiddenIfNot(["authorization_code"])
- },
- {
- type: "select",
- name: "pkceChallengeMethod",
- label: "Code Challenge Method",
- options: [{ label: "SHA-256", value: PKCE_SHA256 }, { label: "Plain", value: PKCE_PLAIN }],
- defaultValue: DEFAULT_PKCE_METHOD,
- dynamic: hiddenIfNot(["authorization_code"], ({ usePkce }) => !!usePkce)
- },
- {
- type: "text",
- name: "pkceCodeVerifier",
- label: "Code Verifier",
- placeholder: "Automatically generated if not provided",
- optional: true,
- dynamic: hiddenIfNot(["authorization_code"], ({ usePkce }) => !!usePkce)
- },
- {
- type: "text",
- name: "username",
- label: "Username",
- optional: true,
- dynamic: hiddenIfNot(["password"])
- },
- {
- type: "text",
- name: "password",
- label: "Password",
- password: true,
- optional: true,
- dynamic: hiddenIfNot(["password"])
- },
- {
- type: "select",
- name: "responseType",
- label: "Response Type",
- defaultValue: "token",
- options: [
- { label: "Access Token", value: "token" },
- { label: "ID Token", value: "id_token" },
- { label: "ID and Access Token", value: "id_token token" }
- ],
- dynamic: hiddenIfNot(["implicit"])
- },
- {
- type: "accordion",
- label: "Advanced",
- inputs: [
- { type: "text", name: "scope", label: "Scope", optional: true },
- { type: "text", name: "headerPrefix", label: "Header Prefix", optional: true, defaultValue: "Bearer" },
- {
- type: "select",
- name: "credentials",
- label: "Send Credentials",
- defaultValue: "body",
- options: [
- { label: "In Request Body", value: "body" },
- { label: "As Basic Authentication", value: "basic" }
- ]
- }
- ]
- },
- {
- type: "accordion",
- label: "Access Token Response",
- async dynamic(ctx, { contextId }) {
- const token = await getToken(ctx, contextId);
- if (token == null) {
- return { hidden: true };
- }
- return {
- label: "Access Token Response",
- inputs: [
- {
- type: "editor",
- defaultValue: JSON.stringify(token.response, null, 2),
- hideLabel: true,
- readOnly: true,
- language: "json"
- }
- ]
- };
- }
- }
- ],
- async onApply(ctx, { values, contextId }) {
- const headerPrefix = stringArg(values, "headerPrefix");
- const grantType = stringArg(values, "grantType");
- const credentialsInBody = values.credentials === "body";
- let token;
- if (grantType === "authorization_code") {
- const authorizationUrl = stringArg(values, "authorizationUrl");
- const accessTokenUrl = stringArg(values, "accessTokenUrl");
- token = await getAuthorizationCode(ctx, contextId, {
- accessTokenUrl: accessTokenUrl.match(/^https?:\/\//) ? accessTokenUrl : `https://${accessTokenUrl}`,
- authorizationUrl: authorizationUrl.match(/^https?:\/\//) ? authorizationUrl : `https://${authorizationUrl}`,
- clientId: stringArg(values, "clientId"),
- clientSecret: stringArg(values, "clientSecret"),
- redirectUri: stringArgOrNull(values, "redirectUri"),
- scope: stringArgOrNull(values, "scope"),
- audience: stringArgOrNull(values, "audience"),
- state: stringArgOrNull(values, "state"),
- credentialsInBody,
- pkce: values.usePkce ? {
- challengeMethod: stringArg(values, "pkceChallengeMethod"),
- codeVerifier: stringArgOrNull(values, "pkceCodeVerifier")
- } : null
- });
- } else if (grantType === "implicit") {
- const authorizationUrl = stringArg(values, "authorizationUrl");
- token = await getImplicit(ctx, contextId, {
- authorizationUrl: authorizationUrl.match(/^https?:\/\//) ? authorizationUrl : `https://${authorizationUrl}`,
- clientId: stringArg(values, "clientId"),
- redirectUri: stringArgOrNull(values, "redirectUri"),
- responseType: stringArg(values, "responseType"),
- scope: stringArgOrNull(values, "scope"),
- audience: stringArgOrNull(values, "audience"),
- state: stringArgOrNull(values, "state")
- });
- } else if (grantType === "client_credentials") {
- const accessTokenUrl = stringArg(values, "accessTokenUrl");
- token = await getClientCredentials(ctx, contextId, {
- accessTokenUrl: accessTokenUrl.match(/^https?:\/\//) ? accessTokenUrl : `https://${accessTokenUrl}`,
- clientId: stringArg(values, "clientId"),
- clientSecret: stringArg(values, "clientSecret"),
- scope: stringArgOrNull(values, "scope"),
- audience: stringArgOrNull(values, "audience"),
- credentialsInBody
- });
- } else if (grantType === "password") {
- const accessTokenUrl = stringArg(values, "accessTokenUrl");
- token = await getPassword(ctx, contextId, {
- accessTokenUrl: accessTokenUrl.match(/^https?:\/\//) ? accessTokenUrl : `https://${accessTokenUrl}`,
- clientId: stringArg(values, "clientId"),
- clientSecret: stringArg(values, "clientSecret"),
- username: stringArg(values, "username"),
- password: stringArg(values, "password"),
- scope: stringArgOrNull(values, "scope"),
- audience: stringArgOrNull(values, "audience"),
- credentialsInBody
- });
- } else {
- throw new Error("Invalid grant type " + grantType);
- }
- const headerValue = `${headerPrefix} ${token.response.access_token}`.trim();
- return {
- setHeaders: [{
- name: "Authorization",
- value: headerValue
- }]
- };
- }
- }
-};
-function stringArgOrNull(values, name) {
- const arg = values[name];
- if (arg == null || arg == "") return null;
- return `${arg}`;
-}
-function stringArg(values, name) {
- const arg = stringArgOrNull(values, name);
- if (!arg) return "";
- return arg;
-}
-// Annotate the CommonJS export names for ESM import in node:
-0 && (module.exports = {
- plugin
-});
diff --git a/src-tauri/vendored/plugins/exporter-curl/build/index.js b/src-tauri/vendored/plugins/exporter-curl/build/index.js
deleted file mode 100644
index 971450fb..00000000
--- a/src-tauri/vendored/plugins/exporter-curl/build/index.js
+++ /dev/null
@@ -1,108 +0,0 @@
-"use strict";
-var __defProp = Object.defineProperty;
-var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
-var __getOwnPropNames = Object.getOwnPropertyNames;
-var __hasOwnProp = Object.prototype.hasOwnProperty;
-var __export = (target, all) => {
- for (var name in all)
- __defProp(target, name, { get: all[name], enumerable: true });
-};
-var __copyProps = (to, from, except, desc) => {
- if (from && typeof from === "object" || typeof from === "function") {
- for (let key of __getOwnPropNames(from))
- if (!__hasOwnProp.call(to, key) && key !== except)
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
- }
- return to;
-};
-var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
-
-// src/index.ts
-var src_exports = {};
-__export(src_exports, {
- convertToCurl: () => convertToCurl,
- plugin: () => plugin
-});
-module.exports = __toCommonJS(src_exports);
-var NEWLINE = "\\\n ";
-var plugin = {
- httpRequestActions: [{
- label: "Copy as Curl",
- icon: "copy",
- async onSelect(ctx, args) {
- const rendered_request = await ctx.httpRequest.render({ httpRequest: args.httpRequest, purpose: "preview" });
- const data = await convertToCurl(rendered_request);
- await ctx.clipboard.copyText(data);
- await ctx.toast.show({ message: "Curl copied to clipboard", icon: "copy", color: "success" });
- }
- }]
-};
-async function convertToCurl(request) {
- const xs = ["curl"];
- if (request.method) xs.push("-X", request.method);
- if (request.url) xs.push(quote(request.url));
- xs.push(NEWLINE);
- for (const p of (request.urlParameters ?? []).filter(onlyEnabled)) {
- xs.push("--url-query", quote(`${p.name}=${p.value}`));
- xs.push(NEWLINE);
- }
- for (const h of (request.headers ?? []).filter(onlyEnabled)) {
- xs.push("--header", quote(`${h.name}: ${h.value}`));
- xs.push(NEWLINE);
- }
- if (Array.isArray(request.body?.form)) {
- const flag = request.bodyType === "multipart/form-data" ? "--form" : "--data";
- for (const p of (request.body?.form ?? []).filter(onlyEnabled)) {
- if (p.file) {
- let v = `${p.name}=@${p.file}`;
- v += p.contentType ? `;type=${p.contentType}` : "";
- xs.push(flag, v);
- } else {
- xs.push(flag, quote(`${p.name}=${p.value}`));
- }
- xs.push(NEWLINE);
- }
- } else if (typeof request.body?.query === "string") {
- const body = { query: request.body.query || "", variables: maybeParseJSON(request.body.variables, void 0) };
- xs.push("--data-raw", `${quote(JSON.stringify(body))}`);
- xs.push(NEWLINE);
- } else if (typeof request.body?.text === "string") {
- xs.push("--data-raw", `${quote(request.body.text)}`);
- xs.push(NEWLINE);
- }
- if (request.authenticationType === "basic" || request.authenticationType === "digest") {
- if (request.authenticationType === "digest") xs.push("--digest");
- xs.push(
- "--user",
- quote(`${request.authentication?.username ?? ""}:${request.authentication?.password ?? ""}`)
- );
- xs.push(NEWLINE);
- }
- if (request.authenticationType === "bearer") {
- xs.push("--header", quote(`Authorization: Bearer ${request.authentication?.token ?? ""}`));
- xs.push(NEWLINE);
- }
- if (xs[xs.length - 1] === NEWLINE) {
- xs.splice(xs.length - 1, 1);
- }
- return xs.join(" ");
-}
-function quote(arg) {
- const escaped = arg.replace(/'/g, "\\'");
- return `'${escaped}'`;
-}
-function onlyEnabled(v) {
- return v.enabled !== false && !!v.name;
-}
-function maybeParseJSON(v, fallback) {
- try {
- return JSON.parse(v);
- } catch (err) {
- return fallback;
- }
-}
-// Annotate the CommonJS export names for ESM import in node:
-0 && (module.exports = {
- convertToCurl,
- plugin
-});
diff --git a/src-tauri/vendored/plugins/filter-jsonpath/build/index.js b/src-tauri/vendored/plugins/filter-jsonpath/build/index.js
deleted file mode 100644
index 703b625b..00000000
--- a/src-tauri/vendored/plugins/filter-jsonpath/build/index.js
+++ /dev/null
@@ -1,1739 +0,0 @@
-"use strict";
-var __create = Object.create;
-var __defProp = Object.defineProperty;
-var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
-var __getOwnPropNames = Object.getOwnPropertyNames;
-var __getProtoOf = Object.getPrototypeOf;
-var __hasOwnProp = Object.prototype.hasOwnProperty;
-var __export = (target, all) => {
- for (var name in all)
- __defProp(target, name, { get: all[name], enumerable: true });
-};
-var __copyProps = (to, from, except, desc) => {
- if (from && typeof from === "object" || typeof from === "function") {
- for (let key of __getOwnPropNames(from))
- if (!__hasOwnProp.call(to, key) && key !== except)
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
- }
- return to;
-};
-var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
- // If the importer is in node compatibility mode or this is not an ESM
- // file that has been converted to a CommonJS file using a Babel-
- // compatible transform (i.e. "__esModule" has not been set), then set
- // "default" to the CommonJS "module.exports" for node compatibility.
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
- mod
-));
-var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
-
-// src/index.ts
-var src_exports = {};
-__export(src_exports, {
- plugin: () => plugin2
-});
-module.exports = __toCommonJS(src_exports);
-
-// node_modules/jsonpath-plus/dist/index-node-esm.js
-var import_vm = __toESM(require("vm"), 1);
-var Hooks = class {
- /**
- * @callback HookCallback
- * @this {*|Jsep} this
- * @param {Jsep} env
- * @returns: void
- */
- /**
- * Adds the given callback to the list of callbacks for the given hook.
- *
- * The callback will be invoked when the hook it is registered for is run.
- *
- * One callback function can be registered to multiple hooks and the same hook multiple times.
- *
- * @param {string|object} name The name of the hook, or an object of callbacks keyed by name
- * @param {HookCallback|boolean} callback The callback function which is given environment variables.
- * @param {?boolean} [first=false] Will add the hook to the top of the list (defaults to the bottom)
- * @public
- */
- add(name, callback, first) {
- if (typeof arguments[0] != "string") {
- for (let name2 in arguments[0]) {
- this.add(name2, arguments[0][name2], arguments[1]);
- }
- } else {
- (Array.isArray(name) ? name : [name]).forEach(function(name2) {
- this[name2] = this[name2] || [];
- if (callback) {
- this[name2][first ? "unshift" : "push"](callback);
- }
- }, this);
- }
- }
- /**
- * Runs a hook invoking all registered callbacks with the given environment variables.
- *
- * Callbacks will be invoked synchronously and in the order in which they were registered.
- *
- * @param {string} name The name of the hook.
- * @param {Object} env The environment variables of the hook passed to all callbacks registered.
- * @public
- */
- run(name, env) {
- this[name] = this[name] || [];
- this[name].forEach(function(callback) {
- callback.call(env && env.context ? env.context : env, env);
- });
- }
-};
-var Plugins = class {
- constructor(jsep2) {
- this.jsep = jsep2;
- this.registered = {};
- }
- /**
- * @callback PluginSetup
- * @this {Jsep} jsep
- * @returns: void
- */
- /**
- * Adds the given plugin(s) to the registry
- *
- * @param {object} plugins
- * @param {string} plugins.name The name of the plugin
- * @param {PluginSetup} plugins.init The init function
- * @public
- */
- register(...plugins) {
- plugins.forEach((plugin3) => {
- if (typeof plugin3 !== "object" || !plugin3.name || !plugin3.init) {
- throw new Error("Invalid JSEP plugin format");
- }
- if (this.registered[plugin3.name]) {
- return;
- }
- plugin3.init(this.jsep);
- this.registered[plugin3.name] = plugin3;
- });
- }
-};
-var Jsep = class _Jsep {
- /**
- * @returns {string}
- */
- static get version() {
- return "1.4.0";
- }
- /**
- * @returns {string}
- */
- static toString() {
- return "JavaScript Expression Parser (JSEP) v" + _Jsep.version;
- }
- // ==================== CONFIG ================================
- /**
- * @method addUnaryOp
- * @param {string} op_name The name of the unary op to add
- * @returns {Jsep}
- */
- static addUnaryOp(op_name) {
- _Jsep.max_unop_len = Math.max(op_name.length, _Jsep.max_unop_len);
- _Jsep.unary_ops[op_name] = 1;
- return _Jsep;
- }
- /**
- * @method jsep.addBinaryOp
- * @param {string} op_name The name of the binary op to add
- * @param {number} precedence The precedence of the binary op (can be a float). Higher number = higher precedence
- * @param {boolean} [isRightAssociative=false] whether operator is right-associative
- * @returns {Jsep}
- */
- static addBinaryOp(op_name, precedence, isRightAssociative) {
- _Jsep.max_binop_len = Math.max(op_name.length, _Jsep.max_binop_len);
- _Jsep.binary_ops[op_name] = precedence;
- if (isRightAssociative) {
- _Jsep.right_associative.add(op_name);
- } else {
- _Jsep.right_associative.delete(op_name);
- }
- return _Jsep;
- }
- /**
- * @method addIdentifierChar
- * @param {string} char The additional character to treat as a valid part of an identifier
- * @returns {Jsep}
- */
- static addIdentifierChar(char) {
- _Jsep.additional_identifier_chars.add(char);
- return _Jsep;
- }
- /**
- * @method addLiteral
- * @param {string} literal_name The name of the literal to add
- * @param {*} literal_value The value of the literal
- * @returns {Jsep}
- */
- static addLiteral(literal_name, literal_value) {
- _Jsep.literals[literal_name] = literal_value;
- return _Jsep;
- }
- /**
- * @method removeUnaryOp
- * @param {string} op_name The name of the unary op to remove
- * @returns {Jsep}
- */
- static removeUnaryOp(op_name) {
- delete _Jsep.unary_ops[op_name];
- if (op_name.length === _Jsep.max_unop_len) {
- _Jsep.max_unop_len = _Jsep.getMaxKeyLen(_Jsep.unary_ops);
- }
- return _Jsep;
- }
- /**
- * @method removeAllUnaryOps
- * @returns {Jsep}
- */
- static removeAllUnaryOps() {
- _Jsep.unary_ops = {};
- _Jsep.max_unop_len = 0;
- return _Jsep;
- }
- /**
- * @method removeIdentifierChar
- * @param {string} char The additional character to stop treating as a valid part of an identifier
- * @returns {Jsep}
- */
- static removeIdentifierChar(char) {
- _Jsep.additional_identifier_chars.delete(char);
- return _Jsep;
- }
- /**
- * @method removeBinaryOp
- * @param {string} op_name The name of the binary op to remove
- * @returns {Jsep}
- */
- static removeBinaryOp(op_name) {
- delete _Jsep.binary_ops[op_name];
- if (op_name.length === _Jsep.max_binop_len) {
- _Jsep.max_binop_len = _Jsep.getMaxKeyLen(_Jsep.binary_ops);
- }
- _Jsep.right_associative.delete(op_name);
- return _Jsep;
- }
- /**
- * @method removeAllBinaryOps
- * @returns {Jsep}
- */
- static removeAllBinaryOps() {
- _Jsep.binary_ops = {};
- _Jsep.max_binop_len = 0;
- return _Jsep;
- }
- /**
- * @method removeLiteral
- * @param {string} literal_name The name of the literal to remove
- * @returns {Jsep}
- */
- static removeLiteral(literal_name) {
- delete _Jsep.literals[literal_name];
- return _Jsep;
- }
- /**
- * @method removeAllLiterals
- * @returns {Jsep}
- */
- static removeAllLiterals() {
- _Jsep.literals = {};
- return _Jsep;
- }
- // ==================== END CONFIG ============================
- /**
- * @returns {string}
- */
- get char() {
- return this.expr.charAt(this.index);
- }
- /**
- * @returns {number}
- */
- get code() {
- return this.expr.charCodeAt(this.index);
- }
- /**
- * @param {string} expr a string with the passed in express
- * @returns Jsep
- */
- constructor(expr) {
- this.expr = expr;
- this.index = 0;
- }
- /**
- * static top-level parser
- * @returns {jsep.Expression}
- */
- static parse(expr) {
- return new _Jsep(expr).parse();
- }
- /**
- * Get the longest key length of any object
- * @param {object} obj
- * @returns {number}
- */
- static getMaxKeyLen(obj) {
- return Math.max(0, ...Object.keys(obj).map((k) => k.length));
- }
- /**
- * `ch` is a character code in the next three functions
- * @param {number} ch
- * @returns {boolean}
- */
- static isDecimalDigit(ch) {
- return ch >= 48 && ch <= 57;
- }
- /**
- * Returns the precedence of a binary operator or `0` if it isn't a binary operator. Can be float.
- * @param {string} op_val
- * @returns {number}
- */
- static binaryPrecedence(op_val) {
- return _Jsep.binary_ops[op_val] || 0;
- }
- /**
- * Looks for start of identifier
- * @param {number} ch
- * @returns {boolean}
- */
- static isIdentifierStart(ch) {
- return ch >= 65 && ch <= 90 || // A...Z
- ch >= 97 && ch <= 122 || // a...z
- ch >= 128 && !_Jsep.binary_ops[String.fromCharCode(ch)] || // any non-ASCII that is not an operator
- _Jsep.additional_identifier_chars.has(String.fromCharCode(ch));
- }
- /**
- * @param {number} ch
- * @returns {boolean}
- */
- static isIdentifierPart(ch) {
- return _Jsep.isIdentifierStart(ch) || _Jsep.isDecimalDigit(ch);
- }
- /**
- * throw error at index of the expression
- * @param {string} message
- * @throws
- */
- throwError(message) {
- const error = new Error(message + " at character " + this.index);
- error.index = this.index;
- error.description = message;
- throw error;
- }
- /**
- * Run a given hook
- * @param {string} name
- * @param {jsep.Expression|false} [node]
- * @returns {?jsep.Expression}
- */
- runHook(name, node) {
- if (_Jsep.hooks[name]) {
- const env = {
- context: this,
- node
- };
- _Jsep.hooks.run(name, env);
- return env.node;
- }
- return node;
- }
- /**
- * Runs a given hook until one returns a node
- * @param {string} name
- * @returns {?jsep.Expression}
- */
- searchHook(name) {
- if (_Jsep.hooks[name]) {
- const env = {
- context: this
- };
- _Jsep.hooks[name].find(function(callback) {
- callback.call(env.context, env);
- return env.node;
- });
- return env.node;
- }
- }
- /**
- * Push `index` up to the next non-space character
- */
- gobbleSpaces() {
- let ch = this.code;
- while (ch === _Jsep.SPACE_CODE || ch === _Jsep.TAB_CODE || ch === _Jsep.LF_CODE || ch === _Jsep.CR_CODE) {
- ch = this.expr.charCodeAt(++this.index);
- }
- this.runHook("gobble-spaces");
- }
- /**
- * Top-level method to parse all expressions and returns compound or single node
- * @returns {jsep.Expression}
- */
- parse() {
- this.runHook("before-all");
- const nodes = this.gobbleExpressions();
- const node = nodes.length === 1 ? nodes[0] : {
- type: _Jsep.COMPOUND,
- body: nodes
- };
- return this.runHook("after-all", node);
- }
- /**
- * top-level parser (but can be reused within as well)
- * @param {number} [untilICode]
- * @returns {jsep.Expression[]}
- */
- gobbleExpressions(untilICode) {
- let nodes = [], ch_i, node;
- while (this.index < this.expr.length) {
- ch_i = this.code;
- if (ch_i === _Jsep.SEMCOL_CODE || ch_i === _Jsep.COMMA_CODE) {
- this.index++;
- } else {
- if (node = this.gobbleExpression()) {
- nodes.push(node);
- } else if (this.index < this.expr.length) {
- if (ch_i === untilICode) {
- break;
- }
- this.throwError('Unexpected "' + this.char + '"');
- }
- }
- }
- return nodes;
- }
- /**
- * The main parsing function.
- * @returns {?jsep.Expression}
- */
- gobbleExpression() {
- const node = this.searchHook("gobble-expression") || this.gobbleBinaryExpression();
- this.gobbleSpaces();
- return this.runHook("after-expression", node);
- }
- /**
- * Search for the operation portion of the string (e.g. `+`, `===`)
- * Start by taking the longest possible binary operations (3 characters: `===`, `!==`, `>>>`)
- * and move down from 3 to 2 to 1 character until a matching binary operation is found
- * then, return that binary operation
- * @returns {string|boolean}
- */
- gobbleBinaryOp() {
- this.gobbleSpaces();
- let to_check = this.expr.substr(this.index, _Jsep.max_binop_len);
- let tc_len = to_check.length;
- while (tc_len > 0) {
- if (_Jsep.binary_ops.hasOwnProperty(to_check) && (!_Jsep.isIdentifierStart(this.code) || this.index + to_check.length < this.expr.length && !_Jsep.isIdentifierPart(this.expr.charCodeAt(this.index + to_check.length)))) {
- this.index += tc_len;
- return to_check;
- }
- to_check = to_check.substr(0, --tc_len);
- }
- return false;
- }
- /**
- * This function is responsible for gobbling an individual expression,
- * e.g. `1`, `1+2`, `a+(b*2)-Math.sqrt(2)`
- * @returns {?jsep.BinaryExpression}
- */
- gobbleBinaryExpression() {
- let node, biop, prec, stack, biop_info, left, right, i, cur_biop;
- left = this.gobbleToken();
- if (!left) {
- return left;
- }
- biop = this.gobbleBinaryOp();
- if (!biop) {
- return left;
- }
- biop_info = {
- value: biop,
- prec: _Jsep.binaryPrecedence(biop),
- right_a: _Jsep.right_associative.has(biop)
- };
- right = this.gobbleToken();
- if (!right) {
- this.throwError("Expected expression after " + biop);
- }
- stack = [left, biop_info, right];
- while (biop = this.gobbleBinaryOp()) {
- prec = _Jsep.binaryPrecedence(biop);
- if (prec === 0) {
- this.index -= biop.length;
- break;
- }
- biop_info = {
- value: biop,
- prec,
- right_a: _Jsep.right_associative.has(biop)
- };
- cur_biop = biop;
- const comparePrev = (prev) => biop_info.right_a && prev.right_a ? prec > prev.prec : prec <= prev.prec;
- while (stack.length > 2 && comparePrev(stack[stack.length - 2])) {
- right = stack.pop();
- biop = stack.pop().value;
- left = stack.pop();
- node = {
- type: _Jsep.BINARY_EXP,
- operator: biop,
- left,
- right
- };
- stack.push(node);
- }
- node = this.gobbleToken();
- if (!node) {
- this.throwError("Expected expression after " + cur_biop);
- }
- stack.push(biop_info, node);
- }
- i = stack.length - 1;
- node = stack[i];
- while (i > 1) {
- node = {
- type: _Jsep.BINARY_EXP,
- operator: stack[i - 1].value,
- left: stack[i - 2],
- right: node
- };
- i -= 2;
- }
- return node;
- }
- /**
- * An individual part of a binary expression:
- * e.g. `foo.bar(baz)`, `1`, `"abc"`, `(a % 2)` (because it's in parenthesis)
- * @returns {boolean|jsep.Expression}
- */
- gobbleToken() {
- let ch, to_check, tc_len, node;
- this.gobbleSpaces();
- node = this.searchHook("gobble-token");
- if (node) {
- return this.runHook("after-token", node);
- }
- ch = this.code;
- if (_Jsep.isDecimalDigit(ch) || ch === _Jsep.PERIOD_CODE) {
- return this.gobbleNumericLiteral();
- }
- if (ch === _Jsep.SQUOTE_CODE || ch === _Jsep.DQUOTE_CODE) {
- node = this.gobbleStringLiteral();
- } else if (ch === _Jsep.OBRACK_CODE) {
- node = this.gobbleArray();
- } else {
- to_check = this.expr.substr(this.index, _Jsep.max_unop_len);
- tc_len = to_check.length;
- while (tc_len > 0) {
- if (_Jsep.unary_ops.hasOwnProperty(to_check) && (!_Jsep.isIdentifierStart(this.code) || this.index + to_check.length < this.expr.length && !_Jsep.isIdentifierPart(this.expr.charCodeAt(this.index + to_check.length)))) {
- this.index += tc_len;
- const argument = this.gobbleToken();
- if (!argument) {
- this.throwError("missing unaryOp argument");
- }
- return this.runHook("after-token", {
- type: _Jsep.UNARY_EXP,
- operator: to_check,
- argument,
- prefix: true
- });
- }
- to_check = to_check.substr(0, --tc_len);
- }
- if (_Jsep.isIdentifierStart(ch)) {
- node = this.gobbleIdentifier();
- if (_Jsep.literals.hasOwnProperty(node.name)) {
- node = {
- type: _Jsep.LITERAL,
- value: _Jsep.literals[node.name],
- raw: node.name
- };
- } else if (node.name === _Jsep.this_str) {
- node = {
- type: _Jsep.THIS_EXP
- };
- }
- } else if (ch === _Jsep.OPAREN_CODE) {
- node = this.gobbleGroup();
- }
- }
- if (!node) {
- return this.runHook("after-token", false);
- }
- node = this.gobbleTokenProperty(node);
- return this.runHook("after-token", node);
- }
- /**
- * Gobble properties of of identifiers/strings/arrays/groups.
- * e.g. `foo`, `bar.baz`, `foo['bar'].baz`
- * It also gobbles function calls:
- * e.g. `Math.acos(obj.angle)`
- * @param {jsep.Expression} node
- * @returns {jsep.Expression}
- */
- gobbleTokenProperty(node) {
- this.gobbleSpaces();
- let ch = this.code;
- while (ch === _Jsep.PERIOD_CODE || ch === _Jsep.OBRACK_CODE || ch === _Jsep.OPAREN_CODE || ch === _Jsep.QUMARK_CODE) {
- let optional;
- if (ch === _Jsep.QUMARK_CODE) {
- if (this.expr.charCodeAt(this.index + 1) !== _Jsep.PERIOD_CODE) {
- break;
- }
- optional = true;
- this.index += 2;
- this.gobbleSpaces();
- ch = this.code;
- }
- this.index++;
- if (ch === _Jsep.OBRACK_CODE) {
- node = {
- type: _Jsep.MEMBER_EXP,
- computed: true,
- object: node,
- property: this.gobbleExpression()
- };
- if (!node.property) {
- this.throwError('Unexpected "' + this.char + '"');
- }
- this.gobbleSpaces();
- ch = this.code;
- if (ch !== _Jsep.CBRACK_CODE) {
- this.throwError("Unclosed [");
- }
- this.index++;
- } else if (ch === _Jsep.OPAREN_CODE) {
- node = {
- type: _Jsep.CALL_EXP,
- "arguments": this.gobbleArguments(_Jsep.CPAREN_CODE),
- callee: node
- };
- } else if (ch === _Jsep.PERIOD_CODE || optional) {
- if (optional) {
- this.index--;
- }
- this.gobbleSpaces();
- node = {
- type: _Jsep.MEMBER_EXP,
- computed: false,
- object: node,
- property: this.gobbleIdentifier()
- };
- }
- if (optional) {
- node.optional = true;
- }
- this.gobbleSpaces();
- ch = this.code;
- }
- return node;
- }
- /**
- * Parse simple numeric literals: `12`, `3.4`, `.5`. Do this by using a string to
- * keep track of everything in the numeric literal and then calling `parseFloat` on that string
- * @returns {jsep.Literal}
- */
- gobbleNumericLiteral() {
- let number = "", ch, chCode;
- while (_Jsep.isDecimalDigit(this.code)) {
- number += this.expr.charAt(this.index++);
- }
- if (this.code === _Jsep.PERIOD_CODE) {
- number += this.expr.charAt(this.index++);
- while (_Jsep.isDecimalDigit(this.code)) {
- number += this.expr.charAt(this.index++);
- }
- }
- ch = this.char;
- if (ch === "e" || ch === "E") {
- number += this.expr.charAt(this.index++);
- ch = this.char;
- if (ch === "+" || ch === "-") {
- number += this.expr.charAt(this.index++);
- }
- while (_Jsep.isDecimalDigit(this.code)) {
- number += this.expr.charAt(this.index++);
- }
- if (!_Jsep.isDecimalDigit(this.expr.charCodeAt(this.index - 1))) {
- this.throwError("Expected exponent (" + number + this.char + ")");
- }
- }
- chCode = this.code;
- if (_Jsep.isIdentifierStart(chCode)) {
- this.throwError("Variable names cannot start with a number (" + number + this.char + ")");
- } else if (chCode === _Jsep.PERIOD_CODE || number.length === 1 && number.charCodeAt(0) === _Jsep.PERIOD_CODE) {
- this.throwError("Unexpected period");
- }
- return {
- type: _Jsep.LITERAL,
- value: parseFloat(number),
- raw: number
- };
- }
- /**
- * Parses a string literal, staring with single or double quotes with basic support for escape codes
- * e.g. `"hello world"`, `'this is\nJSEP'`
- * @returns {jsep.Literal}
- */
- gobbleStringLiteral() {
- let str = "";
- const startIndex = this.index;
- const quote = this.expr.charAt(this.index++);
- let closed = false;
- while (this.index < this.expr.length) {
- let ch = this.expr.charAt(this.index++);
- if (ch === quote) {
- closed = true;
- break;
- } else if (ch === "\\") {
- ch = this.expr.charAt(this.index++);
- switch (ch) {
- case "n":
- str += "\n";
- break;
- case "r":
- str += "\r";
- break;
- case "t":
- str += " ";
- break;
- case "b":
- str += "\b";
- break;
- case "f":
- str += "\f";
- break;
- case "v":
- str += "\v";
- break;
- default:
- str += ch;
- }
- } else {
- str += ch;
- }
- }
- if (!closed) {
- this.throwError('Unclosed quote after "' + str + '"');
- }
- return {
- type: _Jsep.LITERAL,
- value: str,
- raw: this.expr.substring(startIndex, this.index)
- };
- }
- /**
- * Gobbles only identifiers
- * e.g.: `foo`, `_value`, `$x1`
- * Also, this function checks if that identifier is a literal:
- * (e.g. `true`, `false`, `null`) or `this`
- * @returns {jsep.Identifier}
- */
- gobbleIdentifier() {
- let ch = this.code, start = this.index;
- if (_Jsep.isIdentifierStart(ch)) {
- this.index++;
- } else {
- this.throwError("Unexpected " + this.char);
- }
- while (this.index < this.expr.length) {
- ch = this.code;
- if (_Jsep.isIdentifierPart(ch)) {
- this.index++;
- } else {
- break;
- }
- }
- return {
- type: _Jsep.IDENTIFIER,
- name: this.expr.slice(start, this.index)
- };
- }
- /**
- * Gobbles a list of arguments within the context of a function call
- * or array literal. This function also assumes that the opening character
- * `(` or `[` has already been gobbled, and gobbles expressions and commas
- * until the terminator character `)` or `]` is encountered.
- * e.g. `foo(bar, baz)`, `my_func()`, or `[bar, baz]`
- * @param {number} termination
- * @returns {jsep.Expression[]}
- */
- gobbleArguments(termination) {
- const args = [];
- let closed = false;
- let separator_count = 0;
- while (this.index < this.expr.length) {
- this.gobbleSpaces();
- let ch_i = this.code;
- if (ch_i === termination) {
- closed = true;
- this.index++;
- if (termination === _Jsep.CPAREN_CODE && separator_count && separator_count >= args.length) {
- this.throwError("Unexpected token " + String.fromCharCode(termination));
- }
- break;
- } else if (ch_i === _Jsep.COMMA_CODE) {
- this.index++;
- separator_count++;
- if (separator_count !== args.length) {
- if (termination === _Jsep.CPAREN_CODE) {
- this.throwError("Unexpected token ,");
- } else if (termination === _Jsep.CBRACK_CODE) {
- for (let arg = args.length; arg < separator_count; arg++) {
- args.push(null);
- }
- }
- }
- } else if (args.length !== separator_count && separator_count !== 0) {
- this.throwError("Expected comma");
- } else {
- const node = this.gobbleExpression();
- if (!node || node.type === _Jsep.COMPOUND) {
- this.throwError("Expected comma");
- }
- args.push(node);
- }
- }
- if (!closed) {
- this.throwError("Expected " + String.fromCharCode(termination));
- }
- return args;
- }
- /**
- * Responsible for parsing a group of things within parentheses `()`
- * that have no identifier in front (so not a function call)
- * This function assumes that it needs to gobble the opening parenthesis
- * and then tries to gobble everything within that parenthesis, assuming
- * that the next thing it should see is the close parenthesis. If not,
- * then the expression probably doesn't have a `)`
- * @returns {boolean|jsep.Expression}
- */
- gobbleGroup() {
- this.index++;
- let nodes = this.gobbleExpressions(_Jsep.CPAREN_CODE);
- if (this.code === _Jsep.CPAREN_CODE) {
- this.index++;
- if (nodes.length === 1) {
- return nodes[0];
- } else if (!nodes.length) {
- return false;
- } else {
- return {
- type: _Jsep.SEQUENCE_EXP,
- expressions: nodes
- };
- }
- } else {
- this.throwError("Unclosed (");
- }
- }
- /**
- * Responsible for parsing Array literals `[1, 2, 3]`
- * This function assumes that it needs to gobble the opening bracket
- * and then tries to gobble the expressions as arguments.
- * @returns {jsep.ArrayExpression}
- */
- gobbleArray() {
- this.index++;
- return {
- type: _Jsep.ARRAY_EXP,
- elements: this.gobbleArguments(_Jsep.CBRACK_CODE)
- };
- }
-};
-var hooks = new Hooks();
-Object.assign(Jsep, {
- hooks,
- plugins: new Plugins(Jsep),
- // Node Types
- // ----------
- // This is the full set of types that any JSEP node can be.
- // Store them here to save space when minified
- COMPOUND: "Compound",
- SEQUENCE_EXP: "SequenceExpression",
- IDENTIFIER: "Identifier",
- MEMBER_EXP: "MemberExpression",
- LITERAL: "Literal",
- THIS_EXP: "ThisExpression",
- CALL_EXP: "CallExpression",
- UNARY_EXP: "UnaryExpression",
- BINARY_EXP: "BinaryExpression",
- ARRAY_EXP: "ArrayExpression",
- TAB_CODE: 9,
- LF_CODE: 10,
- CR_CODE: 13,
- SPACE_CODE: 32,
- PERIOD_CODE: 46,
- // '.'
- COMMA_CODE: 44,
- // ','
- SQUOTE_CODE: 39,
- // single quote
- DQUOTE_CODE: 34,
- // double quotes
- OPAREN_CODE: 40,
- // (
- CPAREN_CODE: 41,
- // )
- OBRACK_CODE: 91,
- // [
- CBRACK_CODE: 93,
- // ]
- QUMARK_CODE: 63,
- // ?
- SEMCOL_CODE: 59,
- // ;
- COLON_CODE: 58,
- // :
- // Operations
- // ----------
- // Use a quickly-accessible map to store all of the unary operators
- // Values are set to `1` (it really doesn't matter)
- unary_ops: {
- "-": 1,
- "!": 1,
- "~": 1,
- "+": 1
- },
- // Also use a map for the binary operations but set their values to their
- // binary precedence for quick reference (higher number = higher precedence)
- // see [Order of operations](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence)
- binary_ops: {
- "||": 1,
- "??": 1,
- "&&": 2,
- "|": 3,
- "^": 4,
- "&": 5,
- "==": 6,
- "!=": 6,
- "===": 6,
- "!==": 6,
- "<": 7,
- ">": 7,
- "<=": 7,
- ">=": 7,
- "<<": 8,
- ">>": 8,
- ">>>": 8,
- "+": 9,
- "-": 9,
- "*": 10,
- "/": 10,
- "%": 10,
- "**": 11
- },
- // sets specific binary_ops as right-associative
- right_associative: /* @__PURE__ */ new Set(["**"]),
- // Additional valid identifier chars, apart from a-z, A-Z and 0-9 (except on the starting char)
- additional_identifier_chars: /* @__PURE__ */ new Set(["$", "_"]),
- // Literals
- // ----------
- // Store the values to return for the various literals we may encounter
- literals: {
- "true": true,
- "false": false,
- "null": null
- },
- // Except for `this`, which is special. This could be changed to something like `'self'` as well
- this_str: "this"
-});
-Jsep.max_unop_len = Jsep.getMaxKeyLen(Jsep.unary_ops);
-Jsep.max_binop_len = Jsep.getMaxKeyLen(Jsep.binary_ops);
-var jsep = (expr) => new Jsep(expr).parse();
-var stdClassProps = Object.getOwnPropertyNames(class Test {
-});
-Object.getOwnPropertyNames(Jsep).filter((prop) => !stdClassProps.includes(prop) && jsep[prop] === void 0).forEach((m) => {
- jsep[m] = Jsep[m];
-});
-jsep.Jsep = Jsep;
-var CONDITIONAL_EXP = "ConditionalExpression";
-var ternary = {
- name: "ternary",
- init(jsep2) {
- jsep2.hooks.add("after-expression", function gobbleTernary(env) {
- if (env.node && this.code === jsep2.QUMARK_CODE) {
- this.index++;
- const test = env.node;
- const consequent = this.gobbleExpression();
- if (!consequent) {
- this.throwError("Expected expression");
- }
- this.gobbleSpaces();
- if (this.code === jsep2.COLON_CODE) {
- this.index++;
- const alternate = this.gobbleExpression();
- if (!alternate) {
- this.throwError("Expected expression");
- }
- env.node = {
- type: CONDITIONAL_EXP,
- test,
- consequent,
- alternate
- };
- if (test.operator && jsep2.binary_ops[test.operator] <= 0.9) {
- let newTest = test;
- while (newTest.right.operator && jsep2.binary_ops[newTest.right.operator] <= 0.9) {
- newTest = newTest.right;
- }
- env.node.test = newTest.right;
- newTest.right = env.node;
- env.node = test;
- }
- } else {
- this.throwError("Expected :");
- }
- }
- });
- }
-};
-jsep.plugins.register(ternary);
-var FSLASH_CODE = 47;
-var BSLASH_CODE = 92;
-var index = {
- name: "regex",
- init(jsep2) {
- jsep2.hooks.add("gobble-token", function gobbleRegexLiteral(env) {
- if (this.code === FSLASH_CODE) {
- const patternIndex = ++this.index;
- let inCharSet = false;
- while (this.index < this.expr.length) {
- if (this.code === FSLASH_CODE && !inCharSet) {
- const pattern = this.expr.slice(patternIndex, this.index);
- let flags = "";
- while (++this.index < this.expr.length) {
- const code = this.code;
- if (code >= 97 && code <= 122 || code >= 65 && code <= 90 || code >= 48 && code <= 57) {
- flags += this.char;
- } else {
- break;
- }
- }
- let value;
- try {
- value = new RegExp(pattern, flags);
- } catch (e) {
- this.throwError(e.message);
- }
- env.node = {
- type: jsep2.LITERAL,
- value,
- raw: this.expr.slice(patternIndex - 1, this.index)
- };
- env.node = this.gobbleTokenProperty(env.node);
- return env.node;
- }
- if (this.code === jsep2.OBRACK_CODE) {
- inCharSet = true;
- } else if (inCharSet && this.code === jsep2.CBRACK_CODE) {
- inCharSet = false;
- }
- this.index += this.code === BSLASH_CODE ? 2 : 1;
- }
- this.throwError("Unclosed Regex");
- }
- });
- }
-};
-var PLUS_CODE = 43;
-var MINUS_CODE = 45;
-var plugin = {
- name: "assignment",
- assignmentOperators: /* @__PURE__ */ new Set(["=", "*=", "**=", "/=", "%=", "+=", "-=", "<<=", ">>=", ">>>=", "&=", "^=", "|=", "||=", "&&=", "??="]),
- updateOperators: [PLUS_CODE, MINUS_CODE],
- assignmentPrecedence: 0.9,
- init(jsep2) {
- const updateNodeTypes = [jsep2.IDENTIFIER, jsep2.MEMBER_EXP];
- plugin.assignmentOperators.forEach((op) => jsep2.addBinaryOp(op, plugin.assignmentPrecedence, true));
- jsep2.hooks.add("gobble-token", function gobbleUpdatePrefix(env) {
- const code = this.code;
- if (plugin.updateOperators.some((c) => c === code && c === this.expr.charCodeAt(this.index + 1))) {
- this.index += 2;
- env.node = {
- type: "UpdateExpression",
- operator: code === PLUS_CODE ? "++" : "--",
- argument: this.gobbleTokenProperty(this.gobbleIdentifier()),
- prefix: true
- };
- if (!env.node.argument || !updateNodeTypes.includes(env.node.argument.type)) {
- this.throwError(`Unexpected ${env.node.operator}`);
- }
- }
- });
- jsep2.hooks.add("after-token", function gobbleUpdatePostfix(env) {
- if (env.node) {
- const code = this.code;
- if (plugin.updateOperators.some((c) => c === code && c === this.expr.charCodeAt(this.index + 1))) {
- if (!updateNodeTypes.includes(env.node.type)) {
- this.throwError(`Unexpected ${env.node.operator}`);
- }
- this.index += 2;
- env.node = {
- type: "UpdateExpression",
- operator: code === PLUS_CODE ? "++" : "--",
- argument: env.node,
- prefix: false
- };
- }
- }
- });
- jsep2.hooks.add("after-expression", function gobbleAssignment(env) {
- if (env.node) {
- updateBinariesToAssignments(env.node);
- }
- });
- function updateBinariesToAssignments(node) {
- if (plugin.assignmentOperators.has(node.operator)) {
- node.type = "AssignmentExpression";
- updateBinariesToAssignments(node.left);
- updateBinariesToAssignments(node.right);
- } else if (!node.operator) {
- Object.values(node).forEach((val) => {
- if (val && typeof val === "object") {
- updateBinariesToAssignments(val);
- }
- });
- }
- }
- }
-};
-jsep.plugins.register(index, plugin);
-jsep.addUnaryOp("typeof");
-jsep.addLiteral("null", null);
-jsep.addLiteral("undefined", void 0);
-var BLOCKED_PROTO_PROPERTIES = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter__", "__defineSetter__"]);
-var SafeEval = {
- /**
- * @param {jsep.Expression} ast
- * @param {Record} subs
- */
- evalAst(ast, subs) {
- switch (ast.type) {
- case "BinaryExpression":
- case "LogicalExpression":
- return SafeEval.evalBinaryExpression(ast, subs);
- case "Compound":
- return SafeEval.evalCompound(ast, subs);
- case "ConditionalExpression":
- return SafeEval.evalConditionalExpression(ast, subs);
- case "Identifier":
- return SafeEval.evalIdentifier(ast, subs);
- case "Literal":
- return SafeEval.evalLiteral(ast, subs);
- case "MemberExpression":
- return SafeEval.evalMemberExpression(ast, subs);
- case "UnaryExpression":
- return SafeEval.evalUnaryExpression(ast, subs);
- case "ArrayExpression":
- return SafeEval.evalArrayExpression(ast, subs);
- case "CallExpression":
- return SafeEval.evalCallExpression(ast, subs);
- case "AssignmentExpression":
- return SafeEval.evalAssignmentExpression(ast, subs);
- default:
- throw SyntaxError("Unexpected expression", ast);
- }
- },
- evalBinaryExpression(ast, subs) {
- const result = {
- "||": (a, b) => a || b(),
- "&&": (a, b) => a && b(),
- "|": (a, b) => a | b(),
- "^": (a, b) => a ^ b(),
- "&": (a, b) => a & b(),
- // eslint-disable-next-line eqeqeq -- API
- "==": (a, b) => a == b(),
- // eslint-disable-next-line eqeqeq -- API
- "!=": (a, b) => a != b(),
- "===": (a, b) => a === b(),
- "!==": (a, b) => a !== b(),
- "<": (a, b) => a < b(),
- ">": (a, b) => a > b(),
- "<=": (a, b) => a <= b(),
- ">=": (a, b) => a >= b(),
- "<<": (a, b) => a << b(),
- ">>": (a, b) => a >> b(),
- ">>>": (a, b) => a >>> b(),
- "+": (a, b) => a + b(),
- "-": (a, b) => a - b(),
- "*": (a, b) => a * b(),
- "/": (a, b) => a / b(),
- "%": (a, b) => a % b()
- }[ast.operator](SafeEval.evalAst(ast.left, subs), () => SafeEval.evalAst(ast.right, subs));
- return result;
- },
- evalCompound(ast, subs) {
- let last;
- for (let i = 0; i < ast.body.length; i++) {
- if (ast.body[i].type === "Identifier" && ["var", "let", "const"].includes(ast.body[i].name) && ast.body[i + 1] && ast.body[i + 1].type === "AssignmentExpression") {
- i += 1;
- }
- const expr = ast.body[i];
- last = SafeEval.evalAst(expr, subs);
- }
- return last;
- },
- evalConditionalExpression(ast, subs) {
- if (SafeEval.evalAst(ast.test, subs)) {
- return SafeEval.evalAst(ast.consequent, subs);
- }
- return SafeEval.evalAst(ast.alternate, subs);
- },
- evalIdentifier(ast, subs) {
- if (Object.hasOwn(subs, ast.name)) {
- return subs[ast.name];
- }
- throw ReferenceError(`${ast.name} is not defined`);
- },
- evalLiteral(ast) {
- return ast.value;
- },
- evalMemberExpression(ast, subs) {
- const prop = String(
- // NOTE: `String(value)` throws error when
- // value has overwritten the toString method to return non-string
- // i.e. `value = {toString: () => []}`
- ast.computed ? SafeEval.evalAst(ast.property) : ast.property.name
- // `object.property` property is Identifier
- );
- const obj = SafeEval.evalAst(ast.object, subs);
- if (obj === void 0 || obj === null) {
- throw TypeError(`Cannot read properties of ${obj} (reading '${prop}')`);
- }
- if (!Object.hasOwn(obj, prop) && BLOCKED_PROTO_PROPERTIES.has(prop)) {
- throw TypeError(`Cannot read properties of ${obj} (reading '${prop}')`);
- }
- const result = obj[prop];
- if (typeof result === "function") {
- return result.bind(obj);
- }
- return result;
- },
- evalUnaryExpression(ast, subs) {
- const result = {
- "-": (a) => -SafeEval.evalAst(a, subs),
- "!": (a) => !SafeEval.evalAst(a, subs),
- "~": (a) => ~SafeEval.evalAst(a, subs),
- // eslint-disable-next-line no-implicit-coercion -- API
- "+": (a) => +SafeEval.evalAst(a, subs),
- typeof: (a) => typeof SafeEval.evalAst(a, subs)
- }[ast.operator](ast.argument);
- return result;
- },
- evalArrayExpression(ast, subs) {
- return ast.elements.map((el) => SafeEval.evalAst(el, subs));
- },
- evalCallExpression(ast, subs) {
- const args = ast.arguments.map((arg) => SafeEval.evalAst(arg, subs));
- const func = SafeEval.evalAst(ast.callee, subs);
- return func(...args);
- },
- evalAssignmentExpression(ast, subs) {
- if (ast.left.type !== "Identifier") {
- throw SyntaxError("Invalid left-hand side in assignment");
- }
- const id = ast.left.name;
- const value = SafeEval.evalAst(ast.right, subs);
- subs[id] = value;
- return subs[id];
- }
-};
-var SafeScript = class {
- /**
- * @param {string} expr Expression to evaluate
- */
- constructor(expr) {
- this.code = expr;
- this.ast = jsep(this.code);
- }
- /**
- * @param {object} context Object whose items will be added
- * to evaluation
- * @returns {EvaluatedResult} Result of evaluated code
- */
- runInNewContext(context) {
- const keyMap = Object.assign(/* @__PURE__ */ Object.create(null), context);
- return SafeEval.evalAst(this.ast, keyMap);
- }
-};
-function push(arr, item) {
- arr = arr.slice();
- arr.push(item);
- return arr;
-}
-function unshift(item, arr) {
- arr = arr.slice();
- arr.unshift(item);
- return arr;
-}
-var NewError = class extends Error {
- /**
- * @param {AnyResult} value The evaluated scalar value
- */
- constructor(value) {
- super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)');
- this.avoidNew = true;
- this.value = value;
- this.name = "NewError";
- }
-};
-function JSONPath(opts, expr, obj, callback, otherTypeCallback) {
- if (!(this instanceof JSONPath)) {
- try {
- return new JSONPath(opts, expr, obj, callback, otherTypeCallback);
- } catch (e) {
- if (!e.avoidNew) {
- throw e;
- }
- return e.value;
- }
- }
- if (typeof opts === "string") {
- otherTypeCallback = callback;
- callback = obj;
- obj = expr;
- expr = opts;
- opts = null;
- }
- const optObj = opts && typeof opts === "object";
- opts = opts || {};
- this.json = opts.json || obj;
- this.path = opts.path || expr;
- this.resultType = opts.resultType || "value";
- this.flatten = opts.flatten || false;
- this.wrap = Object.hasOwn(opts, "wrap") ? opts.wrap : true;
- this.sandbox = opts.sandbox || {};
- this.eval = opts.eval === void 0 ? "safe" : opts.eval;
- this.ignoreEvalErrors = typeof opts.ignoreEvalErrors === "undefined" ? false : opts.ignoreEvalErrors;
- this.parent = opts.parent || null;
- this.parentProperty = opts.parentProperty || null;
- this.callback = opts.callback || callback || null;
- this.otherTypeCallback = opts.otherTypeCallback || otherTypeCallback || function() {
- throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.");
- };
- if (opts.autostart !== false) {
- const args = {
- path: optObj ? opts.path : expr
- };
- if (!optObj) {
- args.json = obj;
- } else if ("json" in opts) {
- args.json = opts.json;
- }
- const ret = this.evaluate(args);
- if (!ret || typeof ret !== "object") {
- throw new NewError(ret);
- }
- return ret;
- }
-}
-JSONPath.prototype.evaluate = function(expr, json, callback, otherTypeCallback) {
- let currParent = this.parent, currParentProperty = this.parentProperty;
- let {
- flatten,
- wrap
- } = this;
- this.currResultType = this.resultType;
- this.currEval = this.eval;
- this.currSandbox = this.sandbox;
- callback = callback || this.callback;
- this.currOtherTypeCallback = otherTypeCallback || this.otherTypeCallback;
- json = json || this.json;
- expr = expr || this.path;
- if (expr && typeof expr === "object" && !Array.isArray(expr)) {
- if (!expr.path && expr.path !== "") {
- throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');
- }
- if (!Object.hasOwn(expr, "json")) {
- throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');
- }
- ({
- json
- } = expr);
- flatten = Object.hasOwn(expr, "flatten") ? expr.flatten : flatten;
- this.currResultType = Object.hasOwn(expr, "resultType") ? expr.resultType : this.currResultType;
- this.currSandbox = Object.hasOwn(expr, "sandbox") ? expr.sandbox : this.currSandbox;
- wrap = Object.hasOwn(expr, "wrap") ? expr.wrap : wrap;
- this.currEval = Object.hasOwn(expr, "eval") ? expr.eval : this.currEval;
- callback = Object.hasOwn(expr, "callback") ? expr.callback : callback;
- this.currOtherTypeCallback = Object.hasOwn(expr, "otherTypeCallback") ? expr.otherTypeCallback : this.currOtherTypeCallback;
- currParent = Object.hasOwn(expr, "parent") ? expr.parent : currParent;
- currParentProperty = Object.hasOwn(expr, "parentProperty") ? expr.parentProperty : currParentProperty;
- expr = expr.path;
- }
- currParent = currParent || null;
- currParentProperty = currParentProperty || null;
- if (Array.isArray(expr)) {
- expr = JSONPath.toPathString(expr);
- }
- if (!expr && expr !== "" || !json) {
- return void 0;
- }
- const exprList = JSONPath.toPathArray(expr);
- if (exprList[0] === "$" && exprList.length > 1) {
- exprList.shift();
- }
- this._hasParentSelector = null;
- const result = this._trace(exprList, json, ["$"], currParent, currParentProperty, callback).filter(function(ea) {
- return ea && !ea.isParentSelector;
- });
- if (!result.length) {
- return wrap ? [] : void 0;
- }
- if (!wrap && result.length === 1 && !result[0].hasArrExpr) {
- return this._getPreferredOutput(result[0]);
- }
- return result.reduce((rslt, ea) => {
- const valOrPath = this._getPreferredOutput(ea);
- if (flatten && Array.isArray(valOrPath)) {
- rslt = rslt.concat(valOrPath);
- } else {
- rslt.push(valOrPath);
- }
- return rslt;
- }, []);
-};
-JSONPath.prototype._getPreferredOutput = function(ea) {
- const resultType = this.currResultType;
- switch (resultType) {
- case "all": {
- const path = Array.isArray(ea.path) ? ea.path : JSONPath.toPathArray(ea.path);
- ea.pointer = JSONPath.toPointer(path);
- ea.path = typeof ea.path === "string" ? ea.path : JSONPath.toPathString(ea.path);
- return ea;
- }
- case "value":
- case "parent":
- case "parentProperty":
- return ea[resultType];
- case "path":
- return JSONPath.toPathString(ea[resultType]);
- case "pointer":
- return JSONPath.toPointer(ea.path);
- default:
- throw new TypeError("Unknown result type");
- }
-};
-JSONPath.prototype._handleCallback = function(fullRetObj, callback, type) {
- if (callback) {
- const preferredOutput = this._getPreferredOutput(fullRetObj);
- fullRetObj.path = typeof fullRetObj.path === "string" ? fullRetObj.path : JSONPath.toPathString(fullRetObj.path);
- callback(preferredOutput, type, fullRetObj);
- }
-};
-JSONPath.prototype._trace = function(expr, val, path, parent, parentPropName, callback, hasArrExpr, literalPriority) {
- let retObj;
- if (!expr.length) {
- retObj = {
- path,
- value: val,
- parent,
- parentProperty: parentPropName,
- hasArrExpr
- };
- this._handleCallback(retObj, callback, "value");
- return retObj;
- }
- const loc = expr[0], x = expr.slice(1);
- const ret = [];
- function addRet(elems) {
- if (Array.isArray(elems)) {
- elems.forEach((t) => {
- ret.push(t);
- });
- } else {
- ret.push(elems);
- }
- }
- if ((typeof loc !== "string" || literalPriority) && val && Object.hasOwn(val, loc)) {
- addRet(this._trace(x, val[loc], push(path, loc), val, loc, callback, hasArrExpr));
- } else if (loc === "*") {
- this._walk(val, (m) => {
- addRet(this._trace(x, val[m], push(path, m), val, m, callback, true, true));
- });
- } else if (loc === "..") {
- addRet(this._trace(x, val, path, parent, parentPropName, callback, hasArrExpr));
- this._walk(val, (m) => {
- if (typeof val[m] === "object") {
- addRet(this._trace(expr.slice(), val[m], push(path, m), val, m, callback, true));
- }
- });
- } else if (loc === "^") {
- this._hasParentSelector = true;
- return {
- path: path.slice(0, -1),
- expr: x,
- isParentSelector: true
- };
- } else if (loc === "~") {
- retObj = {
- path: push(path, loc),
- value: parentPropName,
- parent,
- parentProperty: null
- };
- this._handleCallback(retObj, callback, "property");
- return retObj;
- } else if (loc === "$") {
- addRet(this._trace(x, val, path, null, null, callback, hasArrExpr));
- } else if (/^(-?\d*):(-?\d*):?(\d*)$/u.test(loc)) {
- addRet(this._slice(loc, x, val, path, parent, parentPropName, callback));
- } else if (loc.indexOf("?(") === 0) {
- if (this.currEval === false) {
- throw new Error("Eval [?(expr)] prevented in JSONPath expression.");
- }
- const safeLoc = loc.replace(/^\?\((.*?)\)$/u, "$1");
- const nested = /@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(safeLoc);
- if (nested) {
- this._walk(val, (m) => {
- const npath = [nested[2]];
- const nvalue = nested[1] ? val[m][nested[1]] : val[m];
- const filterResults = this._trace(npath, nvalue, path, parent, parentPropName, callback, true);
- if (filterResults.length > 0) {
- addRet(this._trace(x, val[m], push(path, m), val, m, callback, true));
- }
- });
- } else {
- this._walk(val, (m) => {
- if (this._eval(safeLoc, val[m], m, path, parent, parentPropName)) {
- addRet(this._trace(x, val[m], push(path, m), val, m, callback, true));
- }
- });
- }
- } else if (loc[0] === "(") {
- if (this.currEval === false) {
- throw new Error("Eval [(expr)] prevented in JSONPath expression.");
- }
- addRet(this._trace(unshift(this._eval(loc, val, path.at(-1), path.slice(0, -1), parent, parentPropName), x), val, path, parent, parentPropName, callback, hasArrExpr));
- } else if (loc[0] === "@") {
- let addType = false;
- const valueType = loc.slice(1, -2);
- switch (valueType) {
- case "scalar":
- if (!val || !["object", "function"].includes(typeof val)) {
- addType = true;
- }
- break;
- case "boolean":
- case "string":
- case "undefined":
- case "function":
- if (typeof val === valueType) {
- addType = true;
- }
- break;
- case "integer":
- if (Number.isFinite(val) && !(val % 1)) {
- addType = true;
- }
- break;
- case "number":
- if (Number.isFinite(val)) {
- addType = true;
- }
- break;
- case "nonFinite":
- if (typeof val === "number" && !Number.isFinite(val)) {
- addType = true;
- }
- break;
- case "object":
- if (val && typeof val === valueType) {
- addType = true;
- }
- break;
- case "array":
- if (Array.isArray(val)) {
- addType = true;
- }
- break;
- case "other":
- addType = this.currOtherTypeCallback(val, path, parent, parentPropName);
- break;
- case "null":
- if (val === null) {
- addType = true;
- }
- break;
- default:
- throw new TypeError("Unknown value type " + valueType);
- }
- if (addType) {
- retObj = {
- path,
- value: val,
- parent,
- parentProperty: parentPropName
- };
- this._handleCallback(retObj, callback, "value");
- return retObj;
- }
- } else if (loc[0] === "`" && val && Object.hasOwn(val, loc.slice(1))) {
- const locProp = loc.slice(1);
- addRet(this._trace(x, val[locProp], push(path, locProp), val, locProp, callback, hasArrExpr, true));
- } else if (loc.includes(",")) {
- const parts = loc.split(",");
- for (const part of parts) {
- addRet(this._trace(unshift(part, x), val, path, parent, parentPropName, callback, true));
- }
- } else if (!literalPriority && val && Object.hasOwn(val, loc)) {
- addRet(this._trace(x, val[loc], push(path, loc), val, loc, callback, hasArrExpr, true));
- }
- if (this._hasParentSelector) {
- for (let t = 0; t < ret.length; t++) {
- const rett = ret[t];
- if (rett && rett.isParentSelector) {
- const tmp = this._trace(rett.expr, val, rett.path, parent, parentPropName, callback, hasArrExpr);
- if (Array.isArray(tmp)) {
- ret[t] = tmp[0];
- const tl = tmp.length;
- for (let tt = 1; tt < tl; tt++) {
- t++;
- ret.splice(t, 0, tmp[tt]);
- }
- } else {
- ret[t] = tmp;
- }
- }
- }
- }
- return ret;
-};
-JSONPath.prototype._walk = function(val, f) {
- if (Array.isArray(val)) {
- const n = val.length;
- for (let i = 0; i < n; i++) {
- f(i);
- }
- } else if (val && typeof val === "object") {
- Object.keys(val).forEach((m) => {
- f(m);
- });
- }
-};
-JSONPath.prototype._slice = function(loc, expr, val, path, parent, parentPropName, callback) {
- if (!Array.isArray(val)) {
- return void 0;
- }
- const len = val.length, parts = loc.split(":"), step = parts[2] && Number.parseInt(parts[2]) || 1;
- let start = parts[0] && Number.parseInt(parts[0]) || 0, end = parts[1] && Number.parseInt(parts[1]) || len;
- start = start < 0 ? Math.max(0, start + len) : Math.min(len, start);
- end = end < 0 ? Math.max(0, end + len) : Math.min(len, end);
- const ret = [];
- for (let i = start; i < end; i += step) {
- const tmp = this._trace(unshift(i, expr), val, path, parent, parentPropName, callback, true);
- tmp.forEach((t) => {
- ret.push(t);
- });
- }
- return ret;
-};
-JSONPath.prototype._eval = function(code, _v, _vname, path, parent, parentPropName) {
- this.currSandbox._$_parentProperty = parentPropName;
- this.currSandbox._$_parent = parent;
- this.currSandbox._$_property = _vname;
- this.currSandbox._$_root = this.json;
- this.currSandbox._$_v = _v;
- const containsPath = code.includes("@path");
- if (containsPath) {
- this.currSandbox._$_path = JSONPath.toPathString(path.concat([_vname]));
- }
- const scriptCacheKey = this.currEval + "Script:" + code;
- if (!JSONPath.cache[scriptCacheKey]) {
- let script = code.replaceAll("@parentProperty", "_$_parentProperty").replaceAll("@parent", "_$_parent").replaceAll("@property", "_$_property").replaceAll("@root", "_$_root").replaceAll(/@([.\s)[])/gu, "_$_v$1");
- if (containsPath) {
- script = script.replaceAll("@path", "_$_path");
- }
- if (this.currEval === "safe" || this.currEval === true || this.currEval === void 0) {
- JSONPath.cache[scriptCacheKey] = new this.safeVm.Script(script);
- } else if (this.currEval === "native") {
- JSONPath.cache[scriptCacheKey] = new this.vm.Script(script);
- } else if (typeof this.currEval === "function" && this.currEval.prototype && Object.hasOwn(this.currEval.prototype, "runInNewContext")) {
- const CurrEval = this.currEval;
- JSONPath.cache[scriptCacheKey] = new CurrEval(script);
- } else if (typeof this.currEval === "function") {
- JSONPath.cache[scriptCacheKey] = {
- runInNewContext: (context) => this.currEval(script, context)
- };
- } else {
- throw new TypeError(`Unknown "eval" property "${this.currEval}"`);
- }
- }
- try {
- return JSONPath.cache[scriptCacheKey].runInNewContext(this.currSandbox);
- } catch (e) {
- if (this.ignoreEvalErrors) {
- return false;
- }
- throw new Error("jsonPath: " + e.message + ": " + code);
- }
-};
-JSONPath.cache = {};
-JSONPath.toPathString = function(pathArr) {
- const x = pathArr, n = x.length;
- let p = "$";
- for (let i = 1; i < n; i++) {
- if (!/^(~|\^|@.*?\(\))$/u.test(x[i])) {
- p += /^[0-9*]+$/u.test(x[i]) ? "[" + x[i] + "]" : "['" + x[i] + "']";
- }
- }
- return p;
-};
-JSONPath.toPointer = function(pointer) {
- const x = pointer, n = x.length;
- let p = "";
- for (let i = 1; i < n; i++) {
- if (!/^(~|\^|@.*?\(\))$/u.test(x[i])) {
- p += "/" + x[i].toString().replaceAll("~", "~0").replaceAll("/", "~1");
- }
- }
- return p;
-};
-JSONPath.toPathArray = function(expr) {
- const {
- cache
- } = JSONPath;
- if (cache[expr]) {
- return cache[expr].concat();
- }
- const subx = [];
- const normalized = expr.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu, ";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu, function($0, $1) {
- return "[#" + (subx.push($1) - 1) + "]";
- }).replaceAll(/\[['"]([^'\]]*)['"]\]/gu, function($0, prop) {
- return "['" + prop.replaceAll(".", "%@%").replaceAll("~", "%%@@%%") + "']";
- }).replaceAll("~", ";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu, ";").replaceAll("%@%", ".").replaceAll("%%@@%%", "~").replaceAll(/(?:;)?(\^+)(?:;)?/gu, function($0, ups) {
- return ";" + ups.split("").join(";") + ";";
- }).replaceAll(/;;;|;;/gu, ";..;").replaceAll(/;$|'?\]|'$/gu, "");
- const exprList = normalized.split(";").map(function(exp) {
- const match = exp.match(/#(\d+)/u);
- return !match || !match[1] ? exp : subx[match[1]];
- });
- cache[expr] = exprList;
- return cache[expr].concat();
-};
-JSONPath.prototype.safeVm = {
- Script: SafeScript
-};
-JSONPath.prototype.vm = import_vm.default;
-
-// src/index.ts
-var plugin2 = {
- filter: {
- name: "JSONPath",
- description: "Filter JSONPath",
- onFilter(_ctx, args) {
- const parsed = JSON.parse(args.payload);
- const filtered = JSONPath({ path: args.filter, json: parsed });
- return { filtered: JSON.stringify(filtered, null, 2) };
- }
- }
-};
-// Annotate the CommonJS export names for ESM import in node:
-0 && (module.exports = {
- plugin
-});
diff --git a/src-tauri/vendored/plugins/filter-xpath/build/index.js b/src-tauri/vendored/plugins/filter-xpath/build/index.js
deleted file mode 100644
index 095c8ae6..00000000
--- a/src-tauri/vendored/plugins/filter-xpath/build/index.js
+++ /dev/null
@@ -1,8372 +0,0 @@
-"use strict";
-var __create = Object.create;
-var __defProp = Object.defineProperty;
-var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
-var __getOwnPropNames = Object.getOwnPropertyNames;
-var __getProtoOf = Object.getPrototypeOf;
-var __hasOwnProp = Object.prototype.hasOwnProperty;
-var __commonJS = (cb, mod) => function __require() {
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
-};
-var __export = (target, all) => {
- for (var name2 in all)
- __defProp(target, name2, { get: all[name2], enumerable: true });
-};
-var __copyProps = (to, from, except, desc) => {
- if (from && typeof from === "object" || typeof from === "function") {
- for (let key of __getOwnPropNames(from))
- if (!__hasOwnProp.call(to, key) && key !== except)
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
- }
- return to;
-};
-var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
- // If the importer is in node compatibility mode or this is not an ESM
- // file that has been converted to a CommonJS file using a Babel-
- // compatible transform (i.e. "__esModule" has not been set), then set
- // "default" to the CommonJS "module.exports" for node compatibility.
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
- mod
-));
-var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
-
-// ../../node_modules/@xmldom/xmldom/lib/conventions.js
-var require_conventions = __commonJS({
- "../../node_modules/@xmldom/xmldom/lib/conventions.js"(exports2) {
- "use strict";
- function find(list, predicate, ac) {
- if (ac === void 0) {
- ac = Array.prototype;
- }
- if (list && typeof ac.find === "function") {
- return ac.find.call(list, predicate);
- }
- for (var i = 0; i < list.length; i++) {
- if (Object.prototype.hasOwnProperty.call(list, i)) {
- var item = list[i];
- if (predicate.call(void 0, item, i, list)) {
- return item;
- }
- }
- }
- }
- function freeze(object, oc) {
- if (oc === void 0) {
- oc = Object;
- }
- return oc && typeof oc.freeze === "function" ? oc.freeze(object) : object;
- }
- function assign(target, source) {
- if (target === null || typeof target !== "object") {
- throw new TypeError("target is not an object");
- }
- for (var key in source) {
- if (Object.prototype.hasOwnProperty.call(source, key)) {
- target[key] = source[key];
- }
- }
- return target;
- }
- var MIME_TYPE = freeze({
- /**
- * `text/html`, the only mime type that triggers treating an XML document as HTML.
- *
- * @see DOMParser.SupportedType.isHTML
- * @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration
- * @see https://en.wikipedia.org/wiki/HTML Wikipedia
- * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN
- * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring WHATWG HTML Spec
- */
- HTML: "text/html",
- /**
- * Helper method to check a mime type if it indicates an HTML document
- *
- * @param {string} [value]
- * @returns {boolean}
- *
- * @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration
- * @see https://en.wikipedia.org/wiki/HTML Wikipedia
- * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN
- * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring */
- isHTML: function(value) {
- return value === MIME_TYPE.HTML;
- },
- /**
- * `application/xml`, the standard mime type for XML documents.
- *
- * @see https://www.iana.org/assignments/media-types/application/xml IANA MimeType registration
- * @see https://tools.ietf.org/html/rfc7303#section-9.1 RFC 7303
- * @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia
- */
- XML_APPLICATION: "application/xml",
- /**
- * `text/html`, an alias for `application/xml`.
- *
- * @see https://tools.ietf.org/html/rfc7303#section-9.2 RFC 7303
- * @see https://www.iana.org/assignments/media-types/text/xml IANA MimeType registration
- * @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia
- */
- XML_TEXT: "text/xml",
- /**
- * `application/xhtml+xml`, indicates an XML document that has the default HTML namespace,
- * but is parsed as an XML document.
- *
- * @see https://www.iana.org/assignments/media-types/application/xhtml+xml IANA MimeType registration
- * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument WHATWG DOM Spec
- * @see https://en.wikipedia.org/wiki/XHTML Wikipedia
- */
- XML_XHTML_APPLICATION: "application/xhtml+xml",
- /**
- * `image/svg+xml`,
- *
- * @see https://www.iana.org/assignments/media-types/image/svg+xml IANA MimeType registration
- * @see https://www.w3.org/TR/SVG11/ W3C SVG 1.1
- * @see https://en.wikipedia.org/wiki/Scalable_Vector_Graphics Wikipedia
- */
- XML_SVG_IMAGE: "image/svg+xml"
- });
- var NAMESPACE = freeze({
- /**
- * The XHTML namespace.
- *
- * @see http://www.w3.org/1999/xhtml
- */
- HTML: "http://www.w3.org/1999/xhtml",
- /**
- * Checks if `uri` equals `NAMESPACE.HTML`.
- *
- * @param {string} [uri]
- *
- * @see NAMESPACE.HTML
- */
- isHTML: function(uri) {
- return uri === NAMESPACE.HTML;
- },
- /**
- * The SVG namespace.
- *
- * @see http://www.w3.org/2000/svg
- */
- SVG: "http://www.w3.org/2000/svg",
- /**
- * The `xml:` namespace.
- *
- * @see http://www.w3.org/XML/1998/namespace
- */
- XML: "http://www.w3.org/XML/1998/namespace",
- /**
- * The `xmlns:` namespace
- *
- * @see https://www.w3.org/2000/xmlns/
- */
- XMLNS: "http://www.w3.org/2000/xmlns/"
- });
- exports2.assign = assign;
- exports2.find = find;
- exports2.freeze = freeze;
- exports2.MIME_TYPE = MIME_TYPE;
- exports2.NAMESPACE = NAMESPACE;
- }
-});
-
-// ../../node_modules/@xmldom/xmldom/lib/dom.js
-var require_dom = __commonJS({
- "../../node_modules/@xmldom/xmldom/lib/dom.js"(exports2) {
- var conventions = require_conventions();
- var find = conventions.find;
- var NAMESPACE = conventions.NAMESPACE;
- function notEmptyString(input) {
- return input !== "";
- }
- function splitOnASCIIWhitespace(input) {
- return input ? input.split(/[\t\n\f\r ]+/).filter(notEmptyString) : [];
- }
- function orderedSetReducer(current, element) {
- if (!current.hasOwnProperty(element)) {
- current[element] = true;
- }
- return current;
- }
- function toOrderedSet(input) {
- if (!input) return [];
- var list = splitOnASCIIWhitespace(input);
- return Object.keys(list.reduce(orderedSetReducer, {}));
- }
- function arrayIncludes(list) {
- return function(element) {
- return list && list.indexOf(element) !== -1;
- };
- }
- function copy(src, dest) {
- for (var p in src) {
- if (Object.prototype.hasOwnProperty.call(src, p)) {
- dest[p] = src[p];
- }
- }
- }
- function _extends(Class, Super) {
- var pt = Class.prototype;
- if (!(pt instanceof Super)) {
- let t2 = function() {
- };
- var t = t2;
- ;
- t2.prototype = Super.prototype;
- t2 = new t2();
- copy(pt, t2);
- Class.prototype = pt = t2;
- }
- if (pt.constructor != Class) {
- if (typeof Class != "function") {
- console.error("unknown Class:" + Class);
- }
- pt.constructor = Class;
- }
- }
- var NodeType = {};
- var ELEMENT_NODE = NodeType.ELEMENT_NODE = 1;
- var ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE = 2;
- var TEXT_NODE = NodeType.TEXT_NODE = 3;
- var CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE = 4;
- var ENTITY_REFERENCE_NODE = NodeType.ENTITY_REFERENCE_NODE = 5;
- var ENTITY_NODE = NodeType.ENTITY_NODE = 6;
- var PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE = 7;
- var COMMENT_NODE = NodeType.COMMENT_NODE = 8;
- var DOCUMENT_NODE = NodeType.DOCUMENT_NODE = 9;
- var DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE = 10;
- var DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE = 11;
- var NOTATION_NODE = NodeType.NOTATION_NODE = 12;
- var ExceptionCode = {};
- var ExceptionMessage = {};
- var INDEX_SIZE_ERR = ExceptionCode.INDEX_SIZE_ERR = (ExceptionMessage[1] = "Index size error", 1);
- var DOMSTRING_SIZE_ERR = ExceptionCode.DOMSTRING_SIZE_ERR = (ExceptionMessage[2] = "DOMString size error", 2);
- var HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = (ExceptionMessage[3] = "Hierarchy request error", 3);
- var WRONG_DOCUMENT_ERR = ExceptionCode.WRONG_DOCUMENT_ERR = (ExceptionMessage[4] = "Wrong document", 4);
- var INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = (ExceptionMessage[5] = "Invalid character", 5);
- var NO_DATA_ALLOWED_ERR = ExceptionCode.NO_DATA_ALLOWED_ERR = (ExceptionMessage[6] = "No data allowed", 6);
- var NO_MODIFICATION_ALLOWED_ERR = ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = (ExceptionMessage[7] = "No modification allowed", 7);
- var NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = (ExceptionMessage[8] = "Not found", 8);
- var NOT_SUPPORTED_ERR = ExceptionCode.NOT_SUPPORTED_ERR = (ExceptionMessage[9] = "Not supported", 9);
- var INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = (ExceptionMessage[10] = "Attribute in use", 10);
- var INVALID_STATE_ERR = ExceptionCode.INVALID_STATE_ERR = (ExceptionMessage[11] = "Invalid state", 11);
- var SYNTAX_ERR = ExceptionCode.SYNTAX_ERR = (ExceptionMessage[12] = "Syntax error", 12);
- var INVALID_MODIFICATION_ERR = ExceptionCode.INVALID_MODIFICATION_ERR = (ExceptionMessage[13] = "Invalid modification", 13);
- var NAMESPACE_ERR = ExceptionCode.NAMESPACE_ERR = (ExceptionMessage[14] = "Invalid namespace", 14);
- var INVALID_ACCESS_ERR = ExceptionCode.INVALID_ACCESS_ERR = (ExceptionMessage[15] = "Invalid access", 15);
- function DOMException(code, message) {
- if (message instanceof Error) {
- var error = message;
- } else {
- error = this;
- Error.call(this, ExceptionMessage[code]);
- this.message = ExceptionMessage[code];
- if (Error.captureStackTrace) Error.captureStackTrace(this, DOMException);
- }
- error.code = code;
- if (message) this.message = this.message + ": " + message;
- return error;
- }
- DOMException.prototype = Error.prototype;
- copy(ExceptionCode, DOMException);
- function NodeList() {
- }
- NodeList.prototype = {
- /**
- * The number of nodes in the list. The range of valid child node indices is 0 to length-1 inclusive.
- * @standard level1
- */
- length: 0,
- /**
- * Returns the indexth item in the collection. If index is greater than or equal to the number of nodes in the list, this returns null.
- * @standard level1
- * @param index unsigned long
- * Index into the collection.
- * @return Node
- * The node at the indexth position in the NodeList, or null if that is not a valid index.
- */
- item: function(index) {
- return index >= 0 && index < this.length ? this[index] : null;
- },
- toString: function(isHTML, nodeFilter) {
- for (var buf = [], i = 0; i < this.length; i++) {
- serializeToString(this[i], buf, isHTML, nodeFilter);
- }
- return buf.join("");
- },
- /**
- * @private
- * @param {function (Node):boolean} predicate
- * @returns {Node[]}
- */
- filter: function(predicate) {
- return Array.prototype.filter.call(this, predicate);
- },
- /**
- * @private
- * @param {Node} item
- * @returns {number}
- */
- indexOf: function(item) {
- return Array.prototype.indexOf.call(this, item);
- }
- };
- function LiveNodeList(node, refresh) {
- this._node = node;
- this._refresh = refresh;
- _updateLiveList(this);
- }
- function _updateLiveList(list) {
- var inc = list._node._inc || list._node.ownerDocument._inc;
- if (list._inc !== inc) {
- var ls = list._refresh(list._node);
- __set__(list, "length", ls.length);
- if (!list.$$length || ls.length < list.$$length) {
- for (var i = ls.length; i in list; i++) {
- if (Object.prototype.hasOwnProperty.call(list, i)) {
- delete list[i];
- }
- }
- }
- copy(ls, list);
- list._inc = inc;
- }
- }
- LiveNodeList.prototype.item = function(i) {
- _updateLiveList(this);
- return this[i] || null;
- };
- _extends(LiveNodeList, NodeList);
- function NamedNodeMap() {
- }
- function _findNodeIndex(list, node) {
- var i = list.length;
- while (i--) {
- if (list[i] === node) {
- return i;
- }
- }
- }
- function _addNamedNode(el, list, newAttr, oldAttr) {
- if (oldAttr) {
- list[_findNodeIndex(list, oldAttr)] = newAttr;
- } else {
- list[list.length++] = newAttr;
- }
- if (el) {
- newAttr.ownerElement = el;
- var doc = el.ownerDocument;
- if (doc) {
- oldAttr && _onRemoveAttribute(doc, el, oldAttr);
- _onAddAttribute(doc, el, newAttr);
- }
- }
- }
- function _removeNamedNode(el, list, attr) {
- var i = _findNodeIndex(list, attr);
- if (i >= 0) {
- var lastIndex = list.length - 1;
- while (i < lastIndex) {
- list[i] = list[++i];
- }
- list.length = lastIndex;
- if (el) {
- var doc = el.ownerDocument;
- if (doc) {
- _onRemoveAttribute(doc, el, attr);
- attr.ownerElement = null;
- }
- }
- } else {
- throw new DOMException(NOT_FOUND_ERR, new Error(el.tagName + "@" + attr));
- }
- }
- NamedNodeMap.prototype = {
- length: 0,
- item: NodeList.prototype.item,
- getNamedItem: function(key) {
- var i = this.length;
- while (i--) {
- var attr = this[i];
- if (attr.nodeName == key) {
- return attr;
- }
- }
- },
- setNamedItem: function(attr) {
- var el = attr.ownerElement;
- if (el && el != this._ownerElement) {
- throw new DOMException(INUSE_ATTRIBUTE_ERR);
- }
- var oldAttr = this.getNamedItem(attr.nodeName);
- _addNamedNode(this._ownerElement, this, attr, oldAttr);
- return oldAttr;
- },
- /* returns Node */
- setNamedItemNS: function(attr) {
- var el = attr.ownerElement, oldAttr;
- if (el && el != this._ownerElement) {
- throw new DOMException(INUSE_ATTRIBUTE_ERR);
- }
- oldAttr = this.getNamedItemNS(attr.namespaceURI, attr.localName);
- _addNamedNode(this._ownerElement, this, attr, oldAttr);
- return oldAttr;
- },
- /* returns Node */
- removeNamedItem: function(key) {
- var attr = this.getNamedItem(key);
- _removeNamedNode(this._ownerElement, this, attr);
- return attr;
- },
- // raises: NOT_FOUND_ERR,NO_MODIFICATION_ALLOWED_ERR
- //for level2
- removeNamedItemNS: function(namespaceURI, localName) {
- var attr = this.getNamedItemNS(namespaceURI, localName);
- _removeNamedNode(this._ownerElement, this, attr);
- return attr;
- },
- getNamedItemNS: function(namespaceURI, localName) {
- var i = this.length;
- while (i--) {
- var node = this[i];
- if (node.localName == localName && node.namespaceURI == namespaceURI) {
- return node;
- }
- }
- return null;
- }
- };
- function DOMImplementation() {
- }
- DOMImplementation.prototype = {
- /**
- * The DOMImplementation.hasFeature() method returns a Boolean flag indicating if a given feature is supported.
- * The different implementations fairly diverged in what kind of features were reported.
- * The latest version of the spec settled to force this method to always return true, where the functionality was accurate and in use.
- *
- * @deprecated It is deprecated and modern browsers return true in all cases.
- *
- * @param {string} feature
- * @param {string} [version]
- * @returns {boolean} always true
- *
- * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/hasFeature MDN
- * @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-5CED94D7 DOM Level 1 Core
- * @see https://dom.spec.whatwg.org/#dom-domimplementation-hasfeature DOM Living Standard
- */
- hasFeature: function(feature, version) {
- return true;
- },
- /**
- * Creates an XML Document object of the specified type with its document element.
- *
- * __It behaves slightly different from the description in the living standard__:
- * - There is no interface/class `XMLDocument`, it returns a `Document` instance.
- * - `contentType`, `encoding`, `mode`, `origin`, `url` fields are currently not declared.
- * - this implementation is not validating names or qualified names
- * (when parsing XML strings, the SAX parser takes care of that)
- *
- * @param {string|null} namespaceURI
- * @param {string} qualifiedName
- * @param {DocumentType=null} doctype
- * @returns {Document}
- *
- * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocument MDN
- * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocument DOM Level 2 Core (initial)
- * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument DOM Level 2 Core
- *
- * @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract
- * @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names
- * @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names
- */
- createDocument: function(namespaceURI, qualifiedName, doctype) {
- var doc = new Document();
- doc.implementation = this;
- doc.childNodes = new NodeList();
- doc.doctype = doctype || null;
- if (doctype) {
- doc.appendChild(doctype);
- }
- if (qualifiedName) {
- var root = doc.createElementNS(namespaceURI, qualifiedName);
- doc.appendChild(root);
- }
- return doc;
- },
- /**
- * Returns a doctype, with the given `qualifiedName`, `publicId`, and `systemId`.
- *
- * __This behavior is slightly different from the in the specs__:
- * - this implementation is not validating names or qualified names
- * (when parsing XML strings, the SAX parser takes care of that)
- *
- * @param {string} qualifiedName
- * @param {string} [publicId]
- * @param {string} [systemId]
- * @returns {DocumentType} which can either be used with `DOMImplementation.createDocument` upon document creation
- * or can be put into the document via methods like `Node.insertBefore()` or `Node.replaceChild()`
- *
- * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocumentType MDN
- * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocType DOM Level 2 Core
- * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype DOM Living Standard
- *
- * @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract
- * @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names
- * @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names
- */
- createDocumentType: function(qualifiedName, publicId, systemId) {
- var node = new DocumentType();
- node.name = qualifiedName;
- node.nodeName = qualifiedName;
- node.publicId = publicId || "";
- node.systemId = systemId || "";
- return node;
- }
- };
- function Node() {
- }
- Node.prototype = {
- firstChild: null,
- lastChild: null,
- previousSibling: null,
- nextSibling: null,
- attributes: null,
- parentNode: null,
- childNodes: null,
- ownerDocument: null,
- nodeValue: null,
- namespaceURI: null,
- prefix: null,
- localName: null,
- // Modified in DOM Level 2:
- insertBefore: function(newChild, refChild) {
- return _insertBefore(this, newChild, refChild);
- },
- replaceChild: function(newChild, oldChild) {
- _insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument);
- if (oldChild) {
- this.removeChild(oldChild);
- }
- },
- removeChild: function(oldChild) {
- return _removeChild(this, oldChild);
- },
- appendChild: function(newChild) {
- return this.insertBefore(newChild, null);
- },
- hasChildNodes: function() {
- return this.firstChild != null;
- },
- cloneNode: function(deep) {
- return cloneNode(this.ownerDocument || this, this, deep);
- },
- // Modified in DOM Level 2:
- normalize: function() {
- var child = this.firstChild;
- while (child) {
- var next = child.nextSibling;
- if (next && next.nodeType == TEXT_NODE && child.nodeType == TEXT_NODE) {
- this.removeChild(next);
- child.appendData(next.data);
- } else {
- child.normalize();
- child = next;
- }
- }
- },
- // Introduced in DOM Level 2:
- isSupported: function(feature, version) {
- return this.ownerDocument.implementation.hasFeature(feature, version);
- },
- // Introduced in DOM Level 2:
- hasAttributes: function() {
- return this.attributes.length > 0;
- },
- /**
- * Look up the prefix associated to the given namespace URI, starting from this node.
- * **The default namespace declarations are ignored by this method.**
- * See Namespace Prefix Lookup for details on the algorithm used by this method.
- *
- * _Note: The implementation seems to be incomplete when compared to the algorithm described in the specs._
- *
- * @param {string | null} namespaceURI
- * @returns {string | null}
- * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespacePrefix
- * @see https://www.w3.org/TR/DOM-Level-3-Core/namespaces-algorithms.html#lookupNamespacePrefixAlgo
- * @see https://dom.spec.whatwg.org/#dom-node-lookupprefix
- * @see https://github.com/xmldom/xmldom/issues/322
- */
- lookupPrefix: function(namespaceURI) {
- var el = this;
- while (el) {
- var map = el._nsMap;
- if (map) {
- for (var n in map) {
- if (Object.prototype.hasOwnProperty.call(map, n) && map[n] === namespaceURI) {
- return n;
- }
- }
- }
- el = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode;
- }
- return null;
- },
- // Introduced in DOM Level 3:
- lookupNamespaceURI: function(prefix) {
- var el = this;
- while (el) {
- var map = el._nsMap;
- if (map) {
- if (Object.prototype.hasOwnProperty.call(map, prefix)) {
- return map[prefix];
- }
- }
- el = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode;
- }
- return null;
- },
- // Introduced in DOM Level 3:
- isDefaultNamespace: function(namespaceURI) {
- var prefix = this.lookupPrefix(namespaceURI);
- return prefix == null;
- }
- };
- function _xmlEncoder(c) {
- return c == "<" && "<" || c == ">" && ">" || c == "&" && "&" || c == '"' && """ || "" + c.charCodeAt() + ";";
- }
- copy(NodeType, Node);
- copy(NodeType, Node.prototype);
- function _visitNode(node, callback) {
- if (callback(node)) {
- return true;
- }
- if (node = node.firstChild) {
- do {
- if (_visitNode(node, callback)) {
- return true;
- }
- } while (node = node.nextSibling);
- }
- }
- function Document() {
- this.ownerDocument = this;
- }
- function _onAddAttribute(doc, el, newAttr) {
- doc && doc._inc++;
- var ns = newAttr.namespaceURI;
- if (ns === NAMESPACE.XMLNS) {
- el._nsMap[newAttr.prefix ? newAttr.localName : ""] = newAttr.value;
- }
- }
- function _onRemoveAttribute(doc, el, newAttr, remove) {
- doc && doc._inc++;
- var ns = newAttr.namespaceURI;
- if (ns === NAMESPACE.XMLNS) {
- delete el._nsMap[newAttr.prefix ? newAttr.localName : ""];
- }
- }
- function _onUpdateChild(doc, el, newChild) {
- if (doc && doc._inc) {
- doc._inc++;
- var cs = el.childNodes;
- if (newChild) {
- cs[cs.length++] = newChild;
- } else {
- var child = el.firstChild;
- var i = 0;
- while (child) {
- cs[i++] = child;
- child = child.nextSibling;
- }
- cs.length = i;
- delete cs[cs.length];
- }
- }
- }
- function _removeChild(parentNode, child) {
- var previous = child.previousSibling;
- var next = child.nextSibling;
- if (previous) {
- previous.nextSibling = next;
- } else {
- parentNode.firstChild = next;
- }
- if (next) {
- next.previousSibling = previous;
- } else {
- parentNode.lastChild = previous;
- }
- child.parentNode = null;
- child.previousSibling = null;
- child.nextSibling = null;
- _onUpdateChild(parentNode.ownerDocument, parentNode);
- return child;
- }
- function hasValidParentNodeType(node) {
- return node && (node.nodeType === Node.DOCUMENT_NODE || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node.ELEMENT_NODE);
- }
- function hasInsertableNodeType(node) {
- return node && (isElementNode(node) || isTextNode(node) || isDocTypeNode(node) || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node.COMMENT_NODE || node.nodeType === Node.PROCESSING_INSTRUCTION_NODE);
- }
- function isDocTypeNode(node) {
- return node && node.nodeType === Node.DOCUMENT_TYPE_NODE;
- }
- function isElementNode(node) {
- return node && node.nodeType === Node.ELEMENT_NODE;
- }
- function isTextNode(node) {
- return node && node.nodeType === Node.TEXT_NODE;
- }
- function isElementInsertionPossible(doc, child) {
- var parentChildNodes = doc.childNodes || [];
- if (find(parentChildNodes, isElementNode) || isDocTypeNode(child)) {
- return false;
- }
- var docTypeNode = find(parentChildNodes, isDocTypeNode);
- return !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child));
- }
- function isElementReplacementPossible(doc, child) {
- var parentChildNodes = doc.childNodes || [];
- function hasElementChildThatIsNotChild(node) {
- return isElementNode(node) && node !== child;
- }
- if (find(parentChildNodes, hasElementChildThatIsNotChild)) {
- return false;
- }
- var docTypeNode = find(parentChildNodes, isDocTypeNode);
- return !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child));
- }
- function assertPreInsertionValidity1to5(parent, node, child) {
- if (!hasValidParentNodeType(parent)) {
- throw new DOMException(HIERARCHY_REQUEST_ERR, "Unexpected parent node type " + parent.nodeType);
- }
- if (child && child.parentNode !== parent) {
- throw new DOMException(NOT_FOUND_ERR, "child not in parent");
- }
- if (
- // 4. If `node` is not a DocumentFragment, DocumentType, Element, or CharacterData node, then throw a "HierarchyRequestError" DOMException.
- !hasInsertableNodeType(node) || // 5. If either `node` is a Text node and `parent` is a document,
- // the sax parser currently adds top level text nodes, this will be fixed in 0.9.0
- // || (node.nodeType === Node.TEXT_NODE && parent.nodeType === Node.DOCUMENT_NODE)
- // or `node` is a doctype and `parent` is not a document, then throw a "HierarchyRequestError" DOMException.
- isDocTypeNode(node) && parent.nodeType !== Node.DOCUMENT_NODE
- ) {
- throw new DOMException(
- HIERARCHY_REQUEST_ERR,
- "Unexpected node type " + node.nodeType + " for parent node type " + parent.nodeType
- );
- }
- }
- function assertPreInsertionValidityInDocument(parent, node, child) {
- var parentChildNodes = parent.childNodes || [];
- var nodeChildNodes = node.childNodes || [];
- if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
- var nodeChildElements = nodeChildNodes.filter(isElementNode);
- if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) {
- throw new DOMException(HIERARCHY_REQUEST_ERR, "More than one element or text in fragment");
- }
- if (nodeChildElements.length === 1 && !isElementInsertionPossible(parent, child)) {
- throw new DOMException(HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype");
- }
- }
- if (isElementNode(node)) {
- if (!isElementInsertionPossible(parent, child)) {
- throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype");
- }
- }
- if (isDocTypeNode(node)) {
- if (find(parentChildNodes, isDocTypeNode)) {
- throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one doctype is allowed");
- }
- var parentElementChild = find(parentChildNodes, isElementNode);
- if (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) {
- throw new DOMException(HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element");
- }
- if (!child && parentElementChild) {
- throw new DOMException(HIERARCHY_REQUEST_ERR, "Doctype can not be appended since element is present");
- }
- }
- }
- function assertPreReplacementValidityInDocument(parent, node, child) {
- var parentChildNodes = parent.childNodes || [];
- var nodeChildNodes = node.childNodes || [];
- if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
- var nodeChildElements = nodeChildNodes.filter(isElementNode);
- if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) {
- throw new DOMException(HIERARCHY_REQUEST_ERR, "More than one element or text in fragment");
- }
- if (nodeChildElements.length === 1 && !isElementReplacementPossible(parent, child)) {
- throw new DOMException(HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype");
- }
- }
- if (isElementNode(node)) {
- if (!isElementReplacementPossible(parent, child)) {
- throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype");
- }
- }
- if (isDocTypeNode(node)) {
- let hasDoctypeChildThatIsNotChild2 = function(node2) {
- return isDocTypeNode(node2) && node2 !== child;
- };
- var hasDoctypeChildThatIsNotChild = hasDoctypeChildThatIsNotChild2;
- if (find(parentChildNodes, hasDoctypeChildThatIsNotChild2)) {
- throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one doctype is allowed");
- }
- var parentElementChild = find(parentChildNodes, isElementNode);
- if (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) {
- throw new DOMException(HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element");
- }
- }
- }
- function _insertBefore(parent, node, child, _inDocumentAssertion) {
- assertPreInsertionValidity1to5(parent, node, child);
- if (parent.nodeType === Node.DOCUMENT_NODE) {
- (_inDocumentAssertion || assertPreInsertionValidityInDocument)(parent, node, child);
- }
- var cp = node.parentNode;
- if (cp) {
- cp.removeChild(node);
- }
- if (node.nodeType === DOCUMENT_FRAGMENT_NODE) {
- var newFirst = node.firstChild;
- if (newFirst == null) {
- return node;
- }
- var newLast = node.lastChild;
- } else {
- newFirst = newLast = node;
- }
- var pre = child ? child.previousSibling : parent.lastChild;
- newFirst.previousSibling = pre;
- newLast.nextSibling = child;
- if (pre) {
- pre.nextSibling = newFirst;
- } else {
- parent.firstChild = newFirst;
- }
- if (child == null) {
- parent.lastChild = newLast;
- } else {
- child.previousSibling = newLast;
- }
- do {
- newFirst.parentNode = parent;
- } while (newFirst !== newLast && (newFirst = newFirst.nextSibling));
- _onUpdateChild(parent.ownerDocument || parent, parent);
- if (node.nodeType == DOCUMENT_FRAGMENT_NODE) {
- node.firstChild = node.lastChild = null;
- }
- return node;
- }
- function _appendSingleChild(parentNode, newChild) {
- if (newChild.parentNode) {
- newChild.parentNode.removeChild(newChild);
- }
- newChild.parentNode = parentNode;
- newChild.previousSibling = parentNode.lastChild;
- newChild.nextSibling = null;
- if (newChild.previousSibling) {
- newChild.previousSibling.nextSibling = newChild;
- } else {
- parentNode.firstChild = newChild;
- }
- parentNode.lastChild = newChild;
- _onUpdateChild(parentNode.ownerDocument, parentNode, newChild);
- return newChild;
- }
- Document.prototype = {
- //implementation : null,
- nodeName: "#document",
- nodeType: DOCUMENT_NODE,
- /**
- * The DocumentType node of the document.
- *
- * @readonly
- * @type DocumentType
- */
- doctype: null,
- documentElement: null,
- _inc: 1,
- insertBefore: function(newChild, refChild) {
- if (newChild.nodeType == DOCUMENT_FRAGMENT_NODE) {
- var child = newChild.firstChild;
- while (child) {
- var next = child.nextSibling;
- this.insertBefore(child, refChild);
- child = next;
- }
- return newChild;
- }
- _insertBefore(this, newChild, refChild);
- newChild.ownerDocument = this;
- if (this.documentElement === null && newChild.nodeType === ELEMENT_NODE) {
- this.documentElement = newChild;
- }
- return newChild;
- },
- removeChild: function(oldChild) {
- if (this.documentElement == oldChild) {
- this.documentElement = null;
- }
- return _removeChild(this, oldChild);
- },
- replaceChild: function(newChild, oldChild) {
- _insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument);
- newChild.ownerDocument = this;
- if (oldChild) {
- this.removeChild(oldChild);
- }
- if (isElementNode(newChild)) {
- this.documentElement = newChild;
- }
- },
- // Introduced in DOM Level 2:
- importNode: function(importedNode, deep) {
- return importNode(this, importedNode, deep);
- },
- // Introduced in DOM Level 2:
- getElementById: function(id) {
- var rtv = null;
- _visitNode(this.documentElement, function(node) {
- if (node.nodeType == ELEMENT_NODE) {
- if (node.getAttribute("id") == id) {
- rtv = node;
- return true;
- }
- }
- });
- return rtv;
- },
- /**
- * The `getElementsByClassName` method of `Document` interface returns an array-like object
- * of all child elements which have **all** of the given class name(s).
- *
- * Returns an empty list if `classeNames` is an empty string or only contains HTML white space characters.
- *
- *
- * Warning: This is a live LiveNodeList.
- * Changes in the DOM will reflect in the array as the changes occur.
- * If an element selected by this array no longer qualifies for the selector,
- * it will automatically be removed. Be aware of this for iteration purposes.
- *
- * @param {string} classNames is a string representing the class name(s) to match; multiple class names are separated by (ASCII-)whitespace
- *
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName
- * @see https://dom.spec.whatwg.org/#concept-getelementsbyclassname
- */
- getElementsByClassName: function(classNames) {
- var classNamesSet = toOrderedSet(classNames);
- return new LiveNodeList(this, function(base) {
- var ls = [];
- if (classNamesSet.length > 0) {
- _visitNode(base.documentElement, function(node) {
- if (node !== base && node.nodeType === ELEMENT_NODE) {
- var nodeClassNames = node.getAttribute("class");
- if (nodeClassNames) {
- var matches = classNames === nodeClassNames;
- if (!matches) {
- var nodeClassNamesSet = toOrderedSet(nodeClassNames);
- matches = classNamesSet.every(arrayIncludes(nodeClassNamesSet));
- }
- if (matches) {
- ls.push(node);
- }
- }
- }
- });
- }
- return ls;
- });
- },
- //document factory method:
- createElement: function(tagName) {
- var node = new Element();
- node.ownerDocument = this;
- node.nodeName = tagName;
- node.tagName = tagName;
- node.localName = tagName;
- node.childNodes = new NodeList();
- var attrs = node.attributes = new NamedNodeMap();
- attrs._ownerElement = node;
- return node;
- },
- createDocumentFragment: function() {
- var node = new DocumentFragment();
- node.ownerDocument = this;
- node.childNodes = new NodeList();
- return node;
- },
- createTextNode: function(data) {
- var node = new Text();
- node.ownerDocument = this;
- node.appendData(data);
- return node;
- },
- createComment: function(data) {
- var node = new Comment();
- node.ownerDocument = this;
- node.appendData(data);
- return node;
- },
- createCDATASection: function(data) {
- var node = new CDATASection();
- node.ownerDocument = this;
- node.appendData(data);
- return node;
- },
- createProcessingInstruction: function(target, data) {
- var node = new ProcessingInstruction();
- node.ownerDocument = this;
- node.tagName = node.nodeName = node.target = target;
- node.nodeValue = node.data = data;
- return node;
- },
- createAttribute: function(name2) {
- var node = new Attr();
- node.ownerDocument = this;
- node.name = name2;
- node.nodeName = name2;
- node.localName = name2;
- node.specified = true;
- return node;
- },
- createEntityReference: function(name2) {
- var node = new EntityReference();
- node.ownerDocument = this;
- node.nodeName = name2;
- return node;
- },
- // Introduced in DOM Level 2:
- createElementNS: function(namespaceURI, qualifiedName) {
- var node = new Element();
- var pl = qualifiedName.split(":");
- var attrs = node.attributes = new NamedNodeMap();
- node.childNodes = new NodeList();
- node.ownerDocument = this;
- node.nodeName = qualifiedName;
- node.tagName = qualifiedName;
- node.namespaceURI = namespaceURI;
- if (pl.length == 2) {
- node.prefix = pl[0];
- node.localName = pl[1];
- } else {
- node.localName = qualifiedName;
- }
- attrs._ownerElement = node;
- return node;
- },
- // Introduced in DOM Level 2:
- createAttributeNS: function(namespaceURI, qualifiedName) {
- var node = new Attr();
- var pl = qualifiedName.split(":");
- node.ownerDocument = this;
- node.nodeName = qualifiedName;
- node.name = qualifiedName;
- node.namespaceURI = namespaceURI;
- node.specified = true;
- if (pl.length == 2) {
- node.prefix = pl[0];
- node.localName = pl[1];
- } else {
- node.localName = qualifiedName;
- }
- return node;
- }
- };
- _extends(Document, Node);
- function Element() {
- this._nsMap = {};
- }
- Element.prototype = {
- nodeType: ELEMENT_NODE,
- hasAttribute: function(name2) {
- return this.getAttributeNode(name2) != null;
- },
- getAttribute: function(name2) {
- var attr = this.getAttributeNode(name2);
- return attr && attr.value || "";
- },
- getAttributeNode: function(name2) {
- return this.attributes.getNamedItem(name2);
- },
- setAttribute: function(name2, value) {
- var attr = this.ownerDocument.createAttribute(name2);
- attr.value = attr.nodeValue = "" + value;
- this.setAttributeNode(attr);
- },
- removeAttribute: function(name2) {
- var attr = this.getAttributeNode(name2);
- attr && this.removeAttributeNode(attr);
- },
- //four real opeartion method
- appendChild: function(newChild) {
- if (newChild.nodeType === DOCUMENT_FRAGMENT_NODE) {
- return this.insertBefore(newChild, null);
- } else {
- return _appendSingleChild(this, newChild);
- }
- },
- setAttributeNode: function(newAttr) {
- return this.attributes.setNamedItem(newAttr);
- },
- setAttributeNodeNS: function(newAttr) {
- return this.attributes.setNamedItemNS(newAttr);
- },
- removeAttributeNode: function(oldAttr) {
- return this.attributes.removeNamedItem(oldAttr.nodeName);
- },
- //get real attribute name,and remove it by removeAttributeNode
- removeAttributeNS: function(namespaceURI, localName) {
- var old = this.getAttributeNodeNS(namespaceURI, localName);
- old && this.removeAttributeNode(old);
- },
- hasAttributeNS: function(namespaceURI, localName) {
- return this.getAttributeNodeNS(namespaceURI, localName) != null;
- },
- getAttributeNS: function(namespaceURI, localName) {
- var attr = this.getAttributeNodeNS(namespaceURI, localName);
- return attr && attr.value || "";
- },
- setAttributeNS: function(namespaceURI, qualifiedName, value) {
- var attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName);
- attr.value = attr.nodeValue = "" + value;
- this.setAttributeNode(attr);
- },
- getAttributeNodeNS: function(namespaceURI, localName) {
- return this.attributes.getNamedItemNS(namespaceURI, localName);
- },
- getElementsByTagName: function(tagName) {
- return new LiveNodeList(this, function(base) {
- var ls = [];
- _visitNode(base, function(node) {
- if (node !== base && node.nodeType == ELEMENT_NODE && (tagName === "*" || node.tagName == tagName)) {
- ls.push(node);
- }
- });
- return ls;
- });
- },
- getElementsByTagNameNS: function(namespaceURI, localName) {
- return new LiveNodeList(this, function(base) {
- var ls = [];
- _visitNode(base, function(node) {
- if (node !== base && node.nodeType === ELEMENT_NODE && (namespaceURI === "*" || node.namespaceURI === namespaceURI) && (localName === "*" || node.localName == localName)) {
- ls.push(node);
- }
- });
- return ls;
- });
- }
- };
- Document.prototype.getElementsByTagName = Element.prototype.getElementsByTagName;
- Document.prototype.getElementsByTagNameNS = Element.prototype.getElementsByTagNameNS;
- _extends(Element, Node);
- function Attr() {
- }
- Attr.prototype.nodeType = ATTRIBUTE_NODE;
- _extends(Attr, Node);
- function CharacterData() {
- }
- CharacterData.prototype = {
- data: "",
- substringData: function(offset, count) {
- return this.data.substring(offset, offset + count);
- },
- appendData: function(text) {
- text = this.data + text;
- this.nodeValue = this.data = text;
- this.length = text.length;
- },
- insertData: function(offset, text) {
- this.replaceData(offset, 0, text);
- },
- appendChild: function(newChild) {
- throw new Error(ExceptionMessage[HIERARCHY_REQUEST_ERR]);
- },
- deleteData: function(offset, count) {
- this.replaceData(offset, count, "");
- },
- replaceData: function(offset, count, text) {
- var start = this.data.substring(0, offset);
- var end = this.data.substring(offset + count);
- text = start + text + end;
- this.nodeValue = this.data = text;
- this.length = text.length;
- }
- };
- _extends(CharacterData, Node);
- function Text() {
- }
- Text.prototype = {
- nodeName: "#text",
- nodeType: TEXT_NODE,
- splitText: function(offset) {
- var text = this.data;
- var newText = text.substring(offset);
- text = text.substring(0, offset);
- this.data = this.nodeValue = text;
- this.length = text.length;
- var newNode = this.ownerDocument.createTextNode(newText);
- if (this.parentNode) {
- this.parentNode.insertBefore(newNode, this.nextSibling);
- }
- return newNode;
- }
- };
- _extends(Text, CharacterData);
- function Comment() {
- }
- Comment.prototype = {
- nodeName: "#comment",
- nodeType: COMMENT_NODE
- };
- _extends(Comment, CharacterData);
- function CDATASection() {
- }
- CDATASection.prototype = {
- nodeName: "#cdata-section",
- nodeType: CDATA_SECTION_NODE
- };
- _extends(CDATASection, CharacterData);
- function DocumentType() {
- }
- DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;
- _extends(DocumentType, Node);
- function Notation() {
- }
- Notation.prototype.nodeType = NOTATION_NODE;
- _extends(Notation, Node);
- function Entity() {
- }
- Entity.prototype.nodeType = ENTITY_NODE;
- _extends(Entity, Node);
- function EntityReference() {
- }
- EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE;
- _extends(EntityReference, Node);
- function DocumentFragment() {
- }
- DocumentFragment.prototype.nodeName = "#document-fragment";
- DocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE;
- _extends(DocumentFragment, Node);
- function ProcessingInstruction() {
- }
- ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE;
- _extends(ProcessingInstruction, Node);
- function XMLSerializer() {
- }
- XMLSerializer.prototype.serializeToString = function(node, isHtml, nodeFilter) {
- return nodeSerializeToString.call(node, isHtml, nodeFilter);
- };
- Node.prototype.toString = nodeSerializeToString;
- function nodeSerializeToString(isHtml, nodeFilter) {
- var buf = [];
- var refNode = this.nodeType == 9 && this.documentElement || this;
- var prefix = refNode.prefix;
- var uri = refNode.namespaceURI;
- if (uri && prefix == null) {
- var prefix = refNode.lookupPrefix(uri);
- if (prefix == null) {
- var visibleNamespaces = [
- { namespace: uri, prefix: null }
- //{namespace:uri,prefix:''}
- ];
- }
- }
- serializeToString(this, buf, isHtml, nodeFilter, visibleNamespaces);
- return buf.join("");
- }
- function needNamespaceDefine(node, isHTML, visibleNamespaces) {
- var prefix = node.prefix || "";
- var uri = node.namespaceURI;
- if (!uri) {
- return false;
- }
- if (prefix === "xml" && uri === NAMESPACE.XML || uri === NAMESPACE.XMLNS) {
- return false;
- }
- var i = visibleNamespaces.length;
- while (i--) {
- var ns = visibleNamespaces[i];
- if (ns.prefix === prefix) {
- return ns.namespace !== uri;
- }
- }
- return true;
- }
- function addSerializedAttribute(buf, qualifiedName, value) {
- buf.push(" ", qualifiedName, '="', value.replace(/[<>&"\t\n\r]/g, _xmlEncoder), '"');
- }
- function serializeToString(node, buf, isHTML, nodeFilter, visibleNamespaces) {
- if (!visibleNamespaces) {
- visibleNamespaces = [];
- }
- if (nodeFilter) {
- node = nodeFilter(node);
- if (node) {
- if (typeof node == "string") {
- buf.push(node);
- return;
- }
- } else {
- return;
- }
- }
- switch (node.nodeType) {
- case ELEMENT_NODE:
- var attrs = node.attributes;
- var len = attrs.length;
- var child = node.firstChild;
- var nodeName = node.tagName;
- isHTML = NAMESPACE.isHTML(node.namespaceURI) || isHTML;
- var prefixedNodeName = nodeName;
- if (!isHTML && !node.prefix && node.namespaceURI) {
- var defaultNS;
- for (var ai = 0; ai < attrs.length; ai++) {
- if (attrs.item(ai).name === "xmlns") {
- defaultNS = attrs.item(ai).value;
- break;
- }
- }
- if (!defaultNS) {
- for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {
- var namespace = visibleNamespaces[nsi];
- if (namespace.prefix === "" && namespace.namespace === node.namespaceURI) {
- defaultNS = namespace.namespace;
- break;
- }
- }
- }
- if (defaultNS !== node.namespaceURI) {
- for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {
- var namespace = visibleNamespaces[nsi];
- if (namespace.namespace === node.namespaceURI) {
- if (namespace.prefix) {
- prefixedNodeName = namespace.prefix + ":" + nodeName;
- }
- break;
- }
- }
- }
- }
- buf.push("<", prefixedNodeName);
- for (var i = 0; i < len; i++) {
- var attr = attrs.item(i);
- if (attr.prefix == "xmlns") {
- visibleNamespaces.push({ prefix: attr.localName, namespace: attr.value });
- } else if (attr.nodeName == "xmlns") {
- visibleNamespaces.push({ prefix: "", namespace: attr.value });
- }
- }
- for (var i = 0; i < len; i++) {
- var attr = attrs.item(i);
- if (needNamespaceDefine(attr, isHTML, visibleNamespaces)) {
- var prefix = attr.prefix || "";
- var uri = attr.namespaceURI;
- addSerializedAttribute(buf, prefix ? "xmlns:" + prefix : "xmlns", uri);
- visibleNamespaces.push({ prefix, namespace: uri });
- }
- serializeToString(attr, buf, isHTML, nodeFilter, visibleNamespaces);
- }
- if (nodeName === prefixedNodeName && needNamespaceDefine(node, isHTML, visibleNamespaces)) {
- var prefix = node.prefix || "";
- var uri = node.namespaceURI;
- addSerializedAttribute(buf, prefix ? "xmlns:" + prefix : "xmlns", uri);
- visibleNamespaces.push({ prefix, namespace: uri });
- }
- if (child || isHTML && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)) {
- buf.push(">");
- if (isHTML && /^script$/i.test(nodeName)) {
- while (child) {
- if (child.data) {
- buf.push(child.data);
- } else {
- serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
- }
- child = child.nextSibling;
- }
- } else {
- while (child) {
- serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
- child = child.nextSibling;
- }
- }
- buf.push("", prefixedNodeName, ">");
- } else {
- buf.push("/>");
- }
- return;
- case DOCUMENT_NODE:
- case DOCUMENT_FRAGMENT_NODE:
- var child = node.firstChild;
- while (child) {
- serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
- child = child.nextSibling;
- }
- return;
- case ATTRIBUTE_NODE:
- return addSerializedAttribute(buf, node.name, node.value);
- case TEXT_NODE:
- return buf.push(
- node.data.replace(/[<&>]/g, _xmlEncoder)
- );
- case CDATA_SECTION_NODE:
- return buf.push("");
- case COMMENT_NODE:
- return buf.push("");
- case DOCUMENT_TYPE_NODE:
- var pubid = node.publicId;
- var sysid = node.systemId;
- buf.push("");
- } else if (sysid && sysid != ".") {
- buf.push(" SYSTEM ", sysid, ">");
- } else {
- var sub = node.internalSubset;
- if (sub) {
- buf.push(" [", sub, "]");
- }
- buf.push(">");
- }
- return;
- case PROCESSING_INSTRUCTION_NODE:
- return buf.push("", node.target, " ", node.data, "?>");
- case ENTITY_REFERENCE_NODE:
- return buf.push("&", node.nodeName, ";");
- default:
- buf.push("??", node.nodeName);
- }
- }
- function importNode(doc, node, deep) {
- var node2;
- switch (node.nodeType) {
- case ELEMENT_NODE:
- node2 = node.cloneNode(false);
- node2.ownerDocument = doc;
- case DOCUMENT_FRAGMENT_NODE:
- break;
- case ATTRIBUTE_NODE:
- deep = true;
- break;
- }
- if (!node2) {
- node2 = node.cloneNode(false);
- }
- node2.ownerDocument = doc;
- node2.parentNode = null;
- if (deep) {
- var child = node.firstChild;
- while (child) {
- node2.appendChild(importNode(doc, child, deep));
- child = child.nextSibling;
- }
- }
- return node2;
- }
- function cloneNode(doc, node, deep) {
- var node2 = new node.constructor();
- for (var n in node) {
- if (Object.prototype.hasOwnProperty.call(node, n)) {
- var v = node[n];
- if (typeof v != "object") {
- if (v != node2[n]) {
- node2[n] = v;
- }
- }
- }
- }
- if (node.childNodes) {
- node2.childNodes = new NodeList();
- }
- node2.ownerDocument = doc;
- switch (node2.nodeType) {
- case ELEMENT_NODE:
- var attrs = node.attributes;
- var attrs2 = node2.attributes = new NamedNodeMap();
- var len = attrs.length;
- attrs2._ownerElement = node2;
- for (var i = 0; i < len; i++) {
- node2.setAttributeNode(cloneNode(doc, attrs.item(i), true));
- }
- break;
- ;
- case ATTRIBUTE_NODE:
- deep = true;
- }
- if (deep) {
- var child = node.firstChild;
- while (child) {
- node2.appendChild(cloneNode(doc, child, deep));
- child = child.nextSibling;
- }
- }
- return node2;
- }
- function __set__(object, key, value) {
- object[key] = value;
- }
- try {
- if (Object.defineProperty) {
- let getTextContent2 = function(node) {
- switch (node.nodeType) {
- case ELEMENT_NODE:
- case DOCUMENT_FRAGMENT_NODE:
- var buf = [];
- node = node.firstChild;
- while (node) {
- if (node.nodeType !== 7 && node.nodeType !== 8) {
- buf.push(getTextContent2(node));
- }
- node = node.nextSibling;
- }
- return buf.join("");
- default:
- return node.nodeValue;
- }
- };
- getTextContent = getTextContent2;
- Object.defineProperty(LiveNodeList.prototype, "length", {
- get: function() {
- _updateLiveList(this);
- return this.$$length;
- }
- });
- Object.defineProperty(Node.prototype, "textContent", {
- get: function() {
- return getTextContent2(this);
- },
- set: function(data) {
- switch (this.nodeType) {
- case ELEMENT_NODE:
- case DOCUMENT_FRAGMENT_NODE:
- while (this.firstChild) {
- this.removeChild(this.firstChild);
- }
- if (data || String(data)) {
- this.appendChild(this.ownerDocument.createTextNode(data));
- }
- break;
- default:
- this.data = data;
- this.value = data;
- this.nodeValue = data;
- }
- }
- });
- __set__ = function(object, key, value) {
- object["$$" + key] = value;
- };
- }
- } catch (e) {
- }
- var getTextContent;
- exports2.DocumentType = DocumentType;
- exports2.DOMException = DOMException;
- exports2.DOMImplementation = DOMImplementation;
- exports2.Element = Element;
- exports2.Node = Node;
- exports2.NodeList = NodeList;
- exports2.XMLSerializer = XMLSerializer;
- }
-});
-
-// ../../node_modules/@xmldom/xmldom/lib/entities.js
-var require_entities = __commonJS({
- "../../node_modules/@xmldom/xmldom/lib/entities.js"(exports2) {
- "use strict";
- var freeze = require_conventions().freeze;
- exports2.XML_ENTITIES = freeze({
- amp: "&",
- apos: "'",
- gt: ">",
- lt: "<",
- quot: '"'
- });
- exports2.HTML_ENTITIES = freeze({
- Aacute: "\xC1",
- aacute: "\xE1",
- Abreve: "\u0102",
- abreve: "\u0103",
- ac: "\u223E",
- acd: "\u223F",
- acE: "\u223E\u0333",
- Acirc: "\xC2",
- acirc: "\xE2",
- acute: "\xB4",
- Acy: "\u0410",
- acy: "\u0430",
- AElig: "\xC6",
- aelig: "\xE6",
- af: "\u2061",
- Afr: "\u{1D504}",
- afr: "\u{1D51E}",
- Agrave: "\xC0",
- agrave: "\xE0",
- alefsym: "\u2135",
- aleph: "\u2135",
- Alpha: "\u0391",
- alpha: "\u03B1",
- Amacr: "\u0100",
- amacr: "\u0101",
- amalg: "\u2A3F",
- AMP: "&",
- amp: "&",
- And: "\u2A53",
- and: "\u2227",
- andand: "\u2A55",
- andd: "\u2A5C",
- andslope: "\u2A58",
- andv: "\u2A5A",
- ang: "\u2220",
- ange: "\u29A4",
- angle: "\u2220",
- angmsd: "\u2221",
- angmsdaa: "\u29A8",
- angmsdab: "\u29A9",
- angmsdac: "\u29AA",
- angmsdad: "\u29AB",
- angmsdae: "\u29AC",
- angmsdaf: "\u29AD",
- angmsdag: "\u29AE",
- angmsdah: "\u29AF",
- angrt: "\u221F",
- angrtvb: "\u22BE",
- angrtvbd: "\u299D",
- angsph: "\u2222",
- angst: "\xC5",
- angzarr: "\u237C",
- Aogon: "\u0104",
- aogon: "\u0105",
- Aopf: "\u{1D538}",
- aopf: "\u{1D552}",
- ap: "\u2248",
- apacir: "\u2A6F",
- apE: "\u2A70",
- ape: "\u224A",
- apid: "\u224B",
- apos: "'",
- ApplyFunction: "\u2061",
- approx: "\u2248",
- approxeq: "\u224A",
- Aring: "\xC5",
- aring: "\xE5",
- Ascr: "\u{1D49C}",
- ascr: "\u{1D4B6}",
- Assign: "\u2254",
- ast: "*",
- asymp: "\u2248",
- asympeq: "\u224D",
- Atilde: "\xC3",
- atilde: "\xE3",
- Auml: "\xC4",
- auml: "\xE4",
- awconint: "\u2233",
- awint: "\u2A11",
- backcong: "\u224C",
- backepsilon: "\u03F6",
- backprime: "\u2035",
- backsim: "\u223D",
- backsimeq: "\u22CD",
- Backslash: "\u2216",
- Barv: "\u2AE7",
- barvee: "\u22BD",
- Barwed: "\u2306",
- barwed: "\u2305",
- barwedge: "\u2305",
- bbrk: "\u23B5",
- bbrktbrk: "\u23B6",
- bcong: "\u224C",
- Bcy: "\u0411",
- bcy: "\u0431",
- bdquo: "\u201E",
- becaus: "\u2235",
- Because: "\u2235",
- because: "\u2235",
- bemptyv: "\u29B0",
- bepsi: "\u03F6",
- bernou: "\u212C",
- Bernoullis: "\u212C",
- Beta: "\u0392",
- beta: "\u03B2",
- beth: "\u2136",
- between: "\u226C",
- Bfr: "\u{1D505}",
- bfr: "\u{1D51F}",
- bigcap: "\u22C2",
- bigcirc: "\u25EF",
- bigcup: "\u22C3",
- bigodot: "\u2A00",
- bigoplus: "\u2A01",
- bigotimes: "\u2A02",
- bigsqcup: "\u2A06",
- bigstar: "\u2605",
- bigtriangledown: "\u25BD",
- bigtriangleup: "\u25B3",
- biguplus: "\u2A04",
- bigvee: "\u22C1",
- bigwedge: "\u22C0",
- bkarow: "\u290D",
- blacklozenge: "\u29EB",
- blacksquare: "\u25AA",
- blacktriangle: "\u25B4",
- blacktriangledown: "\u25BE",
- blacktriangleleft: "\u25C2",
- blacktriangleright: "\u25B8",
- blank: "\u2423",
- blk12: "\u2592",
- blk14: "\u2591",
- blk34: "\u2593",
- block: "\u2588",
- bne: "=\u20E5",
- bnequiv: "\u2261\u20E5",
- bNot: "\u2AED",
- bnot: "\u2310",
- Bopf: "\u{1D539}",
- bopf: "\u{1D553}",
- bot: "\u22A5",
- bottom: "\u22A5",
- bowtie: "\u22C8",
- boxbox: "\u29C9",
- boxDL: "\u2557",
- boxDl: "\u2556",
- boxdL: "\u2555",
- boxdl: "\u2510",
- boxDR: "\u2554",
- boxDr: "\u2553",
- boxdR: "\u2552",
- boxdr: "\u250C",
- boxH: "\u2550",
- boxh: "\u2500",
- boxHD: "\u2566",
- boxHd: "\u2564",
- boxhD: "\u2565",
- boxhd: "\u252C",
- boxHU: "\u2569",
- boxHu: "\u2567",
- boxhU: "\u2568",
- boxhu: "\u2534",
- boxminus: "\u229F",
- boxplus: "\u229E",
- boxtimes: "\u22A0",
- boxUL: "\u255D",
- boxUl: "\u255C",
- boxuL: "\u255B",
- boxul: "\u2518",
- boxUR: "\u255A",
- boxUr: "\u2559",
- boxuR: "\u2558",
- boxur: "\u2514",
- boxV: "\u2551",
- boxv: "\u2502",
- boxVH: "\u256C",
- boxVh: "\u256B",
- boxvH: "\u256A",
- boxvh: "\u253C",
- boxVL: "\u2563",
- boxVl: "\u2562",
- boxvL: "\u2561",
- boxvl: "\u2524",
- boxVR: "\u2560",
- boxVr: "\u255F",
- boxvR: "\u255E",
- boxvr: "\u251C",
- bprime: "\u2035",
- Breve: "\u02D8",
- breve: "\u02D8",
- brvbar: "\xA6",
- Bscr: "\u212C",
- bscr: "\u{1D4B7}",
- bsemi: "\u204F",
- bsim: "\u223D",
- bsime: "\u22CD",
- bsol: "\\",
- bsolb: "\u29C5",
- bsolhsub: "\u27C8",
- bull: "\u2022",
- bullet: "\u2022",
- bump: "\u224E",
- bumpE: "\u2AAE",
- bumpe: "\u224F",
- Bumpeq: "\u224E",
- bumpeq: "\u224F",
- Cacute: "\u0106",
- cacute: "\u0107",
- Cap: "\u22D2",
- cap: "\u2229",
- capand: "\u2A44",
- capbrcup: "\u2A49",
- capcap: "\u2A4B",
- capcup: "\u2A47",
- capdot: "\u2A40",
- CapitalDifferentialD: "\u2145",
- caps: "\u2229\uFE00",
- caret: "\u2041",
- caron: "\u02C7",
- Cayleys: "\u212D",
- ccaps: "\u2A4D",
- Ccaron: "\u010C",
- ccaron: "\u010D",
- Ccedil: "\xC7",
- ccedil: "\xE7",
- Ccirc: "\u0108",
- ccirc: "\u0109",
- Cconint: "\u2230",
- ccups: "\u2A4C",
- ccupssm: "\u2A50",
- Cdot: "\u010A",
- cdot: "\u010B",
- cedil: "\xB8",
- Cedilla: "\xB8",
- cemptyv: "\u29B2",
- cent: "\xA2",
- CenterDot: "\xB7",
- centerdot: "\xB7",
- Cfr: "\u212D",
- cfr: "\u{1D520}",
- CHcy: "\u0427",
- chcy: "\u0447",
- check: "\u2713",
- checkmark: "\u2713",
- Chi: "\u03A7",
- chi: "\u03C7",
- cir: "\u25CB",
- circ: "\u02C6",
- circeq: "\u2257",
- circlearrowleft: "\u21BA",
- circlearrowright: "\u21BB",
- circledast: "\u229B",
- circledcirc: "\u229A",
- circleddash: "\u229D",
- CircleDot: "\u2299",
- circledR: "\xAE",
- circledS: "\u24C8",
- CircleMinus: "\u2296",
- CirclePlus: "\u2295",
- CircleTimes: "\u2297",
- cirE: "\u29C3",
- cire: "\u2257",
- cirfnint: "\u2A10",
- cirmid: "\u2AEF",
- cirscir: "\u29C2",
- ClockwiseContourIntegral: "\u2232",
- CloseCurlyDoubleQuote: "\u201D",
- CloseCurlyQuote: "\u2019",
- clubs: "\u2663",
- clubsuit: "\u2663",
- Colon: "\u2237",
- colon: ":",
- Colone: "\u2A74",
- colone: "\u2254",
- coloneq: "\u2254",
- comma: ",",
- commat: "@",
- comp: "\u2201",
- compfn: "\u2218",
- complement: "\u2201",
- complexes: "\u2102",
- cong: "\u2245",
- congdot: "\u2A6D",
- Congruent: "\u2261",
- Conint: "\u222F",
- conint: "\u222E",
- ContourIntegral: "\u222E",
- Copf: "\u2102",
- copf: "\u{1D554}",
- coprod: "\u2210",
- Coproduct: "\u2210",
- COPY: "\xA9",
- copy: "\xA9",
- copysr: "\u2117",
- CounterClockwiseContourIntegral: "\u2233",
- crarr: "\u21B5",
- Cross: "\u2A2F",
- cross: "\u2717",
- Cscr: "\u{1D49E}",
- cscr: "\u{1D4B8}",
- csub: "\u2ACF",
- csube: "\u2AD1",
- csup: "\u2AD0",
- csupe: "\u2AD2",
- ctdot: "\u22EF",
- cudarrl: "\u2938",
- cudarrr: "\u2935",
- cuepr: "\u22DE",
- cuesc: "\u22DF",
- cularr: "\u21B6",
- cularrp: "\u293D",
- Cup: "\u22D3",
- cup: "\u222A",
- cupbrcap: "\u2A48",
- CupCap: "\u224D",
- cupcap: "\u2A46",
- cupcup: "\u2A4A",
- cupdot: "\u228D",
- cupor: "\u2A45",
- cups: "\u222A\uFE00",
- curarr: "\u21B7",
- curarrm: "\u293C",
- curlyeqprec: "\u22DE",
- curlyeqsucc: "\u22DF",
- curlyvee: "\u22CE",
- curlywedge: "\u22CF",
- curren: "\xA4",
- curvearrowleft: "\u21B6",
- curvearrowright: "\u21B7",
- cuvee: "\u22CE",
- cuwed: "\u22CF",
- cwconint: "\u2232",
- cwint: "\u2231",
- cylcty: "\u232D",
- Dagger: "\u2021",
- dagger: "\u2020",
- daleth: "\u2138",
- Darr: "\u21A1",
- dArr: "\u21D3",
- darr: "\u2193",
- dash: "\u2010",
- Dashv: "\u2AE4",
- dashv: "\u22A3",
- dbkarow: "\u290F",
- dblac: "\u02DD",
- Dcaron: "\u010E",
- dcaron: "\u010F",
- Dcy: "\u0414",
- dcy: "\u0434",
- DD: "\u2145",
- dd: "\u2146",
- ddagger: "\u2021",
- ddarr: "\u21CA",
- DDotrahd: "\u2911",
- ddotseq: "\u2A77",
- deg: "\xB0",
- Del: "\u2207",
- Delta: "\u0394",
- delta: "\u03B4",
- demptyv: "\u29B1",
- dfisht: "\u297F",
- Dfr: "\u{1D507}",
- dfr: "\u{1D521}",
- dHar: "\u2965",
- dharl: "\u21C3",
- dharr: "\u21C2",
- DiacriticalAcute: "\xB4",
- DiacriticalDot: "\u02D9",
- DiacriticalDoubleAcute: "\u02DD",
- DiacriticalGrave: "`",
- DiacriticalTilde: "\u02DC",
- diam: "\u22C4",
- Diamond: "\u22C4",
- diamond: "\u22C4",
- diamondsuit: "\u2666",
- diams: "\u2666",
- die: "\xA8",
- DifferentialD: "\u2146",
- digamma: "\u03DD",
- disin: "\u22F2",
- div: "\xF7",
- divide: "\xF7",
- divideontimes: "\u22C7",
- divonx: "\u22C7",
- DJcy: "\u0402",
- djcy: "\u0452",
- dlcorn: "\u231E",
- dlcrop: "\u230D",
- dollar: "$",
- Dopf: "\u{1D53B}",
- dopf: "\u{1D555}",
- Dot: "\xA8",
- dot: "\u02D9",
- DotDot: "\u20DC",
- doteq: "\u2250",
- doteqdot: "\u2251",
- DotEqual: "\u2250",
- dotminus: "\u2238",
- dotplus: "\u2214",
- dotsquare: "\u22A1",
- doublebarwedge: "\u2306",
- DoubleContourIntegral: "\u222F",
- DoubleDot: "\xA8",
- DoubleDownArrow: "\u21D3",
- DoubleLeftArrow: "\u21D0",
- DoubleLeftRightArrow: "\u21D4",
- DoubleLeftTee: "\u2AE4",
- DoubleLongLeftArrow: "\u27F8",
- DoubleLongLeftRightArrow: "\u27FA",
- DoubleLongRightArrow: "\u27F9",
- DoubleRightArrow: "\u21D2",
- DoubleRightTee: "\u22A8",
- DoubleUpArrow: "\u21D1",
- DoubleUpDownArrow: "\u21D5",
- DoubleVerticalBar: "\u2225",
- DownArrow: "\u2193",
- Downarrow: "\u21D3",
- downarrow: "\u2193",
- DownArrowBar: "\u2913",
- DownArrowUpArrow: "\u21F5",
- DownBreve: "\u0311",
- downdownarrows: "\u21CA",
- downharpoonleft: "\u21C3",
- downharpoonright: "\u21C2",
- DownLeftRightVector: "\u2950",
- DownLeftTeeVector: "\u295E",
- DownLeftVector: "\u21BD",
- DownLeftVectorBar: "\u2956",
- DownRightTeeVector: "\u295F",
- DownRightVector: "\u21C1",
- DownRightVectorBar: "\u2957",
- DownTee: "\u22A4",
- DownTeeArrow: "\u21A7",
- drbkarow: "\u2910",
- drcorn: "\u231F",
- drcrop: "\u230C",
- Dscr: "\u{1D49F}",
- dscr: "\u{1D4B9}",
- DScy: "\u0405",
- dscy: "\u0455",
- dsol: "\u29F6",
- Dstrok: "\u0110",
- dstrok: "\u0111",
- dtdot: "\u22F1",
- dtri: "\u25BF",
- dtrif: "\u25BE",
- duarr: "\u21F5",
- duhar: "\u296F",
- dwangle: "\u29A6",
- DZcy: "\u040F",
- dzcy: "\u045F",
- dzigrarr: "\u27FF",
- Eacute: "\xC9",
- eacute: "\xE9",
- easter: "\u2A6E",
- Ecaron: "\u011A",
- ecaron: "\u011B",
- ecir: "\u2256",
- Ecirc: "\xCA",
- ecirc: "\xEA",
- ecolon: "\u2255",
- Ecy: "\u042D",
- ecy: "\u044D",
- eDDot: "\u2A77",
- Edot: "\u0116",
- eDot: "\u2251",
- edot: "\u0117",
- ee: "\u2147",
- efDot: "\u2252",
- Efr: "\u{1D508}",
- efr: "\u{1D522}",
- eg: "\u2A9A",
- Egrave: "\xC8",
- egrave: "\xE8",
- egs: "\u2A96",
- egsdot: "\u2A98",
- el: "\u2A99",
- Element: "\u2208",
- elinters: "\u23E7",
- ell: "\u2113",
- els: "\u2A95",
- elsdot: "\u2A97",
- Emacr: "\u0112",
- emacr: "\u0113",
- empty: "\u2205",
- emptyset: "\u2205",
- EmptySmallSquare: "\u25FB",
- emptyv: "\u2205",
- EmptyVerySmallSquare: "\u25AB",
- emsp: "\u2003",
- emsp13: "\u2004",
- emsp14: "\u2005",
- ENG: "\u014A",
- eng: "\u014B",
- ensp: "\u2002",
- Eogon: "\u0118",
- eogon: "\u0119",
- Eopf: "\u{1D53C}",
- eopf: "\u{1D556}",
- epar: "\u22D5",
- eparsl: "\u29E3",
- eplus: "\u2A71",
- epsi: "\u03B5",
- Epsilon: "\u0395",
- epsilon: "\u03B5",
- epsiv: "\u03F5",
- eqcirc: "\u2256",
- eqcolon: "\u2255",
- eqsim: "\u2242",
- eqslantgtr: "\u2A96",
- eqslantless: "\u2A95",
- Equal: "\u2A75",
- equals: "=",
- EqualTilde: "\u2242",
- equest: "\u225F",
- Equilibrium: "\u21CC",
- equiv: "\u2261",
- equivDD: "\u2A78",
- eqvparsl: "\u29E5",
- erarr: "\u2971",
- erDot: "\u2253",
- Escr: "\u2130",
- escr: "\u212F",
- esdot: "\u2250",
- Esim: "\u2A73",
- esim: "\u2242",
- Eta: "\u0397",
- eta: "\u03B7",
- ETH: "\xD0",
- eth: "\xF0",
- Euml: "\xCB",
- euml: "\xEB",
- euro: "\u20AC",
- excl: "!",
- exist: "\u2203",
- Exists: "\u2203",
- expectation: "\u2130",
- ExponentialE: "\u2147",
- exponentiale: "\u2147",
- fallingdotseq: "\u2252",
- Fcy: "\u0424",
- fcy: "\u0444",
- female: "\u2640",
- ffilig: "\uFB03",
- fflig: "\uFB00",
- ffllig: "\uFB04",
- Ffr: "\u{1D509}",
- ffr: "\u{1D523}",
- filig: "\uFB01",
- FilledSmallSquare: "\u25FC",
- FilledVerySmallSquare: "\u25AA",
- fjlig: "fj",
- flat: "\u266D",
- fllig: "\uFB02",
- fltns: "\u25B1",
- fnof: "\u0192",
- Fopf: "\u{1D53D}",
- fopf: "\u{1D557}",
- ForAll: "\u2200",
- forall: "\u2200",
- fork: "\u22D4",
- forkv: "\u2AD9",
- Fouriertrf: "\u2131",
- fpartint: "\u2A0D",
- frac12: "\xBD",
- frac13: "\u2153",
- frac14: "\xBC",
- frac15: "\u2155",
- frac16: "\u2159",
- frac18: "\u215B",
- frac23: "\u2154",
- frac25: "\u2156",
- frac34: "\xBE",
- frac35: "\u2157",
- frac38: "\u215C",
- frac45: "\u2158",
- frac56: "\u215A",
- frac58: "\u215D",
- frac78: "\u215E",
- frasl: "\u2044",
- frown: "\u2322",
- Fscr: "\u2131",
- fscr: "\u{1D4BB}",
- gacute: "\u01F5",
- Gamma: "\u0393",
- gamma: "\u03B3",
- Gammad: "\u03DC",
- gammad: "\u03DD",
- gap: "\u2A86",
- Gbreve: "\u011E",
- gbreve: "\u011F",
- Gcedil: "\u0122",
- Gcirc: "\u011C",
- gcirc: "\u011D",
- Gcy: "\u0413",
- gcy: "\u0433",
- Gdot: "\u0120",
- gdot: "\u0121",
- gE: "\u2267",
- ge: "\u2265",
- gEl: "\u2A8C",
- gel: "\u22DB",
- geq: "\u2265",
- geqq: "\u2267",
- geqslant: "\u2A7E",
- ges: "\u2A7E",
- gescc: "\u2AA9",
- gesdot: "\u2A80",
- gesdoto: "\u2A82",
- gesdotol: "\u2A84",
- gesl: "\u22DB\uFE00",
- gesles: "\u2A94",
- Gfr: "\u{1D50A}",
- gfr: "\u{1D524}",
- Gg: "\u22D9",
- gg: "\u226B",
- ggg: "\u22D9",
- gimel: "\u2137",
- GJcy: "\u0403",
- gjcy: "\u0453",
- gl: "\u2277",
- gla: "\u2AA5",
- glE: "\u2A92",
- glj: "\u2AA4",
- gnap: "\u2A8A",
- gnapprox: "\u2A8A",
- gnE: "\u2269",
- gne: "\u2A88",
- gneq: "\u2A88",
- gneqq: "\u2269",
- gnsim: "\u22E7",
- Gopf: "\u{1D53E}",
- gopf: "\u{1D558}",
- grave: "`",
- GreaterEqual: "\u2265",
- GreaterEqualLess: "\u22DB",
- GreaterFullEqual: "\u2267",
- GreaterGreater: "\u2AA2",
- GreaterLess: "\u2277",
- GreaterSlantEqual: "\u2A7E",
- GreaterTilde: "\u2273",
- Gscr: "\u{1D4A2}",
- gscr: "\u210A",
- gsim: "\u2273",
- gsime: "\u2A8E",
- gsiml: "\u2A90",
- Gt: "\u226B",
- GT: ">",
- gt: ">",
- gtcc: "\u2AA7",
- gtcir: "\u2A7A",
- gtdot: "\u22D7",
- gtlPar: "\u2995",
- gtquest: "\u2A7C",
- gtrapprox: "\u2A86",
- gtrarr: "\u2978",
- gtrdot: "\u22D7",
- gtreqless: "\u22DB",
- gtreqqless: "\u2A8C",
- gtrless: "\u2277",
- gtrsim: "\u2273",
- gvertneqq: "\u2269\uFE00",
- gvnE: "\u2269\uFE00",
- Hacek: "\u02C7",
- hairsp: "\u200A",
- half: "\xBD",
- hamilt: "\u210B",
- HARDcy: "\u042A",
- hardcy: "\u044A",
- hArr: "\u21D4",
- harr: "\u2194",
- harrcir: "\u2948",
- harrw: "\u21AD",
- Hat: "^",
- hbar: "\u210F",
- Hcirc: "\u0124",
- hcirc: "\u0125",
- hearts: "\u2665",
- heartsuit: "\u2665",
- hellip: "\u2026",
- hercon: "\u22B9",
- Hfr: "\u210C",
- hfr: "\u{1D525}",
- HilbertSpace: "\u210B",
- hksearow: "\u2925",
- hkswarow: "\u2926",
- hoarr: "\u21FF",
- homtht: "\u223B",
- hookleftarrow: "\u21A9",
- hookrightarrow: "\u21AA",
- Hopf: "\u210D",
- hopf: "\u{1D559}",
- horbar: "\u2015",
- HorizontalLine: "\u2500",
- Hscr: "\u210B",
- hscr: "\u{1D4BD}",
- hslash: "\u210F",
- Hstrok: "\u0126",
- hstrok: "\u0127",
- HumpDownHump: "\u224E",
- HumpEqual: "\u224F",
- hybull: "\u2043",
- hyphen: "\u2010",
- Iacute: "\xCD",
- iacute: "\xED",
- ic: "\u2063",
- Icirc: "\xCE",
- icirc: "\xEE",
- Icy: "\u0418",
- icy: "\u0438",
- Idot: "\u0130",
- IEcy: "\u0415",
- iecy: "\u0435",
- iexcl: "\xA1",
- iff: "\u21D4",
- Ifr: "\u2111",
- ifr: "\u{1D526}",
- Igrave: "\xCC",
- igrave: "\xEC",
- ii: "\u2148",
- iiiint: "\u2A0C",
- iiint: "\u222D",
- iinfin: "\u29DC",
- iiota: "\u2129",
- IJlig: "\u0132",
- ijlig: "\u0133",
- Im: "\u2111",
- Imacr: "\u012A",
- imacr: "\u012B",
- image: "\u2111",
- ImaginaryI: "\u2148",
- imagline: "\u2110",
- imagpart: "\u2111",
- imath: "\u0131",
- imof: "\u22B7",
- imped: "\u01B5",
- Implies: "\u21D2",
- in: "\u2208",
- incare: "\u2105",
- infin: "\u221E",
- infintie: "\u29DD",
- inodot: "\u0131",
- Int: "\u222C",
- int: "\u222B",
- intcal: "\u22BA",
- integers: "\u2124",
- Integral: "\u222B",
- intercal: "\u22BA",
- Intersection: "\u22C2",
- intlarhk: "\u2A17",
- intprod: "\u2A3C",
- InvisibleComma: "\u2063",
- InvisibleTimes: "\u2062",
- IOcy: "\u0401",
- iocy: "\u0451",
- Iogon: "\u012E",
- iogon: "\u012F",
- Iopf: "\u{1D540}",
- iopf: "\u{1D55A}",
- Iota: "\u0399",
- iota: "\u03B9",
- iprod: "\u2A3C",
- iquest: "\xBF",
- Iscr: "\u2110",
- iscr: "\u{1D4BE}",
- isin: "\u2208",
- isindot: "\u22F5",
- isinE: "\u22F9",
- isins: "\u22F4",
- isinsv: "\u22F3",
- isinv: "\u2208",
- it: "\u2062",
- Itilde: "\u0128",
- itilde: "\u0129",
- Iukcy: "\u0406",
- iukcy: "\u0456",
- Iuml: "\xCF",
- iuml: "\xEF",
- Jcirc: "\u0134",
- jcirc: "\u0135",
- Jcy: "\u0419",
- jcy: "\u0439",
- Jfr: "\u{1D50D}",
- jfr: "\u{1D527}",
- jmath: "\u0237",
- Jopf: "\u{1D541}",
- jopf: "\u{1D55B}",
- Jscr: "\u{1D4A5}",
- jscr: "\u{1D4BF}",
- Jsercy: "\u0408",
- jsercy: "\u0458",
- Jukcy: "\u0404",
- jukcy: "\u0454",
- Kappa: "\u039A",
- kappa: "\u03BA",
- kappav: "\u03F0",
- Kcedil: "\u0136",
- kcedil: "\u0137",
- Kcy: "\u041A",
- kcy: "\u043A",
- Kfr: "\u{1D50E}",
- kfr: "\u{1D528}",
- kgreen: "\u0138",
- KHcy: "\u0425",
- khcy: "\u0445",
- KJcy: "\u040C",
- kjcy: "\u045C",
- Kopf: "\u{1D542}",
- kopf: "\u{1D55C}",
- Kscr: "\u{1D4A6}",
- kscr: "\u{1D4C0}",
- lAarr: "\u21DA",
- Lacute: "\u0139",
- lacute: "\u013A",
- laemptyv: "\u29B4",
- lagran: "\u2112",
- Lambda: "\u039B",
- lambda: "\u03BB",
- Lang: "\u27EA",
- lang: "\u27E8",
- langd: "\u2991",
- langle: "\u27E8",
- lap: "\u2A85",
- Laplacetrf: "\u2112",
- laquo: "\xAB",
- Larr: "\u219E",
- lArr: "\u21D0",
- larr: "\u2190",
- larrb: "\u21E4",
- larrbfs: "\u291F",
- larrfs: "\u291D",
- larrhk: "\u21A9",
- larrlp: "\u21AB",
- larrpl: "\u2939",
- larrsim: "\u2973",
- larrtl: "\u21A2",
- lat: "\u2AAB",
- lAtail: "\u291B",
- latail: "\u2919",
- late: "\u2AAD",
- lates: "\u2AAD\uFE00",
- lBarr: "\u290E",
- lbarr: "\u290C",
- lbbrk: "\u2772",
- lbrace: "{",
- lbrack: "[",
- lbrke: "\u298B",
- lbrksld: "\u298F",
- lbrkslu: "\u298D",
- Lcaron: "\u013D",
- lcaron: "\u013E",
- Lcedil: "\u013B",
- lcedil: "\u013C",
- lceil: "\u2308",
- lcub: "{",
- Lcy: "\u041B",
- lcy: "\u043B",
- ldca: "\u2936",
- ldquo: "\u201C",
- ldquor: "\u201E",
- ldrdhar: "\u2967",
- ldrushar: "\u294B",
- ldsh: "\u21B2",
- lE: "\u2266",
- le: "\u2264",
- LeftAngleBracket: "\u27E8",
- LeftArrow: "\u2190",
- Leftarrow: "\u21D0",
- leftarrow: "\u2190",
- LeftArrowBar: "\u21E4",
- LeftArrowRightArrow: "\u21C6",
- leftarrowtail: "\u21A2",
- LeftCeiling: "\u2308",
- LeftDoubleBracket: "\u27E6",
- LeftDownTeeVector: "\u2961",
- LeftDownVector: "\u21C3",
- LeftDownVectorBar: "\u2959",
- LeftFloor: "\u230A",
- leftharpoondown: "\u21BD",
- leftharpoonup: "\u21BC",
- leftleftarrows: "\u21C7",
- LeftRightArrow: "\u2194",
- Leftrightarrow: "\u21D4",
- leftrightarrow: "\u2194",
- leftrightarrows: "\u21C6",
- leftrightharpoons: "\u21CB",
- leftrightsquigarrow: "\u21AD",
- LeftRightVector: "\u294E",
- LeftTee: "\u22A3",
- LeftTeeArrow: "\u21A4",
- LeftTeeVector: "\u295A",
- leftthreetimes: "\u22CB",
- LeftTriangle: "\u22B2",
- LeftTriangleBar: "\u29CF",
- LeftTriangleEqual: "\u22B4",
- LeftUpDownVector: "\u2951",
- LeftUpTeeVector: "\u2960",
- LeftUpVector: "\u21BF",
- LeftUpVectorBar: "\u2958",
- LeftVector: "\u21BC",
- LeftVectorBar: "\u2952",
- lEg: "\u2A8B",
- leg: "\u22DA",
- leq: "\u2264",
- leqq: "\u2266",
- leqslant: "\u2A7D",
- les: "\u2A7D",
- lescc: "\u2AA8",
- lesdot: "\u2A7F",
- lesdoto: "\u2A81",
- lesdotor: "\u2A83",
- lesg: "\u22DA\uFE00",
- lesges: "\u2A93",
- lessapprox: "\u2A85",
- lessdot: "\u22D6",
- lesseqgtr: "\u22DA",
- lesseqqgtr: "\u2A8B",
- LessEqualGreater: "\u22DA",
- LessFullEqual: "\u2266",
- LessGreater: "\u2276",
- lessgtr: "\u2276",
- LessLess: "\u2AA1",
- lesssim: "\u2272",
- LessSlantEqual: "\u2A7D",
- LessTilde: "\u2272",
- lfisht: "\u297C",
- lfloor: "\u230A",
- Lfr: "\u{1D50F}",
- lfr: "\u{1D529}",
- lg: "\u2276",
- lgE: "\u2A91",
- lHar: "\u2962",
- lhard: "\u21BD",
- lharu: "\u21BC",
- lharul: "\u296A",
- lhblk: "\u2584",
- LJcy: "\u0409",
- ljcy: "\u0459",
- Ll: "\u22D8",
- ll: "\u226A",
- llarr: "\u21C7",
- llcorner: "\u231E",
- Lleftarrow: "\u21DA",
- llhard: "\u296B",
- lltri: "\u25FA",
- Lmidot: "\u013F",
- lmidot: "\u0140",
- lmoust: "\u23B0",
- lmoustache: "\u23B0",
- lnap: "\u2A89",
- lnapprox: "\u2A89",
- lnE: "\u2268",
- lne: "\u2A87",
- lneq: "\u2A87",
- lneqq: "\u2268",
- lnsim: "\u22E6",
- loang: "\u27EC",
- loarr: "\u21FD",
- lobrk: "\u27E6",
- LongLeftArrow: "\u27F5",
- Longleftarrow: "\u27F8",
- longleftarrow: "\u27F5",
- LongLeftRightArrow: "\u27F7",
- Longleftrightarrow: "\u27FA",
- longleftrightarrow: "\u27F7",
- longmapsto: "\u27FC",
- LongRightArrow: "\u27F6",
- Longrightarrow: "\u27F9",
- longrightarrow: "\u27F6",
- looparrowleft: "\u21AB",
- looparrowright: "\u21AC",
- lopar: "\u2985",
- Lopf: "\u{1D543}",
- lopf: "\u{1D55D}",
- loplus: "\u2A2D",
- lotimes: "\u2A34",
- lowast: "\u2217",
- lowbar: "_",
- LowerLeftArrow: "\u2199",
- LowerRightArrow: "\u2198",
- loz: "\u25CA",
- lozenge: "\u25CA",
- lozf: "\u29EB",
- lpar: "(",
- lparlt: "\u2993",
- lrarr: "\u21C6",
- lrcorner: "\u231F",
- lrhar: "\u21CB",
- lrhard: "\u296D",
- lrm: "\u200E",
- lrtri: "\u22BF",
- lsaquo: "\u2039",
- Lscr: "\u2112",
- lscr: "\u{1D4C1}",
- Lsh: "\u21B0",
- lsh: "\u21B0",
- lsim: "\u2272",
- lsime: "\u2A8D",
- lsimg: "\u2A8F",
- lsqb: "[",
- lsquo: "\u2018",
- lsquor: "\u201A",
- Lstrok: "\u0141",
- lstrok: "\u0142",
- Lt: "\u226A",
- LT: "<",
- lt: "<",
- ltcc: "\u2AA6",
- ltcir: "\u2A79",
- ltdot: "\u22D6",
- lthree: "\u22CB",
- ltimes: "\u22C9",
- ltlarr: "\u2976",
- ltquest: "\u2A7B",
- ltri: "\u25C3",
- ltrie: "\u22B4",
- ltrif: "\u25C2",
- ltrPar: "\u2996",
- lurdshar: "\u294A",
- luruhar: "\u2966",
- lvertneqq: "\u2268\uFE00",
- lvnE: "\u2268\uFE00",
- macr: "\xAF",
- male: "\u2642",
- malt: "\u2720",
- maltese: "\u2720",
- Map: "\u2905",
- map: "\u21A6",
- mapsto: "\u21A6",
- mapstodown: "\u21A7",
- mapstoleft: "\u21A4",
- mapstoup: "\u21A5",
- marker: "\u25AE",
- mcomma: "\u2A29",
- Mcy: "\u041C",
- mcy: "\u043C",
- mdash: "\u2014",
- mDDot: "\u223A",
- measuredangle: "\u2221",
- MediumSpace: "\u205F",
- Mellintrf: "\u2133",
- Mfr: "\u{1D510}",
- mfr: "\u{1D52A}",
- mho: "\u2127",
- micro: "\xB5",
- mid: "\u2223",
- midast: "*",
- midcir: "\u2AF0",
- middot: "\xB7",
- minus: "\u2212",
- minusb: "\u229F",
- minusd: "\u2238",
- minusdu: "\u2A2A",
- MinusPlus: "\u2213",
- mlcp: "\u2ADB",
- mldr: "\u2026",
- mnplus: "\u2213",
- models: "\u22A7",
- Mopf: "\u{1D544}",
- mopf: "\u{1D55E}",
- mp: "\u2213",
- Mscr: "\u2133",
- mscr: "\u{1D4C2}",
- mstpos: "\u223E",
- Mu: "\u039C",
- mu: "\u03BC",
- multimap: "\u22B8",
- mumap: "\u22B8",
- nabla: "\u2207",
- Nacute: "\u0143",
- nacute: "\u0144",
- nang: "\u2220\u20D2",
- nap: "\u2249",
- napE: "\u2A70\u0338",
- napid: "\u224B\u0338",
- napos: "\u0149",
- napprox: "\u2249",
- natur: "\u266E",
- natural: "\u266E",
- naturals: "\u2115",
- nbsp: "\xA0",
- nbump: "\u224E\u0338",
- nbumpe: "\u224F\u0338",
- ncap: "\u2A43",
- Ncaron: "\u0147",
- ncaron: "\u0148",
- Ncedil: "\u0145",
- ncedil: "\u0146",
- ncong: "\u2247",
- ncongdot: "\u2A6D\u0338",
- ncup: "\u2A42",
- Ncy: "\u041D",
- ncy: "\u043D",
- ndash: "\u2013",
- ne: "\u2260",
- nearhk: "\u2924",
- neArr: "\u21D7",
- nearr: "\u2197",
- nearrow: "\u2197",
- nedot: "\u2250\u0338",
- NegativeMediumSpace: "\u200B",
- NegativeThickSpace: "\u200B",
- NegativeThinSpace: "\u200B",
- NegativeVeryThinSpace: "\u200B",
- nequiv: "\u2262",
- nesear: "\u2928",
- nesim: "\u2242\u0338",
- NestedGreaterGreater: "\u226B",
- NestedLessLess: "\u226A",
- NewLine: "\n",
- nexist: "\u2204",
- nexists: "\u2204",
- Nfr: "\u{1D511}",
- nfr: "\u{1D52B}",
- ngE: "\u2267\u0338",
- nge: "\u2271",
- ngeq: "\u2271",
- ngeqq: "\u2267\u0338",
- ngeqslant: "\u2A7E\u0338",
- nges: "\u2A7E\u0338",
- nGg: "\u22D9\u0338",
- ngsim: "\u2275",
- nGt: "\u226B\u20D2",
- ngt: "\u226F",
- ngtr: "\u226F",
- nGtv: "\u226B\u0338",
- nhArr: "\u21CE",
- nharr: "\u21AE",
- nhpar: "\u2AF2",
- ni: "\u220B",
- nis: "\u22FC",
- nisd: "\u22FA",
- niv: "\u220B",
- NJcy: "\u040A",
- njcy: "\u045A",
- nlArr: "\u21CD",
- nlarr: "\u219A",
- nldr: "\u2025",
- nlE: "\u2266\u0338",
- nle: "\u2270",
- nLeftarrow: "\u21CD",
- nleftarrow: "\u219A",
- nLeftrightarrow: "\u21CE",
- nleftrightarrow: "\u21AE",
- nleq: "\u2270",
- nleqq: "\u2266\u0338",
- nleqslant: "\u2A7D\u0338",
- nles: "\u2A7D\u0338",
- nless: "\u226E",
- nLl: "\u22D8\u0338",
- nlsim: "\u2274",
- nLt: "\u226A\u20D2",
- nlt: "\u226E",
- nltri: "\u22EA",
- nltrie: "\u22EC",
- nLtv: "\u226A\u0338",
- nmid: "\u2224",
- NoBreak: "\u2060",
- NonBreakingSpace: "\xA0",
- Nopf: "\u2115",
- nopf: "\u{1D55F}",
- Not: "\u2AEC",
- not: "\xAC",
- NotCongruent: "\u2262",
- NotCupCap: "\u226D",
- NotDoubleVerticalBar: "\u2226",
- NotElement: "\u2209",
- NotEqual: "\u2260",
- NotEqualTilde: "\u2242\u0338",
- NotExists: "\u2204",
- NotGreater: "\u226F",
- NotGreaterEqual: "\u2271",
- NotGreaterFullEqual: "\u2267\u0338",
- NotGreaterGreater: "\u226B\u0338",
- NotGreaterLess: "\u2279",
- NotGreaterSlantEqual: "\u2A7E\u0338",
- NotGreaterTilde: "\u2275",
- NotHumpDownHump: "\u224E\u0338",
- NotHumpEqual: "\u224F\u0338",
- notin: "\u2209",
- notindot: "\u22F5\u0338",
- notinE: "\u22F9\u0338",
- notinva: "\u2209",
- notinvb: "\u22F7",
- notinvc: "\u22F6",
- NotLeftTriangle: "\u22EA",
- NotLeftTriangleBar: "\u29CF\u0338",
- NotLeftTriangleEqual: "\u22EC",
- NotLess: "\u226E",
- NotLessEqual: "\u2270",
- NotLessGreater: "\u2278",
- NotLessLess: "\u226A\u0338",
- NotLessSlantEqual: "\u2A7D\u0338",
- NotLessTilde: "\u2274",
- NotNestedGreaterGreater: "\u2AA2\u0338",
- NotNestedLessLess: "\u2AA1\u0338",
- notni: "\u220C",
- notniva: "\u220C",
- notnivb: "\u22FE",
- notnivc: "\u22FD",
- NotPrecedes: "\u2280",
- NotPrecedesEqual: "\u2AAF\u0338",
- NotPrecedesSlantEqual: "\u22E0",
- NotReverseElement: "\u220C",
- NotRightTriangle: "\u22EB",
- NotRightTriangleBar: "\u29D0\u0338",
- NotRightTriangleEqual: "\u22ED",
- NotSquareSubset: "\u228F\u0338",
- NotSquareSubsetEqual: "\u22E2",
- NotSquareSuperset: "\u2290\u0338",
- NotSquareSupersetEqual: "\u22E3",
- NotSubset: "\u2282\u20D2",
- NotSubsetEqual: "\u2288",
- NotSucceeds: "\u2281",
- NotSucceedsEqual: "\u2AB0\u0338",
- NotSucceedsSlantEqual: "\u22E1",
- NotSucceedsTilde: "\u227F\u0338",
- NotSuperset: "\u2283\u20D2",
- NotSupersetEqual: "\u2289",
- NotTilde: "\u2241",
- NotTildeEqual: "\u2244",
- NotTildeFullEqual: "\u2247",
- NotTildeTilde: "\u2249",
- NotVerticalBar: "\u2224",
- npar: "\u2226",
- nparallel: "\u2226",
- nparsl: "\u2AFD\u20E5",
- npart: "\u2202\u0338",
- npolint: "\u2A14",
- npr: "\u2280",
- nprcue: "\u22E0",
- npre: "\u2AAF\u0338",
- nprec: "\u2280",
- npreceq: "\u2AAF\u0338",
- nrArr: "\u21CF",
- nrarr: "\u219B",
- nrarrc: "\u2933\u0338",
- nrarrw: "\u219D\u0338",
- nRightarrow: "\u21CF",
- nrightarrow: "\u219B",
- nrtri: "\u22EB",
- nrtrie: "\u22ED",
- nsc: "\u2281",
- nsccue: "\u22E1",
- nsce: "\u2AB0\u0338",
- Nscr: "\u{1D4A9}",
- nscr: "\u{1D4C3}",
- nshortmid: "\u2224",
- nshortparallel: "\u2226",
- nsim: "\u2241",
- nsime: "\u2244",
- nsimeq: "\u2244",
- nsmid: "\u2224",
- nspar: "\u2226",
- nsqsube: "\u22E2",
- nsqsupe: "\u22E3",
- nsub: "\u2284",
- nsubE: "\u2AC5\u0338",
- nsube: "\u2288",
- nsubset: "\u2282\u20D2",
- nsubseteq: "\u2288",
- nsubseteqq: "\u2AC5\u0338",
- nsucc: "\u2281",
- nsucceq: "\u2AB0\u0338",
- nsup: "\u2285",
- nsupE: "\u2AC6\u0338",
- nsupe: "\u2289",
- nsupset: "\u2283\u20D2",
- nsupseteq: "\u2289",
- nsupseteqq: "\u2AC6\u0338",
- ntgl: "\u2279",
- Ntilde: "\xD1",
- ntilde: "\xF1",
- ntlg: "\u2278",
- ntriangleleft: "\u22EA",
- ntrianglelefteq: "\u22EC",
- ntriangleright: "\u22EB",
- ntrianglerighteq: "\u22ED",
- Nu: "\u039D",
- nu: "\u03BD",
- num: "#",
- numero: "\u2116",
- numsp: "\u2007",
- nvap: "\u224D\u20D2",
- nVDash: "\u22AF",
- nVdash: "\u22AE",
- nvDash: "\u22AD",
- nvdash: "\u22AC",
- nvge: "\u2265\u20D2",
- nvgt: ">\u20D2",
- nvHarr: "\u2904",
- nvinfin: "\u29DE",
- nvlArr: "\u2902",
- nvle: "\u2264\u20D2",
- nvlt: "<\u20D2",
- nvltrie: "\u22B4\u20D2",
- nvrArr: "\u2903",
- nvrtrie: "\u22B5\u20D2",
- nvsim: "\u223C\u20D2",
- nwarhk: "\u2923",
- nwArr: "\u21D6",
- nwarr: "\u2196",
- nwarrow: "\u2196",
- nwnear: "\u2927",
- Oacute: "\xD3",
- oacute: "\xF3",
- oast: "\u229B",
- ocir: "\u229A",
- Ocirc: "\xD4",
- ocirc: "\xF4",
- Ocy: "\u041E",
- ocy: "\u043E",
- odash: "\u229D",
- Odblac: "\u0150",
- odblac: "\u0151",
- odiv: "\u2A38",
- odot: "\u2299",
- odsold: "\u29BC",
- OElig: "\u0152",
- oelig: "\u0153",
- ofcir: "\u29BF",
- Ofr: "\u{1D512}",
- ofr: "\u{1D52C}",
- ogon: "\u02DB",
- Ograve: "\xD2",
- ograve: "\xF2",
- ogt: "\u29C1",
- ohbar: "\u29B5",
- ohm: "\u03A9",
- oint: "\u222E",
- olarr: "\u21BA",
- olcir: "\u29BE",
- olcross: "\u29BB",
- oline: "\u203E",
- olt: "\u29C0",
- Omacr: "\u014C",
- omacr: "\u014D",
- Omega: "\u03A9",
- omega: "\u03C9",
- Omicron: "\u039F",
- omicron: "\u03BF",
- omid: "\u29B6",
- ominus: "\u2296",
- Oopf: "\u{1D546}",
- oopf: "\u{1D560}",
- opar: "\u29B7",
- OpenCurlyDoubleQuote: "\u201C",
- OpenCurlyQuote: "\u2018",
- operp: "\u29B9",
- oplus: "\u2295",
- Or: "\u2A54",
- or: "\u2228",
- orarr: "\u21BB",
- ord: "\u2A5D",
- order: "\u2134",
- orderof: "\u2134",
- ordf: "\xAA",
- ordm: "\xBA",
- origof: "\u22B6",
- oror: "\u2A56",
- orslope: "\u2A57",
- orv: "\u2A5B",
- oS: "\u24C8",
- Oscr: "\u{1D4AA}",
- oscr: "\u2134",
- Oslash: "\xD8",
- oslash: "\xF8",
- osol: "\u2298",
- Otilde: "\xD5",
- otilde: "\xF5",
- Otimes: "\u2A37",
- otimes: "\u2297",
- otimesas: "\u2A36",
- Ouml: "\xD6",
- ouml: "\xF6",
- ovbar: "\u233D",
- OverBar: "\u203E",
- OverBrace: "\u23DE",
- OverBracket: "\u23B4",
- OverParenthesis: "\u23DC",
- par: "\u2225",
- para: "\xB6",
- parallel: "\u2225",
- parsim: "\u2AF3",
- parsl: "\u2AFD",
- part: "\u2202",
- PartialD: "\u2202",
- Pcy: "\u041F",
- pcy: "\u043F",
- percnt: "%",
- period: ".",
- permil: "\u2030",
- perp: "\u22A5",
- pertenk: "\u2031",
- Pfr: "\u{1D513}",
- pfr: "\u{1D52D}",
- Phi: "\u03A6",
- phi: "\u03C6",
- phiv: "\u03D5",
- phmmat: "\u2133",
- phone: "\u260E",
- Pi: "\u03A0",
- pi: "\u03C0",
- pitchfork: "\u22D4",
- piv: "\u03D6",
- planck: "\u210F",
- planckh: "\u210E",
- plankv: "\u210F",
- plus: "+",
- plusacir: "\u2A23",
- plusb: "\u229E",
- pluscir: "\u2A22",
- plusdo: "\u2214",
- plusdu: "\u2A25",
- pluse: "\u2A72",
- PlusMinus: "\xB1",
- plusmn: "\xB1",
- plussim: "\u2A26",
- plustwo: "\u2A27",
- pm: "\xB1",
- Poincareplane: "\u210C",
- pointint: "\u2A15",
- Popf: "\u2119",
- popf: "\u{1D561}",
- pound: "\xA3",
- Pr: "\u2ABB",
- pr: "\u227A",
- prap: "\u2AB7",
- prcue: "\u227C",
- prE: "\u2AB3",
- pre: "\u2AAF",
- prec: "\u227A",
- precapprox: "\u2AB7",
- preccurlyeq: "\u227C",
- Precedes: "\u227A",
- PrecedesEqual: "\u2AAF",
- PrecedesSlantEqual: "\u227C",
- PrecedesTilde: "\u227E",
- preceq: "\u2AAF",
- precnapprox: "\u2AB9",
- precneqq: "\u2AB5",
- precnsim: "\u22E8",
- precsim: "\u227E",
- Prime: "\u2033",
- prime: "\u2032",
- primes: "\u2119",
- prnap: "\u2AB9",
- prnE: "\u2AB5",
- prnsim: "\u22E8",
- prod: "\u220F",
- Product: "\u220F",
- profalar: "\u232E",
- profline: "\u2312",
- profsurf: "\u2313",
- prop: "\u221D",
- Proportion: "\u2237",
- Proportional: "\u221D",
- propto: "\u221D",
- prsim: "\u227E",
- prurel: "\u22B0",
- Pscr: "\u{1D4AB}",
- pscr: "\u{1D4C5}",
- Psi: "\u03A8",
- psi: "\u03C8",
- puncsp: "\u2008",
- Qfr: "\u{1D514}",
- qfr: "\u{1D52E}",
- qint: "\u2A0C",
- Qopf: "\u211A",
- qopf: "\u{1D562}",
- qprime: "\u2057",
- Qscr: "\u{1D4AC}",
- qscr: "\u{1D4C6}",
- quaternions: "\u210D",
- quatint: "\u2A16",
- quest: "?",
- questeq: "\u225F",
- QUOT: '"',
- quot: '"',
- rAarr: "\u21DB",
- race: "\u223D\u0331",
- Racute: "\u0154",
- racute: "\u0155",
- radic: "\u221A",
- raemptyv: "\u29B3",
- Rang: "\u27EB",
- rang: "\u27E9",
- rangd: "\u2992",
- range: "\u29A5",
- rangle: "\u27E9",
- raquo: "\xBB",
- Rarr: "\u21A0",
- rArr: "\u21D2",
- rarr: "\u2192",
- rarrap: "\u2975",
- rarrb: "\u21E5",
- rarrbfs: "\u2920",
- rarrc: "\u2933",
- rarrfs: "\u291E",
- rarrhk: "\u21AA",
- rarrlp: "\u21AC",
- rarrpl: "\u2945",
- rarrsim: "\u2974",
- Rarrtl: "\u2916",
- rarrtl: "\u21A3",
- rarrw: "\u219D",
- rAtail: "\u291C",
- ratail: "\u291A",
- ratio: "\u2236",
- rationals: "\u211A",
- RBarr: "\u2910",
- rBarr: "\u290F",
- rbarr: "\u290D",
- rbbrk: "\u2773",
- rbrace: "}",
- rbrack: "]",
- rbrke: "\u298C",
- rbrksld: "\u298E",
- rbrkslu: "\u2990",
- Rcaron: "\u0158",
- rcaron: "\u0159",
- Rcedil: "\u0156",
- rcedil: "\u0157",
- rceil: "\u2309",
- rcub: "}",
- Rcy: "\u0420",
- rcy: "\u0440",
- rdca: "\u2937",
- rdldhar: "\u2969",
- rdquo: "\u201D",
- rdquor: "\u201D",
- rdsh: "\u21B3",
- Re: "\u211C",
- real: "\u211C",
- realine: "\u211B",
- realpart: "\u211C",
- reals: "\u211D",
- rect: "\u25AD",
- REG: "\xAE",
- reg: "\xAE",
- ReverseElement: "\u220B",
- ReverseEquilibrium: "\u21CB",
- ReverseUpEquilibrium: "\u296F",
- rfisht: "\u297D",
- rfloor: "\u230B",
- Rfr: "\u211C",
- rfr: "\u{1D52F}",
- rHar: "\u2964",
- rhard: "\u21C1",
- rharu: "\u21C0",
- rharul: "\u296C",
- Rho: "\u03A1",
- rho: "\u03C1",
- rhov: "\u03F1",
- RightAngleBracket: "\u27E9",
- RightArrow: "\u2192",
- Rightarrow: "\u21D2",
- rightarrow: "\u2192",
- RightArrowBar: "\u21E5",
- RightArrowLeftArrow: "\u21C4",
- rightarrowtail: "\u21A3",
- RightCeiling: "\u2309",
- RightDoubleBracket: "\u27E7",
- RightDownTeeVector: "\u295D",
- RightDownVector: "\u21C2",
- RightDownVectorBar: "\u2955",
- RightFloor: "\u230B",
- rightharpoondown: "\u21C1",
- rightharpoonup: "\u21C0",
- rightleftarrows: "\u21C4",
- rightleftharpoons: "\u21CC",
- rightrightarrows: "\u21C9",
- rightsquigarrow: "\u219D",
- RightTee: "\u22A2",
- RightTeeArrow: "\u21A6",
- RightTeeVector: "\u295B",
- rightthreetimes: "\u22CC",
- RightTriangle: "\u22B3",
- RightTriangleBar: "\u29D0",
- RightTriangleEqual: "\u22B5",
- RightUpDownVector: "\u294F",
- RightUpTeeVector: "\u295C",
- RightUpVector: "\u21BE",
- RightUpVectorBar: "\u2954",
- RightVector: "\u21C0",
- RightVectorBar: "\u2953",
- ring: "\u02DA",
- risingdotseq: "\u2253",
- rlarr: "\u21C4",
- rlhar: "\u21CC",
- rlm: "\u200F",
- rmoust: "\u23B1",
- rmoustache: "\u23B1",
- rnmid: "\u2AEE",
- roang: "\u27ED",
- roarr: "\u21FE",
- robrk: "\u27E7",
- ropar: "\u2986",
- Ropf: "\u211D",
- ropf: "\u{1D563}",
- roplus: "\u2A2E",
- rotimes: "\u2A35",
- RoundImplies: "\u2970",
- rpar: ")",
- rpargt: "\u2994",
- rppolint: "\u2A12",
- rrarr: "\u21C9",
- Rrightarrow: "\u21DB",
- rsaquo: "\u203A",
- Rscr: "\u211B",
- rscr: "\u{1D4C7}",
- Rsh: "\u21B1",
- rsh: "\u21B1",
- rsqb: "]",
- rsquo: "\u2019",
- rsquor: "\u2019",
- rthree: "\u22CC",
- rtimes: "\u22CA",
- rtri: "\u25B9",
- rtrie: "\u22B5",
- rtrif: "\u25B8",
- rtriltri: "\u29CE",
- RuleDelayed: "\u29F4",
- ruluhar: "\u2968",
- rx: "\u211E",
- Sacute: "\u015A",
- sacute: "\u015B",
- sbquo: "\u201A",
- Sc: "\u2ABC",
- sc: "\u227B",
- scap: "\u2AB8",
- Scaron: "\u0160",
- scaron: "\u0161",
- sccue: "\u227D",
- scE: "\u2AB4",
- sce: "\u2AB0",
- Scedil: "\u015E",
- scedil: "\u015F",
- Scirc: "\u015C",
- scirc: "\u015D",
- scnap: "\u2ABA",
- scnE: "\u2AB6",
- scnsim: "\u22E9",
- scpolint: "\u2A13",
- scsim: "\u227F",
- Scy: "\u0421",
- scy: "\u0441",
- sdot: "\u22C5",
- sdotb: "\u22A1",
- sdote: "\u2A66",
- searhk: "\u2925",
- seArr: "\u21D8",
- searr: "\u2198",
- searrow: "\u2198",
- sect: "\xA7",
- semi: ";",
- seswar: "\u2929",
- setminus: "\u2216",
- setmn: "\u2216",
- sext: "\u2736",
- Sfr: "\u{1D516}",
- sfr: "\u{1D530}",
- sfrown: "\u2322",
- sharp: "\u266F",
- SHCHcy: "\u0429",
- shchcy: "\u0449",
- SHcy: "\u0428",
- shcy: "\u0448",
- ShortDownArrow: "\u2193",
- ShortLeftArrow: "\u2190",
- shortmid: "\u2223",
- shortparallel: "\u2225",
- ShortRightArrow: "\u2192",
- ShortUpArrow: "\u2191",
- shy: "\xAD",
- Sigma: "\u03A3",
- sigma: "\u03C3",
- sigmaf: "\u03C2",
- sigmav: "\u03C2",
- sim: "\u223C",
- simdot: "\u2A6A",
- sime: "\u2243",
- simeq: "\u2243",
- simg: "\u2A9E",
- simgE: "\u2AA0",
- siml: "\u2A9D",
- simlE: "\u2A9F",
- simne: "\u2246",
- simplus: "\u2A24",
- simrarr: "\u2972",
- slarr: "\u2190",
- SmallCircle: "\u2218",
- smallsetminus: "\u2216",
- smashp: "\u2A33",
- smeparsl: "\u29E4",
- smid: "\u2223",
- smile: "\u2323",
- smt: "\u2AAA",
- smte: "\u2AAC",
- smtes: "\u2AAC\uFE00",
- SOFTcy: "\u042C",
- softcy: "\u044C",
- sol: "/",
- solb: "\u29C4",
- solbar: "\u233F",
- Sopf: "\u{1D54A}",
- sopf: "\u{1D564}",
- spades: "\u2660",
- spadesuit: "\u2660",
- spar: "\u2225",
- sqcap: "\u2293",
- sqcaps: "\u2293\uFE00",
- sqcup: "\u2294",
- sqcups: "\u2294\uFE00",
- Sqrt: "\u221A",
- sqsub: "\u228F",
- sqsube: "\u2291",
- sqsubset: "\u228F",
- sqsubseteq: "\u2291",
- sqsup: "\u2290",
- sqsupe: "\u2292",
- sqsupset: "\u2290",
- sqsupseteq: "\u2292",
- squ: "\u25A1",
- Square: "\u25A1",
- square: "\u25A1",
- SquareIntersection: "\u2293",
- SquareSubset: "\u228F",
- SquareSubsetEqual: "\u2291",
- SquareSuperset: "\u2290",
- SquareSupersetEqual: "\u2292",
- SquareUnion: "\u2294",
- squarf: "\u25AA",
- squf: "\u25AA",
- srarr: "\u2192",
- Sscr: "\u{1D4AE}",
- sscr: "\u{1D4C8}",
- ssetmn: "\u2216",
- ssmile: "\u2323",
- sstarf: "\u22C6",
- Star: "\u22C6",
- star: "\u2606",
- starf: "\u2605",
- straightepsilon: "\u03F5",
- straightphi: "\u03D5",
- strns: "\xAF",
- Sub: "\u22D0",
- sub: "\u2282",
- subdot: "\u2ABD",
- subE: "\u2AC5",
- sube: "\u2286",
- subedot: "\u2AC3",
- submult: "\u2AC1",
- subnE: "\u2ACB",
- subne: "\u228A",
- subplus: "\u2ABF",
- subrarr: "\u2979",
- Subset: "\u22D0",
- subset: "\u2282",
- subseteq: "\u2286",
- subseteqq: "\u2AC5",
- SubsetEqual: "\u2286",
- subsetneq: "\u228A",
- subsetneqq: "\u2ACB",
- subsim: "\u2AC7",
- subsub: "\u2AD5",
- subsup: "\u2AD3",
- succ: "\u227B",
- succapprox: "\u2AB8",
- succcurlyeq: "\u227D",
- Succeeds: "\u227B",
- SucceedsEqual: "\u2AB0",
- SucceedsSlantEqual: "\u227D",
- SucceedsTilde: "\u227F",
- succeq: "\u2AB0",
- succnapprox: "\u2ABA",
- succneqq: "\u2AB6",
- succnsim: "\u22E9",
- succsim: "\u227F",
- SuchThat: "\u220B",
- Sum: "\u2211",
- sum: "\u2211",
- sung: "\u266A",
- Sup: "\u22D1",
- sup: "\u2283",
- sup1: "\xB9",
- sup2: "\xB2",
- sup3: "\xB3",
- supdot: "\u2ABE",
- supdsub: "\u2AD8",
- supE: "\u2AC6",
- supe: "\u2287",
- supedot: "\u2AC4",
- Superset: "\u2283",
- SupersetEqual: "\u2287",
- suphsol: "\u27C9",
- suphsub: "\u2AD7",
- suplarr: "\u297B",
- supmult: "\u2AC2",
- supnE: "\u2ACC",
- supne: "\u228B",
- supplus: "\u2AC0",
- Supset: "\u22D1",
- supset: "\u2283",
- supseteq: "\u2287",
- supseteqq: "\u2AC6",
- supsetneq: "\u228B",
- supsetneqq: "\u2ACC",
- supsim: "\u2AC8",
- supsub: "\u2AD4",
- supsup: "\u2AD6",
- swarhk: "\u2926",
- swArr: "\u21D9",
- swarr: "\u2199",
- swarrow: "\u2199",
- swnwar: "\u292A",
- szlig: "\xDF",
- Tab: " ",
- target: "\u2316",
- Tau: "\u03A4",
- tau: "\u03C4",
- tbrk: "\u23B4",
- Tcaron: "\u0164",
- tcaron: "\u0165",
- Tcedil: "\u0162",
- tcedil: "\u0163",
- Tcy: "\u0422",
- tcy: "\u0442",
- tdot: "\u20DB",
- telrec: "\u2315",
- Tfr: "\u{1D517}",
- tfr: "\u{1D531}",
- there4: "\u2234",
- Therefore: "\u2234",
- therefore: "\u2234",
- Theta: "\u0398",
- theta: "\u03B8",
- thetasym: "\u03D1",
- thetav: "\u03D1",
- thickapprox: "\u2248",
- thicksim: "\u223C",
- ThickSpace: "\u205F\u200A",
- thinsp: "\u2009",
- ThinSpace: "\u2009",
- thkap: "\u2248",
- thksim: "\u223C",
- THORN: "\xDE",
- thorn: "\xFE",
- Tilde: "\u223C",
- tilde: "\u02DC",
- TildeEqual: "\u2243",
- TildeFullEqual: "\u2245",
- TildeTilde: "\u2248",
- times: "\xD7",
- timesb: "\u22A0",
- timesbar: "\u2A31",
- timesd: "\u2A30",
- tint: "\u222D",
- toea: "\u2928",
- top: "\u22A4",
- topbot: "\u2336",
- topcir: "\u2AF1",
- Topf: "\u{1D54B}",
- topf: "\u{1D565}",
- topfork: "\u2ADA",
- tosa: "\u2929",
- tprime: "\u2034",
- TRADE: "\u2122",
- trade: "\u2122",
- triangle: "\u25B5",
- triangledown: "\u25BF",
- triangleleft: "\u25C3",
- trianglelefteq: "\u22B4",
- triangleq: "\u225C",
- triangleright: "\u25B9",
- trianglerighteq: "\u22B5",
- tridot: "\u25EC",
- trie: "\u225C",
- triminus: "\u2A3A",
- TripleDot: "\u20DB",
- triplus: "\u2A39",
- trisb: "\u29CD",
- tritime: "\u2A3B",
- trpezium: "\u23E2",
- Tscr: "\u{1D4AF}",
- tscr: "\u{1D4C9}",
- TScy: "\u0426",
- tscy: "\u0446",
- TSHcy: "\u040B",
- tshcy: "\u045B",
- Tstrok: "\u0166",
- tstrok: "\u0167",
- twixt: "\u226C",
- twoheadleftarrow: "\u219E",
- twoheadrightarrow: "\u21A0",
- Uacute: "\xDA",
- uacute: "\xFA",
- Uarr: "\u219F",
- uArr: "\u21D1",
- uarr: "\u2191",
- Uarrocir: "\u2949",
- Ubrcy: "\u040E",
- ubrcy: "\u045E",
- Ubreve: "\u016C",
- ubreve: "\u016D",
- Ucirc: "\xDB",
- ucirc: "\xFB",
- Ucy: "\u0423",
- ucy: "\u0443",
- udarr: "\u21C5",
- Udblac: "\u0170",
- udblac: "\u0171",
- udhar: "\u296E",
- ufisht: "\u297E",
- Ufr: "\u{1D518}",
- ufr: "\u{1D532}",
- Ugrave: "\xD9",
- ugrave: "\xF9",
- uHar: "\u2963",
- uharl: "\u21BF",
- uharr: "\u21BE",
- uhblk: "\u2580",
- ulcorn: "\u231C",
- ulcorner: "\u231C",
- ulcrop: "\u230F",
- ultri: "\u25F8",
- Umacr: "\u016A",
- umacr: "\u016B",
- uml: "\xA8",
- UnderBar: "_",
- UnderBrace: "\u23DF",
- UnderBracket: "\u23B5",
- UnderParenthesis: "\u23DD",
- Union: "\u22C3",
- UnionPlus: "\u228E",
- Uogon: "\u0172",
- uogon: "\u0173",
- Uopf: "\u{1D54C}",
- uopf: "\u{1D566}",
- UpArrow: "\u2191",
- Uparrow: "\u21D1",
- uparrow: "\u2191",
- UpArrowBar: "\u2912",
- UpArrowDownArrow: "\u21C5",
- UpDownArrow: "\u2195",
- Updownarrow: "\u21D5",
- updownarrow: "\u2195",
- UpEquilibrium: "\u296E",
- upharpoonleft: "\u21BF",
- upharpoonright: "\u21BE",
- uplus: "\u228E",
- UpperLeftArrow: "\u2196",
- UpperRightArrow: "\u2197",
- Upsi: "\u03D2",
- upsi: "\u03C5",
- upsih: "\u03D2",
- Upsilon: "\u03A5",
- upsilon: "\u03C5",
- UpTee: "\u22A5",
- UpTeeArrow: "\u21A5",
- upuparrows: "\u21C8",
- urcorn: "\u231D",
- urcorner: "\u231D",
- urcrop: "\u230E",
- Uring: "\u016E",
- uring: "\u016F",
- urtri: "\u25F9",
- Uscr: "\u{1D4B0}",
- uscr: "\u{1D4CA}",
- utdot: "\u22F0",
- Utilde: "\u0168",
- utilde: "\u0169",
- utri: "\u25B5",
- utrif: "\u25B4",
- uuarr: "\u21C8",
- Uuml: "\xDC",
- uuml: "\xFC",
- uwangle: "\u29A7",
- vangrt: "\u299C",
- varepsilon: "\u03F5",
- varkappa: "\u03F0",
- varnothing: "\u2205",
- varphi: "\u03D5",
- varpi: "\u03D6",
- varpropto: "\u221D",
- vArr: "\u21D5",
- varr: "\u2195",
- varrho: "\u03F1",
- varsigma: "\u03C2",
- varsubsetneq: "\u228A\uFE00",
- varsubsetneqq: "\u2ACB\uFE00",
- varsupsetneq: "\u228B\uFE00",
- varsupsetneqq: "\u2ACC\uFE00",
- vartheta: "\u03D1",
- vartriangleleft: "\u22B2",
- vartriangleright: "\u22B3",
- Vbar: "\u2AEB",
- vBar: "\u2AE8",
- vBarv: "\u2AE9",
- Vcy: "\u0412",
- vcy: "\u0432",
- VDash: "\u22AB",
- Vdash: "\u22A9",
- vDash: "\u22A8",
- vdash: "\u22A2",
- Vdashl: "\u2AE6",
- Vee: "\u22C1",
- vee: "\u2228",
- veebar: "\u22BB",
- veeeq: "\u225A",
- vellip: "\u22EE",
- Verbar: "\u2016",
- verbar: "|",
- Vert: "\u2016",
- vert: "|",
- VerticalBar: "\u2223",
- VerticalLine: "|",
- VerticalSeparator: "\u2758",
- VerticalTilde: "\u2240",
- VeryThinSpace: "\u200A",
- Vfr: "\u{1D519}",
- vfr: "\u{1D533}",
- vltri: "\u22B2",
- vnsub: "\u2282\u20D2",
- vnsup: "\u2283\u20D2",
- Vopf: "\u{1D54D}",
- vopf: "\u{1D567}",
- vprop: "\u221D",
- vrtri: "\u22B3",
- Vscr: "\u{1D4B1}",
- vscr: "\u{1D4CB}",
- vsubnE: "\u2ACB\uFE00",
- vsubne: "\u228A\uFE00",
- vsupnE: "\u2ACC\uFE00",
- vsupne: "\u228B\uFE00",
- Vvdash: "\u22AA",
- vzigzag: "\u299A",
- Wcirc: "\u0174",
- wcirc: "\u0175",
- wedbar: "\u2A5F",
- Wedge: "\u22C0",
- wedge: "\u2227",
- wedgeq: "\u2259",
- weierp: "\u2118",
- Wfr: "\u{1D51A}",
- wfr: "\u{1D534}",
- Wopf: "\u{1D54E}",
- wopf: "\u{1D568}",
- wp: "\u2118",
- wr: "\u2240",
- wreath: "\u2240",
- Wscr: "\u{1D4B2}",
- wscr: "\u{1D4CC}",
- xcap: "\u22C2",
- xcirc: "\u25EF",
- xcup: "\u22C3",
- xdtri: "\u25BD",
- Xfr: "\u{1D51B}",
- xfr: "\u{1D535}",
- xhArr: "\u27FA",
- xharr: "\u27F7",
- Xi: "\u039E",
- xi: "\u03BE",
- xlArr: "\u27F8",
- xlarr: "\u27F5",
- xmap: "\u27FC",
- xnis: "\u22FB",
- xodot: "\u2A00",
- Xopf: "\u{1D54F}",
- xopf: "\u{1D569}",
- xoplus: "\u2A01",
- xotime: "\u2A02",
- xrArr: "\u27F9",
- xrarr: "\u27F6",
- Xscr: "\u{1D4B3}",
- xscr: "\u{1D4CD}",
- xsqcup: "\u2A06",
- xuplus: "\u2A04",
- xutri: "\u25B3",
- xvee: "\u22C1",
- xwedge: "\u22C0",
- Yacute: "\xDD",
- yacute: "\xFD",
- YAcy: "\u042F",
- yacy: "\u044F",
- Ycirc: "\u0176",
- ycirc: "\u0177",
- Ycy: "\u042B",
- ycy: "\u044B",
- yen: "\xA5",
- Yfr: "\u{1D51C}",
- yfr: "\u{1D536}",
- YIcy: "\u0407",
- yicy: "\u0457",
- Yopf: "\u{1D550}",
- yopf: "\u{1D56A}",
- Yscr: "\u{1D4B4}",
- yscr: "\u{1D4CE}",
- YUcy: "\u042E",
- yucy: "\u044E",
- Yuml: "\u0178",
- yuml: "\xFF",
- Zacute: "\u0179",
- zacute: "\u017A",
- Zcaron: "\u017D",
- zcaron: "\u017E",
- Zcy: "\u0417",
- zcy: "\u0437",
- Zdot: "\u017B",
- zdot: "\u017C",
- zeetrf: "\u2128",
- ZeroWidthSpace: "\u200B",
- Zeta: "\u0396",
- zeta: "\u03B6",
- Zfr: "\u2128",
- zfr: "\u{1D537}",
- ZHcy: "\u0416",
- zhcy: "\u0436",
- zigrarr: "\u21DD",
- Zopf: "\u2124",
- zopf: "\u{1D56B}",
- Zscr: "\u{1D4B5}",
- zscr: "\u{1D4CF}",
- zwj: "\u200D",
- zwnj: "\u200C"
- });
- exports2.entityMap = exports2.HTML_ENTITIES;
- }
-});
-
-// ../../node_modules/@xmldom/xmldom/lib/sax.js
-var require_sax = __commonJS({
- "../../node_modules/@xmldom/xmldom/lib/sax.js"(exports2) {
- var NAMESPACE = require_conventions().NAMESPACE;
- var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;
- var nameChar = new RegExp("[\\-\\.0-9" + nameStartChar.source.slice(1, -1) + "\\u00B7\\u0300-\\u036F\\u203F-\\u2040]");
- var tagNamePattern = new RegExp("^" + nameStartChar.source + nameChar.source + "*(?::" + nameStartChar.source + nameChar.source + "*)?$");
- var S_TAG = 0;
- var S_ATTR = 1;
- var S_ATTR_SPACE = 2;
- var S_EQ = 3;
- var S_ATTR_NOQUOT_VALUE = 4;
- var S_ATTR_END = 5;
- var S_TAG_SPACE = 6;
- var S_TAG_CLOSE = 7;
- function ParseError(message, locator) {
- this.message = message;
- this.locator = locator;
- if (Error.captureStackTrace) Error.captureStackTrace(this, ParseError);
- }
- ParseError.prototype = new Error();
- ParseError.prototype.name = ParseError.name;
- function XMLReader() {
- }
- XMLReader.prototype = {
- parse: function(source, defaultNSMap, entityMap) {
- var domBuilder = this.domBuilder;
- domBuilder.startDocument();
- _copy(defaultNSMap, defaultNSMap = {});
- parse(
- source,
- defaultNSMap,
- entityMap,
- domBuilder,
- this.errorHandler
- );
- domBuilder.endDocument();
- }
- };
- function parse(source, defaultNSMapCopy, entityMap, domBuilder, errorHandler) {
- function fixedFromCharCode(code) {
- if (code > 65535) {
- code -= 65536;
- var surrogate1 = 55296 + (code >> 10), surrogate2 = 56320 + (code & 1023);
- return String.fromCharCode(surrogate1, surrogate2);
- } else {
- return String.fromCharCode(code);
- }
- }
- function entityReplacer(a2) {
- var k = a2.slice(1, -1);
- if (Object.hasOwnProperty.call(entityMap, k)) {
- return entityMap[k];
- } else if (k.charAt(0) === "#") {
- return fixedFromCharCode(parseInt(k.substr(1).replace("x", "0x")));
- } else {
- errorHandler.error("entity not found:" + a2);
- return a2;
- }
- }
- function appendText(end2) {
- if (end2 > start) {
- var xt = source.substring(start, end2).replace(/?\w+;/g, entityReplacer);
- locator && position(start);
- domBuilder.characters(xt, 0, end2 - start);
- start = end2;
- }
- }
- function position(p, m) {
- while (p >= lineEnd && (m = linePattern.exec(source))) {
- lineStart = m.index;
- lineEnd = lineStart + m[0].length;
- locator.lineNumber++;
- }
- locator.columnNumber = p - lineStart + 1;
- }
- var lineStart = 0;
- var lineEnd = 0;
- var linePattern = /.*(?:\r\n?|\n)|.*$/g;
- var locator = domBuilder.locator;
- var parseStack = [{ currentNSMap: defaultNSMapCopy }];
- var closeMap = {};
- var start = 0;
- while (true) {
- try {
- var tagStart = source.indexOf("<", start);
- if (tagStart < 0) {
- if (!source.substr(start).match(/^\s*$/)) {
- var doc = domBuilder.doc;
- var text = doc.createTextNode(source.substr(start));
- doc.appendChild(text);
- domBuilder.currentElement = text;
- }
- return;
- }
- if (tagStart > start) {
- appendText(tagStart);
- }
- switch (source.charAt(tagStart + 1)) {
- case "/":
- var end = source.indexOf(">", tagStart + 3);
- var tagName = source.substring(tagStart + 2, end).replace(/[ \t\n\r]+$/g, "");
- var config = parseStack.pop();
- if (end < 0) {
- tagName = source.substring(tagStart + 2).replace(/[\s<].*/, "");
- errorHandler.error("end tag name: " + tagName + " is not complete:" + config.tagName);
- end = tagStart + 1 + tagName.length;
- } else if (tagName.match(/\s)) {
- tagName = tagName.replace(/[\s<].*/, "");
- errorHandler.error("end tag name: " + tagName + " maybe not complete");
- end = tagStart + 1 + tagName.length;
- }
- var localNSMap = config.localNSMap;
- var endMatch = config.tagName == tagName;
- var endIgnoreCaseMach = endMatch || config.tagName && config.tagName.toLowerCase() == tagName.toLowerCase();
- if (endIgnoreCaseMach) {
- domBuilder.endElement(config.uri, config.localName, tagName);
- if (localNSMap) {
- for (var prefix in localNSMap) {
- if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
- domBuilder.endPrefixMapping(prefix);
- }
- }
- }
- if (!endMatch) {
- errorHandler.fatalError("end tag name: " + tagName + " is not match the current start tagName:" + config.tagName);
- }
- } else {
- parseStack.push(config);
- }
- end++;
- break;
- case "?":
- locator && position(tagStart);
- end = parseInstruction(source, tagStart, domBuilder);
- break;
- case "!":
- locator && position(tagStart);
- end = parseDCC(source, tagStart, domBuilder, errorHandler);
- break;
- default:
- locator && position(tagStart);
- var el = new ElementAttributes();
- var currentNSMap = parseStack[parseStack.length - 1].currentNSMap;
- var end = parseElementStartPart(source, tagStart, el, currentNSMap, entityReplacer, errorHandler);
- var len = el.length;
- if (!el.closed && fixSelfClosed(source, end, el.tagName, closeMap)) {
- el.closed = true;
- if (!entityMap.nbsp) {
- errorHandler.warning("unclosed xml attribute");
- }
- }
- if (locator && len) {
- var locator2 = copyLocator(locator, {});
- for (var i = 0; i < len; i++) {
- var a = el[i];
- position(a.offset);
- a.locator = copyLocator(locator, {});
- }
- domBuilder.locator = locator2;
- if (appendElement(el, domBuilder, currentNSMap)) {
- parseStack.push(el);
- }
- domBuilder.locator = locator;
- } else {
- if (appendElement(el, domBuilder, currentNSMap)) {
- parseStack.push(el);
- }
- }
- if (NAMESPACE.isHTML(el.uri) && !el.closed) {
- end = parseHtmlSpecialContent(source, end, el.tagName, entityReplacer, domBuilder);
- } else {
- end++;
- }
- }
- } catch (e) {
- if (e instanceof ParseError) {
- throw e;
- }
- errorHandler.error("element parse error: " + e);
- end = -1;
- }
- if (end > start) {
- start = end;
- } else {
- appendText(Math.max(tagStart, start) + 1);
- }
- }
- }
- function copyLocator(f, t) {
- t.lineNumber = f.lineNumber;
- t.columnNumber = f.columnNumber;
- return t;
- }
- function parseElementStartPart(source, start, el, currentNSMap, entityReplacer, errorHandler) {
- function addAttribute(qname, value2, startIndex) {
- if (el.attributeNames.hasOwnProperty(qname)) {
- errorHandler.fatalError("Attribute " + qname + " redefined");
- }
- el.addValue(
- qname,
- // @see https://www.w3.org/TR/xml/#AVNormalize
- // since the xmldom sax parser does not "interpret" DTD the following is not implemented:
- // - recursive replacement of (DTD) entity references
- // - trimming and collapsing multiple spaces into a single one for attributes that are not of type CDATA
- value2.replace(/[\t\n\r]/g, " ").replace(/?\w+;/g, entityReplacer),
- startIndex
- );
- }
- var attrName;
- var value;
- var p = ++start;
- var s = S_TAG;
- while (true) {
- var c = source.charAt(p);
- switch (c) {
- case "=":
- if (s === S_ATTR) {
- attrName = source.slice(start, p);
- s = S_EQ;
- } else if (s === S_ATTR_SPACE) {
- s = S_EQ;
- } else {
- throw new Error("attribute equal must after attrName");
- }
- break;
- case "'":
- case '"':
- if (s === S_EQ || s === S_ATTR) {
- if (s === S_ATTR) {
- errorHandler.warning('attribute value must after "="');
- attrName = source.slice(start, p);
- }
- start = p + 1;
- p = source.indexOf(c, start);
- if (p > 0) {
- value = source.slice(start, p);
- addAttribute(attrName, value, start - 1);
- s = S_ATTR_END;
- } else {
- throw new Error("attribute value no end '" + c + "' match");
- }
- } else if (s == S_ATTR_NOQUOT_VALUE) {
- value = source.slice(start, p);
- addAttribute(attrName, value, start);
- errorHandler.warning('attribute "' + attrName + '" missed start quot(' + c + ")!!");
- start = p + 1;
- s = S_ATTR_END;
- } else {
- throw new Error('attribute value must after "="');
- }
- break;
- case "/":
- switch (s) {
- case S_TAG:
- el.setTagName(source.slice(start, p));
- case S_ATTR_END:
- case S_TAG_SPACE:
- case S_TAG_CLOSE:
- s = S_TAG_CLOSE;
- el.closed = true;
- case S_ATTR_NOQUOT_VALUE:
- case S_ATTR:
- break;
- case S_ATTR_SPACE:
- el.closed = true;
- break;
- default:
- throw new Error("attribute invalid close char('/')");
- }
- break;
- case "":
- errorHandler.error("unexpected end of input");
- if (s == S_TAG) {
- el.setTagName(source.slice(start, p));
- }
- return p;
- case ">":
- switch (s) {
- case S_TAG:
- el.setTagName(source.slice(start, p));
- case S_ATTR_END:
- case S_TAG_SPACE:
- case S_TAG_CLOSE:
- break;
- case S_ATTR_NOQUOT_VALUE:
- case S_ATTR:
- value = source.slice(start, p);
- if (value.slice(-1) === "/") {
- el.closed = true;
- value = value.slice(0, -1);
- }
- case S_ATTR_SPACE:
- if (s === S_ATTR_SPACE) {
- value = attrName;
- }
- if (s == S_ATTR_NOQUOT_VALUE) {
- errorHandler.warning('attribute "' + value + '" missed quot(")!');
- addAttribute(attrName, value, start);
- } else {
- if (!NAMESPACE.isHTML(currentNSMap[""]) || !value.match(/^(?:disabled|checked|selected)$/i)) {
- errorHandler.warning('attribute "' + value + '" missed value!! "' + value + '" instead!!');
- }
- addAttribute(value, value, start);
- }
- break;
- case S_EQ:
- throw new Error("attribute value missed!!");
- }
- return p;
- case "\x80":
- c = " ";
- default:
- if (c <= " ") {
- switch (s) {
- case S_TAG:
- el.setTagName(source.slice(start, p));
- s = S_TAG_SPACE;
- break;
- case S_ATTR:
- attrName = source.slice(start, p);
- s = S_ATTR_SPACE;
- break;
- case S_ATTR_NOQUOT_VALUE:
- var value = source.slice(start, p);
- errorHandler.warning('attribute "' + value + '" missed quot(")!!');
- addAttribute(attrName, value, start);
- case S_ATTR_END:
- s = S_TAG_SPACE;
- break;
- }
- } else {
- switch (s) {
- case S_ATTR_SPACE:
- var tagName = el.tagName;
- if (!NAMESPACE.isHTML(currentNSMap[""]) || !attrName.match(/^(?:disabled|checked|selected)$/i)) {
- errorHandler.warning('attribute "' + attrName + '" missed value!! "' + attrName + '" instead2!!');
- }
- addAttribute(attrName, attrName, start);
- start = p;
- s = S_ATTR;
- break;
- case S_ATTR_END:
- errorHandler.warning('attribute space is required"' + attrName + '"!!');
- case S_TAG_SPACE:
- s = S_ATTR;
- start = p;
- break;
- case S_EQ:
- s = S_ATTR_NOQUOT_VALUE;
- start = p;
- break;
- case S_TAG_CLOSE:
- throw new Error("elements closed character '/' and '>' must be connected to");
- }
- }
- }
- p++;
- }
- }
- function appendElement(el, domBuilder, currentNSMap) {
- var tagName = el.tagName;
- var localNSMap = null;
- var i = el.length;
- while (i--) {
- var a = el[i];
- var qName = a.qName;
- var value = a.value;
- var nsp = qName.indexOf(":");
- if (nsp > 0) {
- var prefix = a.prefix = qName.slice(0, nsp);
- var localName = qName.slice(nsp + 1);
- var nsPrefix = prefix === "xmlns" && localName;
- } else {
- localName = qName;
- prefix = null;
- nsPrefix = qName === "xmlns" && "";
- }
- a.localName = localName;
- if (nsPrefix !== false) {
- if (localNSMap == null) {
- localNSMap = {};
- _copy(currentNSMap, currentNSMap = {});
- }
- currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;
- a.uri = NAMESPACE.XMLNS;
- domBuilder.startPrefixMapping(nsPrefix, value);
- }
- }
- var i = el.length;
- while (i--) {
- a = el[i];
- var prefix = a.prefix;
- if (prefix) {
- if (prefix === "xml") {
- a.uri = NAMESPACE.XML;
- }
- if (prefix !== "xmlns") {
- a.uri = currentNSMap[prefix || ""];
- }
- }
- }
- var nsp = tagName.indexOf(":");
- if (nsp > 0) {
- prefix = el.prefix = tagName.slice(0, nsp);
- localName = el.localName = tagName.slice(nsp + 1);
- } else {
- prefix = null;
- localName = el.localName = tagName;
- }
- var ns = el.uri = currentNSMap[prefix || ""];
- domBuilder.startElement(ns, localName, tagName, el);
- if (el.closed) {
- domBuilder.endElement(ns, localName, tagName);
- if (localNSMap) {
- for (prefix in localNSMap) {
- if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
- domBuilder.endPrefixMapping(prefix);
- }
- }
- }
- } else {
- el.currentNSMap = currentNSMap;
- el.localNSMap = localNSMap;
- return true;
- }
- }
- function parseHtmlSpecialContent(source, elStartEnd, tagName, entityReplacer, domBuilder) {
- if (/^(?:script|textarea)$/i.test(tagName)) {
- var elEndStart = source.indexOf("" + tagName + ">", elStartEnd);
- var text = source.substring(elStartEnd + 1, elEndStart);
- if (/[&<]/.test(text)) {
- if (/^script$/i.test(tagName)) {
- domBuilder.characters(text, 0, text.length);
- return elEndStart;
- }
- text = text.replace(/?\w+;/g, entityReplacer);
- domBuilder.characters(text, 0, text.length);
- return elEndStart;
- }
- }
- return elStartEnd + 1;
- }
- function fixSelfClosed(source, elStartEnd, tagName, closeMap) {
- var pos = closeMap[tagName];
- if (pos == null) {
- pos = source.lastIndexOf("" + tagName + ">");
- if (pos < elStartEnd) {
- pos = source.lastIndexOf("" + tagName);
- }
- closeMap[tagName] = pos;
- }
- return pos < elStartEnd;
- }
- function _copy(source, target) {
- for (var n in source) {
- if (Object.prototype.hasOwnProperty.call(source, n)) {
- target[n] = source[n];
- }
- }
- }
- function parseDCC(source, start, domBuilder, errorHandler) {
- var next = source.charAt(start + 2);
- switch (next) {
- case "-":
- if (source.charAt(start + 3) === "-") {
- var end = source.indexOf("-->", start + 4);
- if (end > start) {
- domBuilder.comment(source, start + 4, end - start - 4);
- return end + 3;
- } else {
- errorHandler.error("Unclosed comment");
- return -1;
- }
- } else {
- return -1;
- }
- default:
- if (source.substr(start + 3, 6) == "CDATA[") {
- var end = source.indexOf("]]>", start + 9);
- domBuilder.startCDATA();
- domBuilder.characters(source, start + 9, end - start - 9);
- domBuilder.endCDATA();
- return end + 3;
- }
- var matchs = split(source, start);
- var len = matchs.length;
- if (len > 1 && /!doctype/i.test(matchs[0][0])) {
- var name2 = matchs[1][0];
- var pubid = false;
- var sysid = false;
- if (len > 3) {
- if (/^public$/i.test(matchs[2][0])) {
- pubid = matchs[3][0];
- sysid = len > 4 && matchs[4][0];
- } else if (/^system$/i.test(matchs[2][0])) {
- sysid = matchs[3][0];
- }
- }
- var lastMatch = matchs[len - 1];
- domBuilder.startDTD(name2, pubid, sysid);
- domBuilder.endDTD();
- return lastMatch.index + lastMatch[0].length;
- }
- }
- return -1;
- }
- function parseInstruction(source, start, domBuilder) {
- var end = source.indexOf("?>", start);
- if (end) {
- var match = source.substring(start, end).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);
- if (match) {
- var len = match[0].length;
- domBuilder.processingInstruction(match[1], match[2]);
- return end + 2;
- } else {
- return -1;
- }
- }
- return -1;
- }
- function ElementAttributes() {
- this.attributeNames = {};
- }
- ElementAttributes.prototype = {
- setTagName: function(tagName) {
- if (!tagNamePattern.test(tagName)) {
- throw new Error("invalid tagName:" + tagName);
- }
- this.tagName = tagName;
- },
- addValue: function(qName, value, offset) {
- if (!tagNamePattern.test(qName)) {
- throw new Error("invalid attribute:" + qName);
- }
- this.attributeNames[qName] = this.length;
- this[this.length++] = { qName, value, offset };
- },
- length: 0,
- getLocalName: function(i) {
- return this[i].localName;
- },
- getLocator: function(i) {
- return this[i].locator;
- },
- getQName: function(i) {
- return this[i].qName;
- },
- getURI: function(i) {
- return this[i].uri;
- },
- getValue: function(i) {
- return this[i].value;
- }
- // ,getIndex:function(uri, localName)){
- // if(localName){
- //
- // }else{
- // var qName = uri
- // }
- // },
- // getValue:function(){return this.getValue(this.getIndex.apply(this,arguments))},
- // getType:function(uri,localName){}
- // getType:function(i){},
- };
- function split(source, start) {
- var match;
- var buf = [];
- var reg = /'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;
- reg.lastIndex = start;
- reg.exec(source);
- while (match = reg.exec(source)) {
- buf.push(match);
- if (match[1]) return buf;
- }
- }
- exports2.XMLReader = XMLReader;
- exports2.ParseError = ParseError;
- }
-});
-
-// ../../node_modules/@xmldom/xmldom/lib/dom-parser.js
-var require_dom_parser = __commonJS({
- "../../node_modules/@xmldom/xmldom/lib/dom-parser.js"(exports2) {
- var conventions = require_conventions();
- var dom = require_dom();
- var entities = require_entities();
- var sax = require_sax();
- var DOMImplementation = dom.DOMImplementation;
- var NAMESPACE = conventions.NAMESPACE;
- var ParseError = sax.ParseError;
- var XMLReader = sax.XMLReader;
- function normalizeLineEndings(input) {
- return input.replace(/\r[\n\u0085]/g, "\n").replace(/[\r\u0085\u2028]/g, "\n");
- }
- function DOMParser2(options) {
- this.options = options || { locator: {} };
- }
- DOMParser2.prototype.parseFromString = function(source, mimeType) {
- var options = this.options;
- var sax2 = new XMLReader();
- var domBuilder = options.domBuilder || new DOMHandler();
- var errorHandler = options.errorHandler;
- var locator = options.locator;
- var defaultNSMap = options.xmlns || {};
- var isHTML = /\/x?html?$/.test(mimeType);
- var entityMap = isHTML ? entities.HTML_ENTITIES : entities.XML_ENTITIES;
- if (locator) {
- domBuilder.setDocumentLocator(locator);
- }
- sax2.errorHandler = buildErrorHandler(errorHandler, domBuilder, locator);
- sax2.domBuilder = options.domBuilder || domBuilder;
- if (isHTML) {
- defaultNSMap[""] = NAMESPACE.HTML;
- }
- defaultNSMap.xml = defaultNSMap.xml || NAMESPACE.XML;
- var normalize = options.normalizeLineEndings || normalizeLineEndings;
- if (source && typeof source === "string") {
- sax2.parse(
- normalize(source),
- defaultNSMap,
- entityMap
- );
- } else {
- sax2.errorHandler.error("invalid doc source");
- }
- return domBuilder.doc;
- };
- function buildErrorHandler(errorImpl, domBuilder, locator) {
- if (!errorImpl) {
- if (domBuilder instanceof DOMHandler) {
- return domBuilder;
- }
- errorImpl = domBuilder;
- }
- var errorHandler = {};
- var isCallback = errorImpl instanceof Function;
- locator = locator || {};
- function build(key) {
- var fn2 = errorImpl[key];
- if (!fn2 && isCallback) {
- fn2 = errorImpl.length == 2 ? function(msg) {
- errorImpl(key, msg);
- } : errorImpl;
- }
- errorHandler[key] = fn2 && function(msg) {
- fn2("[xmldom " + key + "] " + msg + _locator(locator));
- } || function() {
- };
- }
- build("warning");
- build("error");
- build("fatalError");
- return errorHandler;
- }
- function DOMHandler() {
- this.cdata = false;
- }
- function position(locator, node) {
- node.lineNumber = locator.lineNumber;
- node.columnNumber = locator.columnNumber;
- }
- DOMHandler.prototype = {
- startDocument: function() {
- this.doc = new DOMImplementation().createDocument(null, null, null);
- if (this.locator) {
- this.doc.documentURI = this.locator.systemId;
- }
- },
- startElement: function(namespaceURI, localName, qName, attrs) {
- var doc = this.doc;
- var el = doc.createElementNS(namespaceURI, qName || localName);
- var len = attrs.length;
- appendElement(this, el);
- this.currentElement = el;
- this.locator && position(this.locator, el);
- for (var i = 0; i < len; i++) {
- var namespaceURI = attrs.getURI(i);
- var value = attrs.getValue(i);
- var qName = attrs.getQName(i);
- var attr = doc.createAttributeNS(namespaceURI, qName);
- this.locator && position(attrs.getLocator(i), attr);
- attr.value = attr.nodeValue = value;
- el.setAttributeNode(attr);
- }
- },
- endElement: function(namespaceURI, localName, qName) {
- var current = this.currentElement;
- var tagName = current.tagName;
- this.currentElement = current.parentNode;
- },
- startPrefixMapping: function(prefix, uri) {
- },
- endPrefixMapping: function(prefix) {
- },
- processingInstruction: function(target, data) {
- var ins = this.doc.createProcessingInstruction(target, data);
- this.locator && position(this.locator, ins);
- appendElement(this, ins);
- },
- ignorableWhitespace: function(ch, start, length) {
- },
- characters: function(chars, start, length) {
- chars = _toString.apply(this, arguments);
- if (chars) {
- if (this.cdata) {
- var charNode = this.doc.createCDATASection(chars);
- } else {
- var charNode = this.doc.createTextNode(chars);
- }
- if (this.currentElement) {
- this.currentElement.appendChild(charNode);
- } else if (/^\s*$/.test(chars)) {
- this.doc.appendChild(charNode);
- }
- this.locator && position(this.locator, charNode);
- }
- },
- skippedEntity: function(name2) {
- },
- endDocument: function() {
- this.doc.normalize();
- },
- setDocumentLocator: function(locator) {
- if (this.locator = locator) {
- locator.lineNumber = 0;
- }
- },
- //LexicalHandler
- comment: function(chars, start, length) {
- chars = _toString.apply(this, arguments);
- var comm = this.doc.createComment(chars);
- this.locator && position(this.locator, comm);
- appendElement(this, comm);
- },
- startCDATA: function() {
- this.cdata = true;
- },
- endCDATA: function() {
- this.cdata = false;
- },
- startDTD: function(name2, publicId, systemId) {
- var impl = this.doc.implementation;
- if (impl && impl.createDocumentType) {
- var dt = impl.createDocumentType(name2, publicId, systemId);
- this.locator && position(this.locator, dt);
- appendElement(this, dt);
- this.doc.doctype = dt;
- }
- },
- /**
- * @see org.xml.sax.ErrorHandler
- * @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html
- */
- warning: function(error) {
- console.warn("[xmldom warning] " + error, _locator(this.locator));
- },
- error: function(error) {
- console.error("[xmldom error] " + error, _locator(this.locator));
- },
- fatalError: function(error) {
- throw new ParseError(error, this.locator);
- }
- };
- function _locator(l) {
- if (l) {
- return "\n@" + (l.systemId || "") + "#[line:" + l.lineNumber + ",col:" + l.columnNumber + "]";
- }
- }
- function _toString(chars, start, length) {
- if (typeof chars == "string") {
- return chars.substr(start, length);
- } else {
- if (chars.length >= start + length || start) {
- return new java.lang.String(chars, start, length) + "";
- }
- return chars;
- }
- }
- "endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g, function(key) {
- DOMHandler.prototype[key] = function() {
- return null;
- };
- });
- function appendElement(hander, node) {
- if (!hander.currentElement) {
- hander.doc.appendChild(node);
- } else {
- hander.currentElement.appendChild(node);
- }
- }
- exports2.__DOMHandler = DOMHandler;
- exports2.normalizeLineEndings = normalizeLineEndings;
- exports2.DOMParser = DOMParser2;
- }
-});
-
-// ../../node_modules/@xmldom/xmldom/lib/index.js
-var require_lib = __commonJS({
- "../../node_modules/@xmldom/xmldom/lib/index.js"(exports2) {
- var dom = require_dom();
- exports2.DOMImplementation = dom.DOMImplementation;
- exports2.XMLSerializer = dom.XMLSerializer;
- exports2.DOMParser = require_dom_parser().DOMParser;
- }
-});
-
-// ../../node_modules/xpath/xpath.js
-var require_xpath = __commonJS({
- "../../node_modules/xpath/xpath.js"(exports2) {
- var xpath2 = typeof exports2 === "undefined" ? {} : exports2;
- (function(exports3) {
- "use strict";
- var NAMESPACE_NODE_NODETYPE = "__namespace";
- var isNil = function(x) {
- return x === null || x === void 0;
- };
- var isValidNodeType = function(nodeType) {
- return nodeType === NAMESPACE_NODE_NODETYPE || Number.isInteger(nodeType) && nodeType >= 1 && nodeType <= 11;
- };
- var isNodeLike = function(value) {
- return value && isValidNodeType(value.nodeType) && typeof value.nodeName === "string";
- };
- function curry(func) {
- var slice = Array.prototype.slice, totalargs = func.length, partial = function(args, fn3) {
- return function() {
- return fn3.apply(this, args.concat(slice.call(arguments)));
- };
- }, fn2 = function() {
- var args = slice.call(arguments);
- return args.length < totalargs ? partial(args, fn2) : func.apply(this, slice.apply(arguments, [0, totalargs]));
- };
- return fn2;
- }
- var forEach = function(f, xs) {
- for (var i = 0; i < xs.length; i += 1) {
- f(xs[i], i, xs);
- }
- };
- var reduce = function(f, seed, xs) {
- var acc = seed;
- forEach(function(x, i) {
- acc = f(acc, x, i);
- }, xs);
- return acc;
- };
- var map = function(f, xs) {
- var mapped = new Array(xs.length);
- forEach(function(x, i) {
- mapped[i] = f(x);
- }, xs);
- return mapped;
- };
- var filter = function(f, xs) {
- var filtered = [];
- forEach(function(x, i) {
- if (f(x, i)) {
- filtered.push(x);
- }
- }, xs);
- return filtered;
- };
- var includes = function(values, value) {
- for (var i = 0; i < values.length; i += 1) {
- if (values[i] === value) {
- return true;
- }
- }
- return false;
- };
- function always(value) {
- return function() {
- return value;
- };
- }
- function toString(x) {
- return x.toString();
- }
- var join = function(s, xs) {
- return xs.join(s);
- };
- var wrap = function(pref, suf, str) {
- return pref + str + suf;
- };
- var prototypeConcat = Array.prototype.concat;
- var sortNodes = function(nodes, reverse) {
- var ns = new XNodeSet();
- ns.addArray(nodes);
- var sorted = ns.toArray();
- return reverse ? sorted.reverse() : sorted;
- };
- var MAX_ARGUMENT_LENGTH = 32767;
- function flatten(arr) {
- var result = [];
- for (var start = 0; start < arr.length; start += MAX_ARGUMENT_LENGTH) {
- var chunk = arr.slice(start, start + MAX_ARGUMENT_LENGTH);
- result = prototypeConcat.apply(result, chunk);
- }
- return result;
- }
- function assign(target, varArgs) {
- var to = Object(target);
- for (var index = 1; index < arguments.length; index++) {
- var nextSource = arguments[index];
- if (nextSource != null) {
- for (var nextKey in nextSource) {
- if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
- to[nextKey] = nextSource[nextKey];
- }
- }
- }
- }
- return to;
- }
- var NodeTypes = {
- ELEMENT_NODE: 1,
- ATTRIBUTE_NODE: 2,
- TEXT_NODE: 3,
- CDATA_SECTION_NODE: 4,
- PROCESSING_INSTRUCTION_NODE: 7,
- COMMENT_NODE: 8,
- DOCUMENT_NODE: 9,
- DOCUMENT_TYPE_NODE: 10,
- DOCUMENT_FRAGMENT_NODE: 11,
- NAMESPACE_NODE: NAMESPACE_NODE_NODETYPE
- };
- XPathParser.prototype = new Object();
- XPathParser.prototype.constructor = XPathParser;
- XPathParser.superclass = Object.prototype;
- function XPathParser() {
- this.init();
- }
- XPathParser.prototype.init = function() {
- this.reduceActions = [];
- this.reduceActions[3] = function(rhs) {
- return new OrOperation(rhs[0], rhs[2]);
- };
- this.reduceActions[5] = function(rhs) {
- return new AndOperation(rhs[0], rhs[2]);
- };
- this.reduceActions[7] = function(rhs) {
- return new EqualsOperation(rhs[0], rhs[2]);
- };
- this.reduceActions[8] = function(rhs) {
- return new NotEqualOperation(rhs[0], rhs[2]);
- };
- this.reduceActions[10] = function(rhs) {
- return new LessThanOperation(rhs[0], rhs[2]);
- };
- this.reduceActions[11] = function(rhs) {
- return new GreaterThanOperation(rhs[0], rhs[2]);
- };
- this.reduceActions[12] = function(rhs) {
- return new LessThanOrEqualOperation(rhs[0], rhs[2]);
- };
- this.reduceActions[13] = function(rhs) {
- return new GreaterThanOrEqualOperation(rhs[0], rhs[2]);
- };
- this.reduceActions[15] = function(rhs) {
- return new PlusOperation(rhs[0], rhs[2]);
- };
- this.reduceActions[16] = function(rhs) {
- return new MinusOperation(rhs[0], rhs[2]);
- };
- this.reduceActions[18] = function(rhs) {
- return new MultiplyOperation(rhs[0], rhs[2]);
- };
- this.reduceActions[19] = function(rhs) {
- return new DivOperation(rhs[0], rhs[2]);
- };
- this.reduceActions[20] = function(rhs) {
- return new ModOperation(rhs[0], rhs[2]);
- };
- this.reduceActions[22] = function(rhs) {
- return new UnaryMinusOperation(rhs[1]);
- };
- this.reduceActions[24] = function(rhs) {
- return new BarOperation(rhs[0], rhs[2]);
- };
- this.reduceActions[25] = function(rhs) {
- return new PathExpr(void 0, void 0, rhs[0]);
- };
- this.reduceActions[27] = function(rhs) {
- rhs[0].locationPath = rhs[2];
- return rhs[0];
- };
- this.reduceActions[28] = function(rhs) {
- rhs[0].locationPath = rhs[2];
- rhs[0].locationPath.steps.unshift(new Step(Step.DESCENDANTORSELF, NodeTest.nodeTest, []));
- return rhs[0];
- };
- this.reduceActions[29] = function(rhs) {
- return new PathExpr(rhs[0], [], void 0);
- };
- this.reduceActions[30] = function(rhs) {
- if (Utilities.instance_of(rhs[0], PathExpr)) {
- if (rhs[0].filterPredicates == void 0) {
- rhs[0].filterPredicates = [];
- }
- rhs[0].filterPredicates.push(rhs[1]);
- return rhs[0];
- } else {
- return new PathExpr(rhs[0], [rhs[1]], void 0);
- }
- };
- this.reduceActions[32] = function(rhs) {
- return rhs[1];
- };
- this.reduceActions[33] = function(rhs) {
- return new XString(rhs[0]);
- };
- this.reduceActions[34] = function(rhs) {
- return new XNumber(rhs[0]);
- };
- this.reduceActions[36] = function(rhs) {
- return new FunctionCall(rhs[0], []);
- };
- this.reduceActions[37] = function(rhs) {
- return new FunctionCall(rhs[0], rhs[2]);
- };
- this.reduceActions[38] = function(rhs) {
- return [rhs[0]];
- };
- this.reduceActions[39] = function(rhs) {
- rhs[2].unshift(rhs[0]);
- return rhs[2];
- };
- this.reduceActions[43] = function(rhs) {
- return new LocationPath(true, []);
- };
- this.reduceActions[44] = function(rhs) {
- rhs[1].absolute = true;
- return rhs[1];
- };
- this.reduceActions[46] = function(rhs) {
- return new LocationPath(false, [rhs[0]]);
- };
- this.reduceActions[47] = function(rhs) {
- rhs[0].steps.push(rhs[2]);
- return rhs[0];
- };
- this.reduceActions[49] = function(rhs) {
- return new Step(rhs[0], rhs[1], []);
- };
- this.reduceActions[50] = function(rhs) {
- return new Step(Step.CHILD, rhs[0], []);
- };
- this.reduceActions[51] = function(rhs) {
- return new Step(rhs[0], rhs[1], rhs[2]);
- };
- this.reduceActions[52] = function(rhs) {
- return new Step(Step.CHILD, rhs[0], rhs[1]);
- };
- this.reduceActions[54] = function(rhs) {
- return [rhs[0]];
- };
- this.reduceActions[55] = function(rhs) {
- rhs[1].unshift(rhs[0]);
- return rhs[1];
- };
- this.reduceActions[56] = function(rhs) {
- if (rhs[0] == "ancestor") {
- return Step.ANCESTOR;
- } else if (rhs[0] == "ancestor-or-self") {
- return Step.ANCESTORORSELF;
- } else if (rhs[0] == "attribute") {
- return Step.ATTRIBUTE;
- } else if (rhs[0] == "child") {
- return Step.CHILD;
- } else if (rhs[0] == "descendant") {
- return Step.DESCENDANT;
- } else if (rhs[0] == "descendant-or-self") {
- return Step.DESCENDANTORSELF;
- } else if (rhs[0] == "following") {
- return Step.FOLLOWING;
- } else if (rhs[0] == "following-sibling") {
- return Step.FOLLOWINGSIBLING;
- } else if (rhs[0] == "namespace") {
- return Step.NAMESPACE;
- } else if (rhs[0] == "parent") {
- return Step.PARENT;
- } else if (rhs[0] == "preceding") {
- return Step.PRECEDING;
- } else if (rhs[0] == "preceding-sibling") {
- return Step.PRECEDINGSIBLING;
- } else if (rhs[0] == "self") {
- return Step.SELF;
- }
- return -1;
- };
- this.reduceActions[57] = function(rhs) {
- return Step.ATTRIBUTE;
- };
- this.reduceActions[59] = function(rhs) {
- if (rhs[0] == "comment") {
- return NodeTest.commentTest;
- } else if (rhs[0] == "text") {
- return NodeTest.textTest;
- } else if (rhs[0] == "processing-instruction") {
- return NodeTest.anyPiTest;
- } else if (rhs[0] == "node") {
- return NodeTest.nodeTest;
- }
- return new NodeTest(-1, void 0);
- };
- this.reduceActions[60] = function(rhs) {
- return new NodeTest.PITest(rhs[2]);
- };
- this.reduceActions[61] = function(rhs) {
- return rhs[1];
- };
- this.reduceActions[63] = function(rhs) {
- rhs[1].absolute = true;
- rhs[1].steps.unshift(new Step(Step.DESCENDANTORSELF, NodeTest.nodeTest, []));
- return rhs[1];
- };
- this.reduceActions[64] = function(rhs) {
- rhs[0].steps.push(new Step(Step.DESCENDANTORSELF, NodeTest.nodeTest, []));
- rhs[0].steps.push(rhs[2]);
- return rhs[0];
- };
- this.reduceActions[65] = function(rhs) {
- return new Step(Step.SELF, NodeTest.nodeTest, []);
- };
- this.reduceActions[66] = function(rhs) {
- return new Step(Step.PARENT, NodeTest.nodeTest, []);
- };
- this.reduceActions[67] = function(rhs) {
- return new VariableReference(rhs[1]);
- };
- this.reduceActions[68] = function(rhs) {
- return NodeTest.nameTestAny;
- };
- this.reduceActions[69] = function(rhs) {
- return new NodeTest.NameTestPrefixAny(rhs[0].split(":")[0]);
- };
- this.reduceActions[70] = function(rhs) {
- return new NodeTest.NameTestQName(rhs[0]);
- };
- };
- XPathParser.actionTable = [
- " s s sssssssss s ss s ss",
- " s ",
- "r rrrrrrrrr rrrrrrr rr r ",
- " rrrrr ",
- " s s sssssssss s ss s ss",
- "rs rrrrrrrr s sssssrrrrrr rrs rs ",
- " s s sssssssss s ss s ss",
- " s ",
- " s ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- " s ",
- " s ",
- " s s sssss s s ",
- "r rrrrrrrrr rrrrrrr rr r ",
- "a ",
- "r s rr r ",
- "r sr rr r ",
- "r s rr s rr r ",
- "r rssrr rss rr r ",
- "r rrrrr rrrss rr r ",
- "r rrrrrsss rrrrr rr r ",
- "r rrrrrrrr rrrrr rr r ",
- "r rrrrrrrr rrrrrs rr r ",
- "r rrrrrrrr rrrrrr rr r ",
- "r rrrrrrrr rrrrrr rr r ",
- "r srrrrrrrr rrrrrrs rr sr ",
- "r srrrrrrrr rrrrrrs rr r ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- "r rrrrrrrr rrrrrr rr r ",
- "r rrrrrrrr rrrrrr rr r ",
- "r rrrrrrrrr rrrrrrr rr r ",
- "r rrrrrrrrr rrrrrrr rr r ",
- " sssss ",
- "r rrrrrrrrr rrrrrrr rr sr ",
- "r rrrrrrrrr rrrrrrr rr r ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- " s ",
- "r srrrrrrrr rrrrrrs rr r ",
- "r rrrrrrrr rrrrr rr r ",
- " s ",
- " s ",
- " rrrrr ",
- " s s sssssssss s sss s ss",
- "r srrrrrrrr rrrrrrs rr r ",
- " s s sssssssss s ss s ss",
- " s s sssssssss s ss s ss",
- " s s sssssssss s ss s ss",
- " s s sssssssss s ss s ss",
- " s s sssssssss s ss s ss",
- " s s sssssssss s ss s ss",
- " s s sssssssss s ss s ss",
- " s s sssssssss s ss s ss",
- " s s sssssssss s ss s ss",
- " s s sssssssss s ss s ss",
- " s s sssssssss s ss s ss",
- " s s sssssssss s ss s ss",
- " s s sssssssss s ss s ss",
- " s s sssssssss ss s ss",
- " s s sssssssss s ss s ss",
- " s s sssss s s ",
- " s s sssss s s ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- " s s sssss s s ",
- " s s sssss s s ",
- "r rrrrrrrrr rrrrrrr rr sr ",
- "r rrrrrrrrr rrrrrrr rr sr ",
- "r rrrrrrrrr rrrrrrr rr r ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- " s ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- " rr ",
- " s ",
- " rs ",
- "r sr rr r ",
- "r s rr s rr r ",
- "r rssrr rss rr r ",
- "r rssrr rss rr r ",
- "r rrrrr rrrss rr r ",
- "r rrrrr rrrss rr r ",
- "r rrrrr rrrss rr r ",
- "r rrrrr rrrss rr r ",
- "r rrrrrsss rrrrr rr r ",
- "r rrrrrsss rrrrr rr r ",
- "r rrrrrrrr rrrrr rr r ",
- "r rrrrrrrr rrrrr rr r ",
- "r rrrrrrrr rrrrr rr r ",
- "r rrrrrrrr rrrrrr rr r ",
- " r ",
- " s ",
- "r srrrrrrrr rrrrrrs rr r ",
- "r srrrrrrrr rrrrrrs rr r ",
- "r rrrrrrrrr rrrrrrr rr r ",
- "r rrrrrrrrr rrrrrrr rr r ",
- "r rrrrrrrrr rrrrrrr rr r ",
- "r rrrrrrrrr rrrrrrr rr r ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- " s s sssssssss s ss s ss",
- "r rrrrrrrrr rrrrrrr rr rr ",
- " r "
- ];
- XPathParser.actionTableNumber = [
- ` 1 0 /.-,+*)(' & %$ # "!`,
- " J ",
- "a aaaaaaaaa aaaaaaa aa a ",
- " YYYYY ",
- ` 1 0 /.-,+*)(' & %$ # "!`,
- `K1 KKKKKKKK . +*)('KKKKKK KK# K" `,
- ` 1 0 /.-,+*)(' & %$ # "!`,
- " N ",
- " O ",
- "e eeeeeeeee eeeeeee ee ee ",
- "f fffffffff fffffff ff ff ",
- "d ddddddddd ddddddd dd dd ",
- "B BBBBBBBBB BBBBBBB BB BB ",
- "A AAAAAAAAA AAAAAAA AA AA ",
- " P ",
- " Q ",
- ` 1 . +*)(' # " `,
- "b bbbbbbbbb bbbbbbb bb b ",
- " ",
- "! S !! ! ",
- '" T" "" " ',
- "$ V $$ U $$ $ ",
- "& &ZY&& &XW && & ",
- ") ))))) )))\\[ )) ) ",
- ". ....._^] ..... .. . ",
- "1 11111111 11111 11 1 ",
- "5 55555555 55555` 55 5 ",
- "7 77777777 777777 77 7 ",
- "9 99999999 999999 99 9 ",
- ": c:::::::: ::::::b :: a: ",
- "I fIIIIIIII IIIIIIe II I ",
- "= ========= ======= == == ",
- "? ????????? ??????? ?? ?? ",
- "C CCCCCCCCC CCCCCCC CC CC ",
- "J JJJJJJJJ JJJJJJ JJ J ",
- "M MMMMMMMM MMMMMM MM M ",
- "N NNNNNNNNN NNNNNNN NN N ",
- "P PPPPPPPPP PPPPPPP PP P ",
- " +*)(' ",
- "R RRRRRRRRR RRRRRRR RR aR ",
- "U UUUUUUUUU UUUUUUU UU U ",
- "Z ZZZZZZZZZ ZZZZZZZ ZZ ZZ ",
- "c ccccccccc ccccccc cc cc ",
- " j ",
- "L fLLLLLLLL LLLLLLe LL L ",
- "6 66666666 66666 66 6 ",
- " k ",
- " l ",
- " XXXXX ",
- ` 1 0 /.-,+*)(' & %$m # "!`,
- "_ f________ ______e __ _ ",
- ` 1 0 /.-,+*)(' & %$ # "!`,
- ` 1 0 /.-,+*)(' & %$ # "!`,
- ` 1 0 /.-,+*)(' & %$ # "!`,
- ` 1 0 /.-,+*)(' & %$ # "!`,
- ` 1 0 /.-,+*)(' & %$ # "!`,
- ` 1 0 /.-,+*)(' & %$ # "!`,
- ` 1 0 /.-,+*)(' & %$ # "!`,
- ` 1 0 /.-,+*)(' & %$ # "!`,
- ` 1 0 /.-,+*)(' & %$ # "!`,
- ` 1 0 /.-,+*)(' & %$ # "!`,
- ` 1 0 /.-,+*)(' & %$ # "!`,
- ` 1 0 /.-,+*)(' & %$ # "!`,
- ` 1 0 /.-,+*)(' & %$ # "!`,
- ` 1 0 /.-,+*)(' %$ # "!`,
- ` 1 0 /.-,+*)(' & %$ # "!`,
- ` 1 . +*)(' # " `,
- ` 1 . +*)(' # " `,
- "> >>>>>>>>> >>>>>>> >> >> ",
- ` 1 . +*)(' # " `,
- ` 1 . +*)(' # " `,
- "Q QQQQQQQQQ QQQQQQQ QQ aQ ",
- "V VVVVVVVVV VVVVVVV VV aV ",
- "T TTTTTTTTT TTTTTTT TT T ",
- "@ @@@@@@@@@ @@@@@@@ @@ @@ ",
- " \x87 ",
- "[ [[[[[[[[[ [[[[[[[ [[ [[ ",
- "D DDDDDDDDD DDDDDDD DD DD ",
- " HH ",
- " \x88 ",
- " F\x89 ",
- "# T# ## # ",
- "% V %% U %% % ",
- "' 'ZY'' 'XW '' ' ",
- "( (ZY(( (XW (( ( ",
- "+ +++++ +++\\[ ++ + ",
- "* ***** ***\\[ ** * ",
- "- ----- ---\\[ -- - ",
- ", ,,,,, ,,,\\[ ,, , ",
- "0 00000_^] 00000 00 0 ",
- "/ /////_^] ///// // / ",
- "2 22222222 22222 22 2 ",
- "3 33333333 33333 33 3 ",
- "4 44444444 44444 44 4 ",
- "8 88888888 888888 88 8 ",
- " ^ ",
- " \x8A ",
- "; f;;;;;;;; ;;;;;;e ;; ; ",
- "< f<<<<<<<< <<<<<?@ AB CDEFGH IJ ",
- " ",
- " ",
- " ",
- "L456789:;<=>?@ AB CDEFGH IJ ",
- " M EFGH IJ ",
- " N;<=>?@ AB CDEFGH IJ ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " S EFGH IJ ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " e ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " h J ",
- " i j ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- "o456789:;<=>?@ ABpqCDEFGH IJ ",
- " ",
- " r6789:;<=>?@ AB CDEFGH IJ ",
- " s789:;<=>?@ AB CDEFGH IJ ",
- " t89:;<=>?@ AB CDEFGH IJ ",
- " u89:;<=>?@ AB CDEFGH IJ ",
- " v9:;<=>?@ AB CDEFGH IJ ",
- " w9:;<=>?@ AB CDEFGH IJ ",
- " x9:;<=>?@ AB CDEFGH IJ ",
- " y9:;<=>?@ AB CDEFGH IJ ",
- " z:;<=>?@ AB CDEFGH IJ ",
- " {:;<=>?@ AB CDEFGH IJ ",
- " |;<=>?@ AB CDEFGH IJ ",
- " };<=>?@ AB CDEFGH IJ ",
- " ~;<=>?@ AB CDEFGH IJ ",
- " \x7F=>?@ AB CDEFGH IJ ",
- "\x80456789:;<=>?@ AB CDEFGH IJ\x81",
- " \x82 EFGH IJ ",
- " \x83 EFGH IJ ",
- " ",
- " \x84 GH IJ ",
- " \x85 GH IJ ",
- " i \x86 ",
- " i \x87 ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- "o456789:;<=>?@ AB\x8CqCDEFGH IJ ",
- " ",
- " "
- ];
- XPathParser.productions = [
- [1, 1, 2],
- [2, 1, 3],
- [3, 1, 4],
- [3, 3, 3, -9, 4],
- [4, 1, 5],
- [4, 3, 4, -8, 5],
- [5, 1, 6],
- [5, 3, 5, -22, 6],
- [5, 3, 5, -5, 6],
- [6, 1, 7],
- [6, 3, 6, -23, 7],
- [6, 3, 6, -24, 7],
- [6, 3, 6, -6, 7],
- [6, 3, 6, -7, 7],
- [7, 1, 8],
- [7, 3, 7, -25, 8],
- [7, 3, 7, -26, 8],
- [8, 1, 9],
- [8, 3, 8, -12, 9],
- [8, 3, 8, -11, 9],
- [8, 3, 8, -10, 9],
- [9, 1, 10],
- [9, 2, -26, 9],
- [10, 1, 11],
- [10, 3, 10, -27, 11],
- [11, 1, 12],
- [11, 1, 13],
- [11, 3, 13, -28, 14],
- [11, 3, 13, -4, 14],
- [13, 1, 15],
- [13, 2, 13, 16],
- [15, 1, 17],
- [15, 3, -29, 2, -30],
- [15, 1, -15],
- [15, 1, -16],
- [15, 1, 18],
- [18, 3, -13, -29, -30],
- [18, 4, -13, -29, 19, -30],
- [19, 1, 20],
- [19, 3, 20, -31, 19],
- [20, 1, 2],
- [12, 1, 14],
- [12, 1, 21],
- [21, 1, -28],
- [21, 2, -28, 14],
- [21, 1, 22],
- [14, 1, 23],
- [14, 3, 14, -28, 23],
- [14, 1, 24],
- [23, 2, 25, 26],
- [23, 1, 26],
- [23, 3, 25, 26, 27],
- [23, 2, 26, 27],
- [23, 1, 28],
- [27, 1, 16],
- [27, 2, 16, 27],
- [25, 2, -14, -3],
- [25, 1, -32],
- [26, 1, 29],
- [26, 3, -20, -29, -30],
- [26, 4, -21, -29, -15, -30],
- [16, 3, -33, 30, -34],
- [30, 1, 2],
- [22, 2, -4, 14],
- [24, 3, 14, -4, 23],
- [28, 1, -35],
- [28, 1, -2],
- [17, 2, -36, -18],
- [29, 1, -17],
- [29, 1, -19],
- [29, 1, -18]
- ];
- XPathParser.DOUBLEDOT = 2;
- XPathParser.DOUBLECOLON = 3;
- XPathParser.DOUBLESLASH = 4;
- XPathParser.NOTEQUAL = 5;
- XPathParser.LESSTHANOREQUAL = 6;
- XPathParser.GREATERTHANOREQUAL = 7;
- XPathParser.AND = 8;
- XPathParser.OR = 9;
- XPathParser.MOD = 10;
- XPathParser.DIV = 11;
- XPathParser.MULTIPLYOPERATOR = 12;
- XPathParser.FUNCTIONNAME = 13;
- XPathParser.AXISNAME = 14;
- XPathParser.LITERAL = 15;
- XPathParser.NUMBER = 16;
- XPathParser.ASTERISKNAMETEST = 17;
- XPathParser.QNAME = 18;
- XPathParser.NCNAMECOLONASTERISK = 19;
- XPathParser.NODETYPE = 20;
- XPathParser.PROCESSINGINSTRUCTIONWITHLITERAL = 21;
- XPathParser.EQUALS = 22;
- XPathParser.LESSTHAN = 23;
- XPathParser.GREATERTHAN = 24;
- XPathParser.PLUS = 25;
- XPathParser.MINUS = 26;
- XPathParser.BAR = 27;
- XPathParser.SLASH = 28;
- XPathParser.LEFTPARENTHESIS = 29;
- XPathParser.RIGHTPARENTHESIS = 30;
- XPathParser.COMMA = 31;
- XPathParser.AT = 32;
- XPathParser.LEFTBRACKET = 33;
- XPathParser.RIGHTBRACKET = 34;
- XPathParser.DOT = 35;
- XPathParser.DOLLAR = 36;
- XPathParser.prototype.tokenize = function(s1) {
- var types = [];
- var values = [];
- var s = s1 + "\0";
- var pos = 0;
- var c = s.charAt(pos++);
- while (1) {
- while (c == " " || c == " " || c == "\r" || c == "\n") {
- c = s.charAt(pos++);
- }
- if (c == "\0" || pos >= s.length) {
- break;
- }
- if (c == "(") {
- types.push(XPathParser.LEFTPARENTHESIS);
- values.push(c);
- c = s.charAt(pos++);
- continue;
- }
- if (c == ")") {
- types.push(XPathParser.RIGHTPARENTHESIS);
- values.push(c);
- c = s.charAt(pos++);
- continue;
- }
- if (c == "[") {
- types.push(XPathParser.LEFTBRACKET);
- values.push(c);
- c = s.charAt(pos++);
- continue;
- }
- if (c == "]") {
- types.push(XPathParser.RIGHTBRACKET);
- values.push(c);
- c = s.charAt(pos++);
- continue;
- }
- if (c == "@") {
- types.push(XPathParser.AT);
- values.push(c);
- c = s.charAt(pos++);
- continue;
- }
- if (c == ",") {
- types.push(XPathParser.COMMA);
- values.push(c);
- c = s.charAt(pos++);
- continue;
- }
- if (c == "|") {
- types.push(XPathParser.BAR);
- values.push(c);
- c = s.charAt(pos++);
- continue;
- }
- if (c == "+") {
- types.push(XPathParser.PLUS);
- values.push(c);
- c = s.charAt(pos++);
- continue;
- }
- if (c == "-") {
- types.push(XPathParser.MINUS);
- values.push(c);
- c = s.charAt(pos++);
- continue;
- }
- if (c == "=") {
- types.push(XPathParser.EQUALS);
- values.push(c);
- c = s.charAt(pos++);
- continue;
- }
- if (c == "$") {
- types.push(XPathParser.DOLLAR);
- values.push(c);
- c = s.charAt(pos++);
- continue;
- }
- if (c == ".") {
- c = s.charAt(pos++);
- if (c == ".") {
- types.push(XPathParser.DOUBLEDOT);
- values.push("..");
- c = s.charAt(pos++);
- continue;
- }
- if (c >= "0" && c <= "9") {
- var number = "." + c;
- c = s.charAt(pos++);
- while (c >= "0" && c <= "9") {
- number += c;
- c = s.charAt(pos++);
- }
- types.push(XPathParser.NUMBER);
- values.push(number);
- continue;
- }
- types.push(XPathParser.DOT);
- values.push(".");
- continue;
- }
- if (c == "'" || c == '"') {
- var delimiter = c;
- var literal = "";
- while (pos < s.length && (c = s.charAt(pos)) !== delimiter) {
- literal += c;
- pos += 1;
- }
- if (c !== delimiter) {
- throw XPathException.fromMessage("Unterminated string literal: " + delimiter + literal);
- }
- pos += 1;
- types.push(XPathParser.LITERAL);
- values.push(literal);
- c = s.charAt(pos++);
- continue;
- }
- if (c >= "0" && c <= "9") {
- var number = c;
- c = s.charAt(pos++);
- while (c >= "0" && c <= "9") {
- number += c;
- c = s.charAt(pos++);
- }
- if (c == ".") {
- if (s.charAt(pos) >= "0" && s.charAt(pos) <= "9") {
- number += c;
- number += s.charAt(pos++);
- c = s.charAt(pos++);
- while (c >= "0" && c <= "9") {
- number += c;
- c = s.charAt(pos++);
- }
- }
- }
- types.push(XPathParser.NUMBER);
- values.push(number);
- continue;
- }
- if (c == "*") {
- if (types.length > 0) {
- var last = types[types.length - 1];
- if (last != XPathParser.AT && last != XPathParser.DOUBLECOLON && last != XPathParser.LEFTPARENTHESIS && last != XPathParser.LEFTBRACKET && last != XPathParser.AND && last != XPathParser.OR && last != XPathParser.MOD && last != XPathParser.DIV && last != XPathParser.MULTIPLYOPERATOR && last != XPathParser.SLASH && last != XPathParser.DOUBLESLASH && last != XPathParser.BAR && last != XPathParser.PLUS && last != XPathParser.MINUS && last != XPathParser.EQUALS && last != XPathParser.NOTEQUAL && last != XPathParser.LESSTHAN && last != XPathParser.LESSTHANOREQUAL && last != XPathParser.GREATERTHAN && last != XPathParser.GREATERTHANOREQUAL) {
- types.push(XPathParser.MULTIPLYOPERATOR);
- values.push(c);
- c = s.charAt(pos++);
- continue;
- }
- }
- types.push(XPathParser.ASTERISKNAMETEST);
- values.push(c);
- c = s.charAt(pos++);
- continue;
- }
- if (c == ":") {
- if (s.charAt(pos) == ":") {
- types.push(XPathParser.DOUBLECOLON);
- values.push("::");
- pos++;
- c = s.charAt(pos++);
- continue;
- }
- }
- if (c == "/") {
- c = s.charAt(pos++);
- if (c == "/") {
- types.push(XPathParser.DOUBLESLASH);
- values.push("//");
- c = s.charAt(pos++);
- continue;
- }
- types.push(XPathParser.SLASH);
- values.push("/");
- continue;
- }
- if (c == "!") {
- if (s.charAt(pos) == "=") {
- types.push(XPathParser.NOTEQUAL);
- values.push("!=");
- pos++;
- c = s.charAt(pos++);
- continue;
- }
- }
- if (c == "<") {
- if (s.charAt(pos) == "=") {
- types.push(XPathParser.LESSTHANOREQUAL);
- values.push("<=");
- pos++;
- c = s.charAt(pos++);
- continue;
- }
- types.push(XPathParser.LESSTHAN);
- values.push("<");
- c = s.charAt(pos++);
- continue;
- }
- if (c == ">") {
- if (s.charAt(pos) == "=") {
- types.push(XPathParser.GREATERTHANOREQUAL);
- values.push(">=");
- pos++;
- c = s.charAt(pos++);
- continue;
- }
- types.push(XPathParser.GREATERTHAN);
- values.push(">");
- c = s.charAt(pos++);
- continue;
- }
- if (c == "_" || Utilities.isLetter(c.charCodeAt(0))) {
- var name2 = c;
- c = s.charAt(pos++);
- while (Utilities.isNCNameChar(c.charCodeAt(0))) {
- name2 += c;
- c = s.charAt(pos++);
- }
- if (types.length > 0) {
- var last = types[types.length - 1];
- if (last != XPathParser.AT && last != XPathParser.DOUBLECOLON && last != XPathParser.LEFTPARENTHESIS && last != XPathParser.LEFTBRACKET && last != XPathParser.AND && last != XPathParser.OR && last != XPathParser.MOD && last != XPathParser.DIV && last != XPathParser.MULTIPLYOPERATOR && last != XPathParser.SLASH && last != XPathParser.DOUBLESLASH && last != XPathParser.BAR && last != XPathParser.PLUS && last != XPathParser.MINUS && last != XPathParser.EQUALS && last != XPathParser.NOTEQUAL && last != XPathParser.LESSTHAN && last != XPathParser.LESSTHANOREQUAL && last != XPathParser.GREATERTHAN && last != XPathParser.GREATERTHANOREQUAL) {
- if (name2 == "and") {
- types.push(XPathParser.AND);
- values.push(name2);
- continue;
- }
- if (name2 == "or") {
- types.push(XPathParser.OR);
- values.push(name2);
- continue;
- }
- if (name2 == "mod") {
- types.push(XPathParser.MOD);
- values.push(name2);
- continue;
- }
- if (name2 == "div") {
- types.push(XPathParser.DIV);
- values.push(name2);
- continue;
- }
- }
- }
- if (c == ":") {
- if (s.charAt(pos) == "*") {
- types.push(XPathParser.NCNAMECOLONASTERISK);
- values.push(name2 + ":*");
- pos++;
- c = s.charAt(pos++);
- continue;
- }
- if (s.charAt(pos) == "_" || Utilities.isLetter(s.charCodeAt(pos))) {
- name2 += ":";
- c = s.charAt(pos++);
- while (Utilities.isNCNameChar(c.charCodeAt(0))) {
- name2 += c;
- c = s.charAt(pos++);
- }
- if (c == "(") {
- types.push(XPathParser.FUNCTIONNAME);
- values.push(name2);
- continue;
- }
- types.push(XPathParser.QNAME);
- values.push(name2);
- continue;
- }
- if (s.charAt(pos) == ":") {
- types.push(XPathParser.AXISNAME);
- values.push(name2);
- continue;
- }
- }
- if (c == "(") {
- if (name2 == "comment" || name2 == "text" || name2 == "node") {
- types.push(XPathParser.NODETYPE);
- values.push(name2);
- continue;
- }
- if (name2 == "processing-instruction") {
- if (s.charAt(pos) == ")") {
- types.push(XPathParser.NODETYPE);
- } else {
- types.push(XPathParser.PROCESSINGINSTRUCTIONWITHLITERAL);
- }
- values.push(name2);
- continue;
- }
- types.push(XPathParser.FUNCTIONNAME);
- values.push(name2);
- continue;
- }
- types.push(XPathParser.QNAME);
- values.push(name2);
- continue;
- }
- throw new Error("Unexpected character " + c);
- }
- types.push(1);
- values.push("[EOF]");
- return [types, values];
- };
- XPathParser.SHIFT = "s";
- XPathParser.REDUCE = "r";
- XPathParser.ACCEPT = "a";
- XPathParser.prototype.parse = function(s) {
- if (!s) {
- throw new Error("XPath expression unspecified.");
- }
- if (typeof s !== "string") {
- throw new Error("XPath expression must be a string.");
- }
- var types;
- var values;
- var res = this.tokenize(s);
- if (res == void 0) {
- return void 0;
- }
- types = res[0];
- values = res[1];
- var tokenPos = 0;
- var state = [];
- var tokenType = [];
- var tokenValue = [];
- var s;
- var a;
- var t;
- state.push(0);
- tokenType.push(1);
- tokenValue.push("_S");
- a = types[tokenPos];
- t = values[tokenPos++];
- while (1) {
- s = state[state.length - 1];
- switch (XPathParser.actionTable[s].charAt(a - 1)) {
- case XPathParser.SHIFT:
- tokenType.push(-a);
- tokenValue.push(t);
- state.push(XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32);
- a = types[tokenPos];
- t = values[tokenPos++];
- break;
- case XPathParser.REDUCE:
- var num = XPathParser.productions[XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32][1];
- var rhs = [];
- for (var i = 0; i < num; i++) {
- tokenType.pop();
- rhs.unshift(tokenValue.pop());
- state.pop();
- }
- var s_ = state[state.length - 1];
- tokenType.push(XPathParser.productions[XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32][0]);
- if (this.reduceActions[XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32] == void 0) {
- tokenValue.push(rhs[0]);
- } else {
- tokenValue.push(this.reduceActions[XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32](rhs));
- }
- state.push(XPathParser.gotoTable[s_].charCodeAt(XPathParser.productions[XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32][0] - 2) - 33);
- break;
- case XPathParser.ACCEPT:
- return new XPath(tokenValue.pop());
- default:
- throw new Error("XPath parse error");
- }
- }
- };
- XPath.prototype = new Object();
- XPath.prototype.constructor = XPath;
- XPath.superclass = Object.prototype;
- function XPath(e) {
- this.expression = e;
- }
- XPath.prototype.toString = function() {
- return this.expression.toString();
- };
- function setIfUnset(obj, prop, value) {
- if (!(prop in obj)) {
- obj[prop] = value;
- }
- }
- XPath.prototype.evaluate = function(c) {
- var node = c.expressionContextNode;
- if (!(isNil(node) || isNodeLike(node))) {
- throw new Error("Context node does not appear to be a valid DOM node.");
- }
- c.contextNode = c.expressionContextNode;
- c.contextSize = 1;
- c.contextPosition = 1;
- if (c.isHtml) {
- setIfUnset(c, "caseInsensitive", true);
- setIfUnset(c, "allowAnyNamespaceForNoPrefix", true);
- }
- setIfUnset(c, "caseInsensitive", false);
- return this.expression.evaluate(c);
- };
- XPath.XML_NAMESPACE_URI = "http://www.w3.org/XML/1998/namespace";
- XPath.XMLNS_NAMESPACE_URI = "http://www.w3.org/2000/xmlns/";
- Expression.prototype = new Object();
- Expression.prototype.constructor = Expression;
- Expression.superclass = Object.prototype;
- function Expression() {
- }
- Expression.prototype.init = function() {
- };
- Expression.prototype.toString = function() {
- return "";
- };
- Expression.prototype.evaluate = function(c) {
- throw new Error("Could not evaluate expression.");
- };
- UnaryOperation.prototype = new Expression();
- UnaryOperation.prototype.constructor = UnaryOperation;
- UnaryOperation.superclass = Expression.prototype;
- function UnaryOperation(rhs) {
- if (arguments.length > 0) {
- this.init(rhs);
- }
- }
- UnaryOperation.prototype.init = function(rhs) {
- this.rhs = rhs;
- };
- UnaryMinusOperation.prototype = new UnaryOperation();
- UnaryMinusOperation.prototype.constructor = UnaryMinusOperation;
- UnaryMinusOperation.superclass = UnaryOperation.prototype;
- function UnaryMinusOperation(rhs) {
- if (arguments.length > 0) {
- this.init(rhs);
- }
- }
- UnaryMinusOperation.prototype.init = function(rhs) {
- UnaryMinusOperation.superclass.init.call(this, rhs);
- };
- UnaryMinusOperation.prototype.evaluate = function(c) {
- return this.rhs.evaluate(c).number().negate();
- };
- UnaryMinusOperation.prototype.toString = function() {
- return "-" + this.rhs.toString();
- };
- BinaryOperation.prototype = new Expression();
- BinaryOperation.prototype.constructor = BinaryOperation;
- BinaryOperation.superclass = Expression.prototype;
- function BinaryOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
- }
- BinaryOperation.prototype.init = function(lhs, rhs) {
- this.lhs = lhs;
- this.rhs = rhs;
- };
- OrOperation.prototype = new BinaryOperation();
- OrOperation.prototype.constructor = OrOperation;
- OrOperation.superclass = BinaryOperation.prototype;
- function OrOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
- }
- OrOperation.prototype.init = function(lhs, rhs) {
- OrOperation.superclass.init.call(this, lhs, rhs);
- };
- OrOperation.prototype.toString = function() {
- return "(" + this.lhs.toString() + " or " + this.rhs.toString() + ")";
- };
- OrOperation.prototype.evaluate = function(c) {
- var b = this.lhs.evaluate(c).bool();
- if (b.booleanValue()) {
- return b;
- }
- return this.rhs.evaluate(c).bool();
- };
- AndOperation.prototype = new BinaryOperation();
- AndOperation.prototype.constructor = AndOperation;
- AndOperation.superclass = BinaryOperation.prototype;
- function AndOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
- }
- AndOperation.prototype.init = function(lhs, rhs) {
- AndOperation.superclass.init.call(this, lhs, rhs);
- };
- AndOperation.prototype.toString = function() {
- return "(" + this.lhs.toString() + " and " + this.rhs.toString() + ")";
- };
- AndOperation.prototype.evaluate = function(c) {
- var b = this.lhs.evaluate(c).bool();
- if (!b.booleanValue()) {
- return b;
- }
- return this.rhs.evaluate(c).bool();
- };
- EqualsOperation.prototype = new BinaryOperation();
- EqualsOperation.prototype.constructor = EqualsOperation;
- EqualsOperation.superclass = BinaryOperation.prototype;
- function EqualsOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
- }
- EqualsOperation.prototype.init = function(lhs, rhs) {
- EqualsOperation.superclass.init.call(this, lhs, rhs);
- };
- EqualsOperation.prototype.toString = function() {
- return "(" + this.lhs.toString() + " = " + this.rhs.toString() + ")";
- };
- EqualsOperation.prototype.evaluate = function(c) {
- return this.lhs.evaluate(c).equals(this.rhs.evaluate(c));
- };
- NotEqualOperation.prototype = new BinaryOperation();
- NotEqualOperation.prototype.constructor = NotEqualOperation;
- NotEqualOperation.superclass = BinaryOperation.prototype;
- function NotEqualOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
- }
- NotEqualOperation.prototype.init = function(lhs, rhs) {
- NotEqualOperation.superclass.init.call(this, lhs, rhs);
- };
- NotEqualOperation.prototype.toString = function() {
- return "(" + this.lhs.toString() + " != " + this.rhs.toString() + ")";
- };
- NotEqualOperation.prototype.evaluate = function(c) {
- return this.lhs.evaluate(c).notequal(this.rhs.evaluate(c));
- };
- LessThanOperation.prototype = new BinaryOperation();
- LessThanOperation.prototype.constructor = LessThanOperation;
- LessThanOperation.superclass = BinaryOperation.prototype;
- function LessThanOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
- }
- LessThanOperation.prototype.init = function(lhs, rhs) {
- LessThanOperation.superclass.init.call(this, lhs, rhs);
- };
- LessThanOperation.prototype.evaluate = function(c) {
- return this.lhs.evaluate(c).lessthan(this.rhs.evaluate(c));
- };
- LessThanOperation.prototype.toString = function() {
- return "(" + this.lhs.toString() + " < " + this.rhs.toString() + ")";
- };
- GreaterThanOperation.prototype = new BinaryOperation();
- GreaterThanOperation.prototype.constructor = GreaterThanOperation;
- GreaterThanOperation.superclass = BinaryOperation.prototype;
- function GreaterThanOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
- }
- GreaterThanOperation.prototype.init = function(lhs, rhs) {
- GreaterThanOperation.superclass.init.call(this, lhs, rhs);
- };
- GreaterThanOperation.prototype.evaluate = function(c) {
- return this.lhs.evaluate(c).greaterthan(this.rhs.evaluate(c));
- };
- GreaterThanOperation.prototype.toString = function() {
- return "(" + this.lhs.toString() + " > " + this.rhs.toString() + ")";
- };
- LessThanOrEqualOperation.prototype = new BinaryOperation();
- LessThanOrEqualOperation.prototype.constructor = LessThanOrEqualOperation;
- LessThanOrEqualOperation.superclass = BinaryOperation.prototype;
- function LessThanOrEqualOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
- }
- LessThanOrEqualOperation.prototype.init = function(lhs, rhs) {
- LessThanOrEqualOperation.superclass.init.call(this, lhs, rhs);
- };
- LessThanOrEqualOperation.prototype.evaluate = function(c) {
- return this.lhs.evaluate(c).lessthanorequal(this.rhs.evaluate(c));
- };
- LessThanOrEqualOperation.prototype.toString = function() {
- return "(" + this.lhs.toString() + " <= " + this.rhs.toString() + ")";
- };
- GreaterThanOrEqualOperation.prototype = new BinaryOperation();
- GreaterThanOrEqualOperation.prototype.constructor = GreaterThanOrEqualOperation;
- GreaterThanOrEqualOperation.superclass = BinaryOperation.prototype;
- function GreaterThanOrEqualOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
- }
- GreaterThanOrEqualOperation.prototype.init = function(lhs, rhs) {
- GreaterThanOrEqualOperation.superclass.init.call(this, lhs, rhs);
- };
- GreaterThanOrEqualOperation.prototype.evaluate = function(c) {
- return this.lhs.evaluate(c).greaterthanorequal(this.rhs.evaluate(c));
- };
- GreaterThanOrEqualOperation.prototype.toString = function() {
- return "(" + this.lhs.toString() + " >= " + this.rhs.toString() + ")";
- };
- PlusOperation.prototype = new BinaryOperation();
- PlusOperation.prototype.constructor = PlusOperation;
- PlusOperation.superclass = BinaryOperation.prototype;
- function PlusOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
- }
- PlusOperation.prototype.init = function(lhs, rhs) {
- PlusOperation.superclass.init.call(this, lhs, rhs);
- };
- PlusOperation.prototype.evaluate = function(c) {
- return this.lhs.evaluate(c).number().plus(this.rhs.evaluate(c).number());
- };
- PlusOperation.prototype.toString = function() {
- return "(" + this.lhs.toString() + " + " + this.rhs.toString() + ")";
- };
- MinusOperation.prototype = new BinaryOperation();
- MinusOperation.prototype.constructor = MinusOperation;
- MinusOperation.superclass = BinaryOperation.prototype;
- function MinusOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
- }
- MinusOperation.prototype.init = function(lhs, rhs) {
- MinusOperation.superclass.init.call(this, lhs, rhs);
- };
- MinusOperation.prototype.evaluate = function(c) {
- return this.lhs.evaluate(c).number().minus(this.rhs.evaluate(c).number());
- };
- MinusOperation.prototype.toString = function() {
- return "(" + this.lhs.toString() + " - " + this.rhs.toString() + ")";
- };
- MultiplyOperation.prototype = new BinaryOperation();
- MultiplyOperation.prototype.constructor = MultiplyOperation;
- MultiplyOperation.superclass = BinaryOperation.prototype;
- function MultiplyOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
- }
- MultiplyOperation.prototype.init = function(lhs, rhs) {
- MultiplyOperation.superclass.init.call(this, lhs, rhs);
- };
- MultiplyOperation.prototype.evaluate = function(c) {
- return this.lhs.evaluate(c).number().multiply(this.rhs.evaluate(c).number());
- };
- MultiplyOperation.prototype.toString = function() {
- return "(" + this.lhs.toString() + " * " + this.rhs.toString() + ")";
- };
- DivOperation.prototype = new BinaryOperation();
- DivOperation.prototype.constructor = DivOperation;
- DivOperation.superclass = BinaryOperation.prototype;
- function DivOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
- }
- DivOperation.prototype.init = function(lhs, rhs) {
- DivOperation.superclass.init.call(this, lhs, rhs);
- };
- DivOperation.prototype.evaluate = function(c) {
- return this.lhs.evaluate(c).number().div(this.rhs.evaluate(c).number());
- };
- DivOperation.prototype.toString = function() {
- return "(" + this.lhs.toString() + " div " + this.rhs.toString() + ")";
- };
- ModOperation.prototype = new BinaryOperation();
- ModOperation.prototype.constructor = ModOperation;
- ModOperation.superclass = BinaryOperation.prototype;
- function ModOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
- }
- ModOperation.prototype.init = function(lhs, rhs) {
- ModOperation.superclass.init.call(this, lhs, rhs);
- };
- ModOperation.prototype.evaluate = function(c) {
- return this.lhs.evaluate(c).number().mod(this.rhs.evaluate(c).number());
- };
- ModOperation.prototype.toString = function() {
- return "(" + this.lhs.toString() + " mod " + this.rhs.toString() + ")";
- };
- BarOperation.prototype = new BinaryOperation();
- BarOperation.prototype.constructor = BarOperation;
- BarOperation.superclass = BinaryOperation.prototype;
- function BarOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
- }
- BarOperation.prototype.init = function(lhs, rhs) {
- BarOperation.superclass.init.call(this, lhs, rhs);
- };
- BarOperation.prototype.evaluate = function(c) {
- return this.lhs.evaluate(c).nodeset().union(this.rhs.evaluate(c).nodeset());
- };
- BarOperation.prototype.toString = function() {
- return map(toString, [this.lhs, this.rhs]).join(" | ");
- };
- PathExpr.prototype = new Expression();
- PathExpr.prototype.constructor = PathExpr;
- PathExpr.superclass = Expression.prototype;
- function PathExpr(filter2, filterPreds, locpath) {
- if (arguments.length > 0) {
- this.init(filter2, filterPreds, locpath);
- }
- }
- PathExpr.prototype.init = function(filter2, filterPreds, locpath) {
- PathExpr.superclass.init.call(this);
- this.filter = filter2;
- this.filterPredicates = filterPreds;
- this.locationPath = locpath;
- };
- function findRoot(node) {
- while (node && node.parentNode) {
- node = node.parentNode;
- }
- return node;
- }
- var applyPredicates = function(predicates, c, nodes, reverse) {
- if (predicates.length === 0) {
- return nodes;
- }
- var ctx = c.extend({});
- return reduce(
- function(inNodes, pred) {
- ctx.contextSize = inNodes.length;
- return filter(
- function(node, i) {
- ctx.contextNode = node;
- ctx.contextPosition = i + 1;
- return PathExpr.predicateMatches(pred, ctx);
- },
- inNodes
- );
- },
- sortNodes(nodes, reverse),
- predicates
- );
- };
- PathExpr.getRoot = function(xpc, nodes) {
- var firstNode = nodes[0];
- if (firstNode && firstNode.nodeType === NodeTypes.DOCUMENT_NODE) {
- return firstNode;
- }
- if (xpc.virtualRoot) {
- return xpc.virtualRoot;
- }
- if (!firstNode) {
- throw new Error("Context node not found when determining document root.");
- }
- var ownerDoc = firstNode.ownerDocument;
- if (ownerDoc) {
- return ownerDoc;
- }
- var n = firstNode;
- while (n.parentNode != null) {
- n = n.parentNode;
- }
- return n;
- };
- var getPrefixForNamespaceNode = function(attrNode) {
- var nm = String(attrNode.name);
- if (nm === "xmlns") {
- return "";
- }
- if (nm.substring(0, 6) === "xmlns:") {
- return nm.substring(6, nm.length);
- }
- return null;
- };
- PathExpr.applyStep = function(step, xpc, node) {
- if (!node) {
- throw new Error("Context node not found when evaluating XPath step: " + step);
- }
- var newNodes = [];
- xpc.contextNode = node;
- switch (step.axis) {
- case Step.ANCESTOR:
- if (xpc.contextNode === xpc.virtualRoot) {
- break;
- }
- var m;
- if (xpc.contextNode.nodeType == NodeTypes.ATTRIBUTE_NODE) {
- m = PathExpr.getOwnerElement(xpc.contextNode);
- } else {
- m = xpc.contextNode.parentNode;
- }
- while (m != null) {
- if (step.nodeTest.matches(m, xpc)) {
- newNodes.push(m);
- }
- if (m === xpc.virtualRoot) {
- break;
- }
- m = m.parentNode;
- }
- break;
- case Step.ANCESTORORSELF:
- for (var m = xpc.contextNode; m != null; m = m.nodeType == NodeTypes.ATTRIBUTE_NODE ? PathExpr.getOwnerElement(m) : m.parentNode) {
- if (step.nodeTest.matches(m, xpc)) {
- newNodes.push(m);
- }
- if (m === xpc.virtualRoot) {
- break;
- }
- }
- break;
- case Step.ATTRIBUTE:
- var nnm = xpc.contextNode.attributes;
- if (nnm != null) {
- for (var k = 0; k < nnm.length; k++) {
- var m = nnm.item(k);
- if (step.nodeTest.matches(m, xpc)) {
- newNodes.push(m);
- }
- }
- }
- break;
- case Step.CHILD:
- for (var m = xpc.contextNode.firstChild; m != null; m = m.nextSibling) {
- if (step.nodeTest.matches(m, xpc)) {
- newNodes.push(m);
- }
- }
- break;
- case Step.DESCENDANT:
- var st = [xpc.contextNode.firstChild];
- while (st.length > 0) {
- for (var m = st.pop(); m != null; ) {
- if (step.nodeTest.matches(m, xpc)) {
- newNodes.push(m);
- }
- if (m.firstChild != null) {
- st.push(m.nextSibling);
- m = m.firstChild;
- } else {
- m = m.nextSibling;
- }
- }
- }
- break;
- case Step.DESCENDANTORSELF:
- if (step.nodeTest.matches(xpc.contextNode, xpc)) {
- newNodes.push(xpc.contextNode);
- }
- var st = [xpc.contextNode.firstChild];
- while (st.length > 0) {
- for (var m = st.pop(); m != null; ) {
- if (step.nodeTest.matches(m, xpc)) {
- newNodes.push(m);
- }
- if (m.firstChild != null) {
- st.push(m.nextSibling);
- m = m.firstChild;
- } else {
- m = m.nextSibling;
- }
- }
- }
- break;
- case Step.FOLLOWING:
- if (xpc.contextNode === xpc.virtualRoot) {
- break;
- }
- var st = [];
- if (xpc.contextNode.firstChild != null) {
- st.unshift(xpc.contextNode.firstChild);
- } else {
- st.unshift(xpc.contextNode.nextSibling);
- }
- for (var m = xpc.contextNode.parentNode; m != null && m.nodeType != NodeTypes.DOCUMENT_NODE && m !== xpc.virtualRoot; m = m.parentNode) {
- st.unshift(m.nextSibling);
- }
- do {
- for (var m = st.pop(); m != null; ) {
- if (step.nodeTest.matches(m, xpc)) {
- newNodes.push(m);
- }
- if (m.firstChild != null) {
- st.push(m.nextSibling);
- m = m.firstChild;
- } else {
- m = m.nextSibling;
- }
- }
- } while (st.length > 0);
- break;
- case Step.FOLLOWINGSIBLING:
- if (xpc.contextNode === xpc.virtualRoot) {
- break;
- }
- for (var m = xpc.contextNode.nextSibling; m != null; m = m.nextSibling) {
- if (step.nodeTest.matches(m, xpc)) {
- newNodes.push(m);
- }
- }
- break;
- case Step.NAMESPACE:
- var nodes = {};
- if (xpc.contextNode.nodeType == NodeTypes.ELEMENT_NODE) {
- nodes["xml"] = new XPathNamespace("xml", null, XPath.XML_NAMESPACE_URI, xpc.contextNode);
- for (var m = xpc.contextNode; m != null && m.nodeType == NodeTypes.ELEMENT_NODE; m = m.parentNode) {
- for (var k = 0; k < m.attributes.length; k++) {
- var attr = m.attributes.item(k);
- var pre = getPrefixForNamespaceNode(attr);
- if (pre != null && nodes[pre] == void 0) {
- nodes[pre] = new XPathNamespace(pre, attr, attr.value, xpc.contextNode);
- }
- }
- }
- for (var pre in nodes) {
- var node = nodes[pre];
- if (step.nodeTest.matches(node, xpc)) {
- newNodes.push(node);
- }
- }
- }
- break;
- case Step.PARENT:
- m = null;
- if (xpc.contextNode !== xpc.virtualRoot) {
- if (xpc.contextNode.nodeType == NodeTypes.ATTRIBUTE_NODE) {
- m = PathExpr.getOwnerElement(xpc.contextNode);
- } else {
- m = xpc.contextNode.parentNode;
- }
- }
- if (m != null && step.nodeTest.matches(m, xpc)) {
- newNodes.push(m);
- }
- break;
- case Step.PRECEDING:
- var st;
- if (xpc.virtualRoot != null) {
- st = [xpc.virtualRoot];
- } else {
- st = [findRoot(xpc.contextNode)];
- }
- outer: while (st.length > 0) {
- for (var m = st.pop(); m != null; ) {
- if (m == xpc.contextNode) {
- break outer;
- }
- if (step.nodeTest.matches(m, xpc)) {
- newNodes.unshift(m);
- }
- if (m.firstChild != null) {
- st.push(m.nextSibling);
- m = m.firstChild;
- } else {
- m = m.nextSibling;
- }
- }
- }
- break;
- case Step.PRECEDINGSIBLING:
- if (xpc.contextNode === xpc.virtualRoot) {
- break;
- }
- for (var m = xpc.contextNode.previousSibling; m != null; m = m.previousSibling) {
- if (step.nodeTest.matches(m, xpc)) {
- newNodes.push(m);
- }
- }
- break;
- case Step.SELF:
- if (step.nodeTest.matches(xpc.contextNode, xpc)) {
- newNodes.push(xpc.contextNode);
- }
- break;
- default:
- }
- return newNodes;
- };
- function applyStepWithPredicates(step, xpc, node) {
- return applyPredicates(
- step.predicates,
- xpc,
- PathExpr.applyStep(step, xpc, node),
- includes(REVERSE_AXES, step.axis)
- );
- }
- function applyStepToNodes(context, nodes, step) {
- return flatten(
- map(
- applyStepWithPredicates.bind(null, step, context),
- nodes
- )
- );
- }
- PathExpr.applySteps = function(steps, xpc, nodes) {
- return reduce(
- applyStepToNodes.bind(null, xpc),
- nodes,
- steps
- );
- };
- PathExpr.prototype.applyFilter = function(c, xpc) {
- if (!this.filter) {
- return { nodes: [c.contextNode] };
- }
- var ns = this.filter.evaluate(c);
- if (!Utilities.instance_of(ns, XNodeSet)) {
- if (this.filterPredicates != null && this.filterPredicates.length > 0 || this.locationPath != null) {
- throw new Error("Path expression filter must evaluate to a nodeset if predicates or location path are used");
- }
- return { nonNodes: ns };
- }
- return {
- nodes: applyPredicates(
- this.filterPredicates || [],
- xpc,
- ns.toUnsortedArray(),
- false
- // reverse
- )
- };
- };
- PathExpr.applyLocationPath = function(locationPath, xpc, nodes) {
- if (!locationPath) {
- return nodes;
- }
- var startNodes = locationPath.absolute ? [PathExpr.getRoot(xpc, nodes)] : nodes;
- return PathExpr.applySteps(locationPath.steps, xpc, startNodes);
- };
- PathExpr.prototype.evaluate = function(c) {
- var xpc = assign(new XPathContext(), c);
- var filterResult = this.applyFilter(c, xpc);
- if ("nonNodes" in filterResult) {
- return filterResult.nonNodes;
- }
- var ns = new XNodeSet();
- ns.addArray(PathExpr.applyLocationPath(this.locationPath, xpc, filterResult.nodes));
- return ns;
- };
- PathExpr.predicateMatches = function(pred, c) {
- var res = pred.evaluate(c);
- return Utilities.instance_of(res, XNumber) ? c.contextPosition === res.numberValue() : res.booleanValue();
- };
- PathExpr.predicateString = function(predicate) {
- return wrap("[", "]", predicate.toString());
- };
- PathExpr.predicatesString = function(predicates) {
- return join(
- "",
- map(PathExpr.predicateString, predicates)
- );
- };
- PathExpr.prototype.toString = function() {
- if (this.filter != void 0) {
- var filterStr = toString(this.filter);
- if (Utilities.instance_of(this.filter, XString)) {
- return wrap("'", "'", filterStr);
- }
- if (this.filterPredicates != void 0 && this.filterPredicates.length) {
- return wrap("(", ")", filterStr) + PathExpr.predicatesString(this.filterPredicates);
- }
- if (this.locationPath != void 0) {
- return filterStr + (this.locationPath.absolute ? "" : "/") + toString(this.locationPath);
- }
- return filterStr;
- }
- return toString(this.locationPath);
- };
- PathExpr.getOwnerElement = function(n) {
- if (n.ownerElement) {
- return n.ownerElement;
- }
- try {
- if (n.selectSingleNode) {
- return n.selectSingleNode("..");
- }
- } catch (e) {
- }
- var doc = n.nodeType == NodeTypes.DOCUMENT_NODE ? n : n.ownerDocument;
- var elts = doc.getElementsByTagName("*");
- for (var i = 0; i < elts.length; i++) {
- var elt = elts.item(i);
- var nnm = elt.attributes;
- for (var j = 0; j < nnm.length; j++) {
- var an = nnm.item(j);
- if (an === n) {
- return elt;
- }
- }
- }
- return null;
- };
- LocationPath.prototype = new Object();
- LocationPath.prototype.constructor = LocationPath;
- LocationPath.superclass = Object.prototype;
- function LocationPath(abs, steps) {
- if (arguments.length > 0) {
- this.init(abs, steps);
- }
- }
- LocationPath.prototype.init = function(abs, steps) {
- this.absolute = abs;
- this.steps = steps;
- };
- LocationPath.prototype.toString = function() {
- return (this.absolute ? "/" : "") + map(toString, this.steps).join("/");
- };
- Step.prototype = new Object();
- Step.prototype.constructor = Step;
- Step.superclass = Object.prototype;
- function Step(axis, nodetest, preds) {
- if (arguments.length > 0) {
- this.init(axis, nodetest, preds);
- }
- }
- Step.prototype.init = function(axis, nodetest, preds) {
- this.axis = axis;
- this.nodeTest = nodetest;
- this.predicates = preds;
- };
- Step.prototype.toString = function() {
- return Step.STEPNAMES[this.axis] + "::" + this.nodeTest.toString() + PathExpr.predicatesString(this.predicates);
- };
- Step.ANCESTOR = 0;
- Step.ANCESTORORSELF = 1;
- Step.ATTRIBUTE = 2;
- Step.CHILD = 3;
- Step.DESCENDANT = 4;
- Step.DESCENDANTORSELF = 5;
- Step.FOLLOWING = 6;
- Step.FOLLOWINGSIBLING = 7;
- Step.NAMESPACE = 8;
- Step.PARENT = 9;
- Step.PRECEDING = 10;
- Step.PRECEDINGSIBLING = 11;
- Step.SELF = 12;
- Step.STEPNAMES = reduce(function(acc, x) {
- return acc[x[0]] = x[1], acc;
- }, {}, [
- [Step.ANCESTOR, "ancestor"],
- [Step.ANCESTORORSELF, "ancestor-or-self"],
- [Step.ATTRIBUTE, "attribute"],
- [Step.CHILD, "child"],
- [Step.DESCENDANT, "descendant"],
- [Step.DESCENDANTORSELF, "descendant-or-self"],
- [Step.FOLLOWING, "following"],
- [Step.FOLLOWINGSIBLING, "following-sibling"],
- [Step.NAMESPACE, "namespace"],
- [Step.PARENT, "parent"],
- [Step.PRECEDING, "preceding"],
- [Step.PRECEDINGSIBLING, "preceding-sibling"],
- [Step.SELF, "self"]
- ]);
- var REVERSE_AXES = [
- Step.ANCESTOR,
- Step.ANCESTORORSELF,
- Step.PARENT,
- Step.PRECEDING,
- Step.PRECEDINGSIBLING
- ];
- NodeTest.prototype = new Object();
- NodeTest.prototype.constructor = NodeTest;
- NodeTest.superclass = Object.prototype;
- function NodeTest(type, value) {
- if (arguments.length > 0) {
- this.init(type, value);
- }
- }
- NodeTest.prototype.init = function(type, value) {
- this.type = type;
- this.value = value;
- };
- NodeTest.prototype.toString = function() {
- return "";
- };
- NodeTest.prototype.matches = function(n, xpc) {
- console.warn("unknown node test type");
- };
- NodeTest.NAMETESTANY = 0;
- NodeTest.NAMETESTPREFIXANY = 1;
- NodeTest.NAMETESTQNAME = 2;
- NodeTest.COMMENT = 3;
- NodeTest.TEXT = 4;
- NodeTest.PI = 5;
- NodeTest.NODE = 6;
- NodeTest.isNodeType = function(types) {
- return function(node) {
- return includes(types, node.nodeType);
- };
- };
- NodeTest.makeNodeTestType = function(type, members, ctor) {
- var newType = ctor || function() {
- };
- newType.prototype = new NodeTest(type);
- newType.prototype.constructor = newType;
- assign(newType.prototype, members);
- return newType;
- };
- NodeTest.makeNodeTypeTest = function(type, nodeTypes, stringVal) {
- return new (NodeTest.makeNodeTestType(type, {
- matches: NodeTest.isNodeType(nodeTypes),
- toString: always(stringVal)
- }))();
- };
- NodeTest.hasPrefix = function(node) {
- return node.prefix || (node.nodeName || node.tagName).indexOf(":") !== -1;
- };
- NodeTest.isElementOrAttribute = NodeTest.isNodeType([1, 2]);
- NodeTest.nameSpaceMatches = function(prefix, xpc, n) {
- var nNamespace = n.namespaceURI || "";
- if (!prefix) {
- return !nNamespace || xpc.allowAnyNamespaceForNoPrefix && !NodeTest.hasPrefix(n);
- }
- var ns = xpc.namespaceResolver.getNamespace(prefix, xpc.expressionContextNode);
- if (ns == null) {
- throw new Error("Cannot resolve QName " + prefix);
- }
- return ns === nNamespace;
- };
- NodeTest.localNameMatches = function(localName, xpc, n) {
- var nLocalName = n.localName || n.nodeName;
- return xpc.caseInsensitive ? localName.toLowerCase() === nLocalName.toLowerCase() : localName === nLocalName;
- };
- NodeTest.NameTestPrefixAny = NodeTest.makeNodeTestType(
- NodeTest.NAMETESTPREFIXANY,
- {
- matches: function(n, xpc) {
- return NodeTest.isElementOrAttribute(n) && NodeTest.nameSpaceMatches(this.prefix, xpc, n);
- },
- toString: function() {
- return this.prefix + ":*";
- }
- },
- function NameTestPrefixAny(prefix) {
- this.prefix = prefix;
- }
- );
- NodeTest.NameTestQName = NodeTest.makeNodeTestType(
- NodeTest.NAMETESTQNAME,
- {
- matches: function(n, xpc) {
- return NodeTest.isNodeType(
- [
- NodeTypes.ELEMENT_NODE,
- NodeTypes.ATTRIBUTE_NODE,
- NodeTypes.NAMESPACE_NODE
- ]
- )(n) && NodeTest.nameSpaceMatches(this.prefix, xpc, n) && NodeTest.localNameMatches(this.localName, xpc, n);
- },
- toString: function() {
- return this.name;
- }
- },
- function NameTestQName(name2) {
- var nameParts = name2.split(":");
- this.name = name2;
- this.prefix = nameParts.length > 1 ? nameParts[0] : null;
- this.localName = nameParts[nameParts.length > 1 ? 1 : 0];
- }
- );
- NodeTest.PITest = NodeTest.makeNodeTestType(NodeTest.PI, {
- matches: function(n, xpc) {
- return NodeTest.isNodeType(
- [NodeTypes.PROCESSING_INSTRUCTION_NODE]
- )(n) && (n.target || n.nodeName) === this.name;
- },
- toString: function() {
- return wrap('processing-instruction("', '")', this.name);
- }
- }, function(name2) {
- this.name = name2;
- });
- NodeTest.nameTestAny = NodeTest.makeNodeTypeTest(
- NodeTest.NAMETESTANY,
- [
- NodeTypes.ELEMENT_NODE,
- NodeTypes.ATTRIBUTE_NODE,
- NodeTypes.NAMESPACE_NODE
- ],
- "*"
- );
- NodeTest.textTest = NodeTest.makeNodeTypeTest(
- NodeTest.TEXT,
- [
- NodeTypes.TEXT_NODE,
- NodeTypes.CDATA_SECTION_NODE
- ],
- "text()"
- );
- NodeTest.commentTest = NodeTest.makeNodeTypeTest(
- NodeTest.COMMENT,
- [NodeTypes.COMMENT_NODE],
- "comment()"
- );
- NodeTest.nodeTest = NodeTest.makeNodeTypeTest(
- NodeTest.NODE,
- [
- NodeTypes.ELEMENT_NODE,
- NodeTypes.ATTRIBUTE_NODE,
- NodeTypes.TEXT_NODE,
- NodeTypes.CDATA_SECTION_NODE,
- NodeTypes.PROCESSING_INSTRUCTION_NODE,
- NodeTypes.COMMENT_NODE,
- NodeTypes.DOCUMENT_NODE
- ],
- "node()"
- );
- NodeTest.anyPiTest = NodeTest.makeNodeTypeTest(
- NodeTest.PI,
- [NodeTypes.PROCESSING_INSTRUCTION_NODE],
- "processing-instruction()"
- );
- VariableReference.prototype = new Expression();
- VariableReference.prototype.constructor = VariableReference;
- VariableReference.superclass = Expression.prototype;
- function VariableReference(v) {
- if (arguments.length > 0) {
- this.init(v);
- }
- }
- VariableReference.prototype.init = function(v) {
- this.variable = v;
- };
- VariableReference.prototype.toString = function() {
- return "$" + this.variable;
- };
- VariableReference.prototype.evaluate = function(c) {
- var parts = Utilities.resolveQName(this.variable, c.namespaceResolver, c.contextNode, false);
- if (parts[0] == null) {
- throw new Error("Cannot resolve QName " + fn);
- }
- var result = c.variableResolver.getVariable(parts[1], parts[0]);
- if (!result) {
- throw XPathException.fromMessage("Undeclared variable: " + this.toString());
- }
- return result;
- };
- FunctionCall.prototype = new Expression();
- FunctionCall.prototype.constructor = FunctionCall;
- FunctionCall.superclass = Expression.prototype;
- function FunctionCall(fn2, args) {
- if (arguments.length > 0) {
- this.init(fn2, args);
- }
- }
- FunctionCall.prototype.init = function(fn2, args) {
- this.functionName = fn2;
- this.arguments = args;
- };
- FunctionCall.prototype.toString = function() {
- var s = this.functionName + "(";
- for (var i = 0; i < this.arguments.length; i++) {
- if (i > 0) {
- s += ", ";
- }
- s += this.arguments[i].toString();
- }
- return s + ")";
- };
- FunctionCall.prototype.evaluate = function(c) {
- var f = FunctionResolver.getFunctionFromContext(this.functionName, c);
- if (!f) {
- throw new Error("Unknown function " + this.functionName);
- }
- var a = [c].concat(this.arguments);
- return f.apply(c.functionResolver.thisArg, a);
- };
- var Operators = new Object();
- Operators.equals = function(l, r) {
- return l.equals(r);
- };
- Operators.notequal = function(l, r) {
- return l.notequal(r);
- };
- Operators.lessthan = function(l, r) {
- return l.lessthan(r);
- };
- Operators.greaterthan = function(l, r) {
- return l.greaterthan(r);
- };
- Operators.lessthanorequal = function(l, r) {
- return l.lessthanorequal(r);
- };
- Operators.greaterthanorequal = function(l, r) {
- return l.greaterthanorequal(r);
- };
- XString.prototype = new Expression();
- XString.prototype.constructor = XString;
- XString.superclass = Expression.prototype;
- function XString(s) {
- if (arguments.length > 0) {
- this.init(s);
- }
- }
- XString.prototype.init = function(s) {
- this.str = String(s);
- };
- XString.prototype.toString = function() {
- return this.str;
- };
- XString.prototype.evaluate = function(c) {
- return this;
- };
- XString.prototype.string = function() {
- return this;
- };
- XString.prototype.number = function() {
- return new XNumber(this.str);
- };
- XString.prototype.bool = function() {
- return new XBoolean(this.str);
- };
- XString.prototype.nodeset = function() {
- throw new Error("Cannot convert string to nodeset");
- };
- XString.prototype.stringValue = function() {
- return this.str;
- };
- XString.prototype.numberValue = function() {
- return this.number().numberValue();
- };
- XString.prototype.booleanValue = function() {
- return this.bool().booleanValue();
- };
- XString.prototype.equals = function(r) {
- if (Utilities.instance_of(r, XBoolean)) {
- return this.bool().equals(r);
- }
- if (Utilities.instance_of(r, XNumber)) {
- return this.number().equals(r);
- }
- if (Utilities.instance_of(r, XNodeSet)) {
- return r.compareWithString(this, Operators.equals);
- }
- return new XBoolean(this.str == r.str);
- };
- XString.prototype.notequal = function(r) {
- if (Utilities.instance_of(r, XBoolean)) {
- return this.bool().notequal(r);
- }
- if (Utilities.instance_of(r, XNumber)) {
- return this.number().notequal(r);
- }
- if (Utilities.instance_of(r, XNodeSet)) {
- return r.compareWithString(this, Operators.notequal);
- }
- return new XBoolean(this.str != r.str);
- };
- XString.prototype.lessthan = function(r) {
- return this.number().lessthan(r);
- };
- XString.prototype.greaterthan = function(r) {
- return this.number().greaterthan(r);
- };
- XString.prototype.lessthanorequal = function(r) {
- return this.number().lessthanorequal(r);
- };
- XString.prototype.greaterthanorequal = function(r) {
- return this.number().greaterthanorequal(r);
- };
- XNumber.prototype = new Expression();
- XNumber.prototype.constructor = XNumber;
- XNumber.superclass = Expression.prototype;
- function XNumber(n) {
- if (arguments.length > 0) {
- this.init(n);
- }
- }
- XNumber.prototype.init = function(n) {
- this.num = typeof n === "string" ? this.parse(n) : Number(n);
- };
- XNumber.prototype.numberFormat = /^\s*-?[0-9]*\.?[0-9]+\s*$/;
- XNumber.prototype.parse = function(s) {
- return this.numberFormat.test(s) ? parseFloat(s) : Number.NaN;
- };
- function padSmallNumber(numberStr) {
- var parts = numberStr.split("e-");
- var base = parts[0].replace(".", "");
- var exponent = Number(parts[1]);
- for (var i = 0; i < exponent - 1; i += 1) {
- base = "0" + base;
- }
- return "0." + base;
- }
- function padLargeNumber(numberStr) {
- var parts = numberStr.split("e");
- var base = parts[0].replace(".", "");
- var exponent = Number(parts[1]);
- var zerosToAppend = exponent + 1 - base.length;
- for (var i = 0; i < zerosToAppend; i += 1) {
- base += "0";
- }
- return base;
- }
- XNumber.prototype.toString = function() {
- var strValue = this.num.toString();
- if (strValue.indexOf("e-") !== -1) {
- return padSmallNumber(strValue);
- }
- if (strValue.indexOf("e") !== -1) {
- return padLargeNumber(strValue);
- }
- return strValue;
- };
- XNumber.prototype.evaluate = function(c) {
- return this;
- };
- XNumber.prototype.string = function() {
- return new XString(this.toString());
- };
- XNumber.prototype.number = function() {
- return this;
- };
- XNumber.prototype.bool = function() {
- return new XBoolean(this.num);
- };
- XNumber.prototype.nodeset = function() {
- throw new Error("Cannot convert number to nodeset");
- };
- XNumber.prototype.stringValue = function() {
- return this.string().stringValue();
- };
- XNumber.prototype.numberValue = function() {
- return this.num;
- };
- XNumber.prototype.booleanValue = function() {
- return this.bool().booleanValue();
- };
- XNumber.prototype.negate = function() {
- return new XNumber(-this.num);
- };
- XNumber.prototype.equals = function(r) {
- if (Utilities.instance_of(r, XBoolean)) {
- return this.bool().equals(r);
- }
- if (Utilities.instance_of(r, XString)) {
- return this.equals(r.number());
- }
- if (Utilities.instance_of(r, XNodeSet)) {
- return r.compareWithNumber(this, Operators.equals);
- }
- return new XBoolean(this.num == r.num);
- };
- XNumber.prototype.notequal = function(r) {
- if (Utilities.instance_of(r, XBoolean)) {
- return this.bool().notequal(r);
- }
- if (Utilities.instance_of(r, XString)) {
- return this.notequal(r.number());
- }
- if (Utilities.instance_of(r, XNodeSet)) {
- return r.compareWithNumber(this, Operators.notequal);
- }
- return new XBoolean(this.num != r.num);
- };
- XNumber.prototype.lessthan = function(r) {
- if (Utilities.instance_of(r, XNodeSet)) {
- return r.compareWithNumber(this, Operators.greaterthan);
- }
- if (Utilities.instance_of(r, XBoolean) || Utilities.instance_of(r, XString)) {
- return this.lessthan(r.number());
- }
- return new XBoolean(this.num < r.num);
- };
- XNumber.prototype.greaterthan = function(r) {
- if (Utilities.instance_of(r, XNodeSet)) {
- return r.compareWithNumber(this, Operators.lessthan);
- }
- if (Utilities.instance_of(r, XBoolean) || Utilities.instance_of(r, XString)) {
- return this.greaterthan(r.number());
- }
- return new XBoolean(this.num > r.num);
- };
- XNumber.prototype.lessthanorequal = function(r) {
- if (Utilities.instance_of(r, XNodeSet)) {
- return r.compareWithNumber(this, Operators.greaterthanorequal);
- }
- if (Utilities.instance_of(r, XBoolean) || Utilities.instance_of(r, XString)) {
- return this.lessthanorequal(r.number());
- }
- return new XBoolean(this.num <= r.num);
- };
- XNumber.prototype.greaterthanorequal = function(r) {
- if (Utilities.instance_of(r, XNodeSet)) {
- return r.compareWithNumber(this, Operators.lessthanorequal);
- }
- if (Utilities.instance_of(r, XBoolean) || Utilities.instance_of(r, XString)) {
- return this.greaterthanorequal(r.number());
- }
- return new XBoolean(this.num >= r.num);
- };
- XNumber.prototype.plus = function(r) {
- return new XNumber(this.num + r.num);
- };
- XNumber.prototype.minus = function(r) {
- return new XNumber(this.num - r.num);
- };
- XNumber.prototype.multiply = function(r) {
- return new XNumber(this.num * r.num);
- };
- XNumber.prototype.div = function(r) {
- return new XNumber(this.num / r.num);
- };
- XNumber.prototype.mod = function(r) {
- return new XNumber(this.num % r.num);
- };
- XBoolean.prototype = new Expression();
- XBoolean.prototype.constructor = XBoolean;
- XBoolean.superclass = Expression.prototype;
- function XBoolean(b) {
- if (arguments.length > 0) {
- this.init(b);
- }
- }
- XBoolean.prototype.init = function(b) {
- this.b = Boolean(b);
- };
- XBoolean.prototype.toString = function() {
- return this.b.toString();
- };
- XBoolean.prototype.evaluate = function(c) {
- return this;
- };
- XBoolean.prototype.string = function() {
- return new XString(this.b);
- };
- XBoolean.prototype.number = function() {
- return new XNumber(this.b);
- };
- XBoolean.prototype.bool = function() {
- return this;
- };
- XBoolean.prototype.nodeset = function() {
- throw new Error("Cannot convert boolean to nodeset");
- };
- XBoolean.prototype.stringValue = function() {
- return this.string().stringValue();
- };
- XBoolean.prototype.numberValue = function() {
- return this.number().numberValue();
- };
- XBoolean.prototype.booleanValue = function() {
- return this.b;
- };
- XBoolean.prototype.not = function() {
- return new XBoolean(!this.b);
- };
- XBoolean.prototype.equals = function(r) {
- if (Utilities.instance_of(r, XString) || Utilities.instance_of(r, XNumber)) {
- return this.equals(r.bool());
- }
- if (Utilities.instance_of(r, XNodeSet)) {
- return r.compareWithBoolean(this, Operators.equals);
- }
- return new XBoolean(this.b == r.b);
- };
- XBoolean.prototype.notequal = function(r) {
- if (Utilities.instance_of(r, XString) || Utilities.instance_of(r, XNumber)) {
- return this.notequal(r.bool());
- }
- if (Utilities.instance_of(r, XNodeSet)) {
- return r.compareWithBoolean(this, Operators.notequal);
- }
- return new XBoolean(this.b != r.b);
- };
- XBoolean.prototype.lessthan = function(r) {
- return this.number().lessthan(r);
- };
- XBoolean.prototype.greaterthan = function(r) {
- return this.number().greaterthan(r);
- };
- XBoolean.prototype.lessthanorequal = function(r) {
- return this.number().lessthanorequal(r);
- };
- XBoolean.prototype.greaterthanorequal = function(r) {
- return this.number().greaterthanorequal(r);
- };
- XBoolean.true_ = new XBoolean(true);
- XBoolean.false_ = new XBoolean(false);
- AVLTree.prototype = new Object();
- AVLTree.prototype.constructor = AVLTree;
- AVLTree.superclass = Object.prototype;
- function AVLTree(n) {
- this.init(n);
- }
- AVLTree.prototype.init = function(n) {
- this.left = null;
- this.right = null;
- this.node = n;
- this.depth = 1;
- };
- AVLTree.prototype.balance = function() {
- var ldepth = this.left == null ? 0 : this.left.depth;
- var rdepth = this.right == null ? 0 : this.right.depth;
- if (ldepth > rdepth + 1) {
- var lldepth = this.left.left == null ? 0 : this.left.left.depth;
- var lrdepth = this.left.right == null ? 0 : this.left.right.depth;
- if (lldepth < lrdepth) {
- this.left.rotateRR();
- }
- this.rotateLL();
- } else if (ldepth + 1 < rdepth) {
- var rrdepth = this.right.right == null ? 0 : this.right.right.depth;
- var rldepth = this.right.left == null ? 0 : this.right.left.depth;
- if (rldepth > rrdepth) {
- this.right.rotateLL();
- }
- this.rotateRR();
- }
- };
- AVLTree.prototype.rotateLL = function() {
- var nodeBefore = this.node;
- var rightBefore = this.right;
- this.node = this.left.node;
- this.right = this.left;
- this.left = this.left.left;
- this.right.left = this.right.right;
- this.right.right = rightBefore;
- this.right.node = nodeBefore;
- this.right.updateInNewLocation();
- this.updateInNewLocation();
- };
- AVLTree.prototype.rotateRR = function() {
- var nodeBefore = this.node;
- var leftBefore = this.left;
- this.node = this.right.node;
- this.left = this.right;
- this.right = this.right.right;
- this.left.right = this.left.left;
- this.left.left = leftBefore;
- this.left.node = nodeBefore;
- this.left.updateInNewLocation();
- this.updateInNewLocation();
- };
- AVLTree.prototype.updateInNewLocation = function() {
- this.getDepthFromChildren();
- };
- AVLTree.prototype.getDepthFromChildren = function() {
- this.depth = this.node == null ? 0 : 1;
- if (this.left != null) {
- this.depth = this.left.depth + 1;
- }
- if (this.right != null && this.depth <= this.right.depth) {
- this.depth = this.right.depth + 1;
- }
- };
- function nodeOrder(n1, n2) {
- if (n1 === n2) {
- return 0;
- }
- if (n1.compareDocumentPosition) {
- var cpos = n1.compareDocumentPosition(n2);
- if (cpos & 1) {
- return 1;
- }
- if (cpos & 10) {
- return 1;
- }
- if (cpos & 20) {
- return -1;
- }
- return 0;
- }
- var d1 = 0, d2 = 0;
- for (var m1 = n1; m1 != null; m1 = m1.parentNode || m1.ownerElement) {
- d1++;
- }
- for (var m2 = n2; m2 != null; m2 = m2.parentNode || m2.ownerElement) {
- d2++;
- }
- if (d1 > d2) {
- while (d1 > d2) {
- n1 = n1.parentNode || n1.ownerElement;
- d1--;
- }
- if (n1 === n2) {
- return 1;
- }
- } else if (d2 > d1) {
- while (d2 > d1) {
- n2 = n2.parentNode || n2.ownerElement;
- d2--;
- }
- if (n1 === n2) {
- return -1;
- }
- }
- var n1Par = n1.parentNode || n1.ownerElement, n2Par = n2.parentNode || n2.ownerElement;
- while (n1Par !== n2Par) {
- n1 = n1Par;
- n2 = n2Par;
- n1Par = n1.parentNode || n1.ownerElement;
- n2Par = n2.parentNode || n2.ownerElement;
- }
- var n1isAttr = isAttributeLike(n1);
- var n2isAttr = isAttributeLike(n2);
- if (n1isAttr && !n2isAttr) {
- return -1;
- }
- if (!n1isAttr && n2isAttr) {
- return 1;
- }
- if (n1.isXPathNamespace) {
- if (n1.nodeValue === XPath.XML_NAMESPACE_URI) {
- return -1;
- }
- if (!n2.isXPathNamespace) {
- return -1;
- }
- if (n2.nodeValue === XPath.XML_NAMESPACE_URI) {
- return 1;
- }
- } else if (n2.isXPathNamespace) {
- return 1;
- }
- if (n1Par) {
- var cn = n1isAttr ? n1Par.attributes : n1Par.childNodes;
- var len = cn.length;
- var n1Compare = n1.baseNode || n1;
- var n2Compare = n2.baseNode || n2;
- for (var i = 0; i < len; i += 1) {
- var n = cn[i];
- if (n === n1Compare) {
- return -1;
- }
- if (n === n2Compare) {
- return 1;
- }
- }
- }
- throw new Error("Unexpected: could not determine node order");
- }
- AVLTree.prototype.add = function(n) {
- if (n === this.node) {
- return false;
- }
- var o = nodeOrder(n, this.node);
- var ret = false;
- if (o == -1) {
- if (this.left == null) {
- this.left = new AVLTree(n);
- ret = true;
- } else {
- ret = this.left.add(n);
- if (ret) {
- this.balance();
- }
- }
- } else if (o == 1) {
- if (this.right == null) {
- this.right = new AVLTree(n);
- ret = true;
- } else {
- ret = this.right.add(n);
- if (ret) {
- this.balance();
- }
- }
- }
- if (ret) {
- this.getDepthFromChildren();
- }
- return ret;
- };
- XNodeSet.prototype = new Expression();
- XNodeSet.prototype.constructor = XNodeSet;
- XNodeSet.superclass = Expression.prototype;
- function XNodeSet() {
- this.init();
- }
- XNodeSet.prototype.init = function() {
- this.tree = null;
- this.nodes = [];
- this.size = 0;
- };
- XNodeSet.prototype.toString = function() {
- var p = this.first();
- if (p == null) {
- return "";
- }
- return this.stringForNode(p);
- };
- XNodeSet.prototype.evaluate = function(c) {
- return this;
- };
- XNodeSet.prototype.string = function() {
- return new XString(this.toString());
- };
- XNodeSet.prototype.stringValue = function() {
- return this.toString();
- };
- XNodeSet.prototype.number = function() {
- return new XNumber(this.string());
- };
- XNodeSet.prototype.numberValue = function() {
- return Number(this.string());
- };
- XNodeSet.prototype.bool = function() {
- return new XBoolean(this.booleanValue());
- };
- XNodeSet.prototype.booleanValue = function() {
- return !!this.size;
- };
- XNodeSet.prototype.nodeset = function() {
- return this;
- };
- XNodeSet.prototype.stringForNode = function(n) {
- if (n.nodeType == NodeTypes.DOCUMENT_NODE || n.nodeType == NodeTypes.ELEMENT_NODE || n.nodeType === NodeTypes.DOCUMENT_FRAGMENT_NODE) {
- return this.stringForContainerNode(n);
- }
- if (n.nodeType === NodeTypes.ATTRIBUTE_NODE) {
- return n.value || n.nodeValue;
- }
- if (n.isNamespaceNode) {
- return n.namespace;
- }
- return n.nodeValue;
- };
- XNodeSet.prototype.stringForContainerNode = function(n) {
- var s = "";
- for (var n2 = n.firstChild; n2 != null; n2 = n2.nextSibling) {
- var nt = n2.nodeType;
- if (nt === 1 || nt === 3 || nt === 4 || nt === 9 || nt === 11) {
- s += this.stringForNode(n2);
- }
- }
- return s;
- };
- XNodeSet.prototype.buildTree = function() {
- if (!this.tree && this.nodes.length) {
- this.tree = new AVLTree(this.nodes[0]);
- for (var i = 1; i < this.nodes.length; i += 1) {
- this.tree.add(this.nodes[i]);
- }
- }
- return this.tree;
- };
- XNodeSet.prototype.first = function() {
- var p = this.buildTree();
- if (p == null) {
- return null;
- }
- while (p.left != null) {
- p = p.left;
- }
- return p.node;
- };
- XNodeSet.prototype.add = function(n) {
- for (var i = 0; i < this.nodes.length; i += 1) {
- if (n === this.nodes[i]) {
- return;
- }
- }
- this.tree = null;
- this.nodes.push(n);
- this.size += 1;
- };
- XNodeSet.prototype.addArray = function(ns) {
- var self = this;
- forEach(function(x) {
- self.add(x);
- }, ns);
- };
- XNodeSet.prototype.toArray = function() {
- var a = [];
- this.toArrayRec(this.buildTree(), a);
- return a;
- };
- XNodeSet.prototype.toArrayRec = function(t, a) {
- if (t != null) {
- this.toArrayRec(t.left, a);
- a.push(t.node);
- this.toArrayRec(t.right, a);
- }
- };
- XNodeSet.prototype.toUnsortedArray = function() {
- return this.nodes.slice();
- };
- XNodeSet.prototype.compareWithString = function(r, o) {
- var a = this.toUnsortedArray();
- for (var i = 0; i < a.length; i++) {
- var n = a[i];
- var l = new XString(this.stringForNode(n));
- var res = o(l, r);
- if (res.booleanValue()) {
- return res;
- }
- }
- return new XBoolean(false);
- };
- XNodeSet.prototype.compareWithNumber = function(r, o) {
- var a = this.toUnsortedArray();
- for (var i = 0; i < a.length; i++) {
- var n = a[i];
- var l = new XNumber(this.stringForNode(n));
- var res = o(l, r);
- if (res.booleanValue()) {
- return res;
- }
- }
- return new XBoolean(false);
- };
- XNodeSet.prototype.compareWithBoolean = function(r, o) {
- return o(this.bool(), r);
- };
- XNodeSet.prototype.compareWithNodeSet = function(r, o) {
- var arr = this.toUnsortedArray();
- var oInvert = function(lop, rop) {
- return o(rop, lop);
- };
- for (var i = 0; i < arr.length; i++) {
- var l = new XString(this.stringForNode(arr[i]));
- var res = r.compareWithString(l, oInvert);
- if (res.booleanValue()) {
- return res;
- }
- }
- return new XBoolean(false);
- };
- XNodeSet.compareWith = curry(function(o, r) {
- if (Utilities.instance_of(r, XString)) {
- return this.compareWithString(r, o);
- }
- if (Utilities.instance_of(r, XNumber)) {
- return this.compareWithNumber(r, o);
- }
- if (Utilities.instance_of(r, XBoolean)) {
- return this.compareWithBoolean(r, o);
- }
- return this.compareWithNodeSet(r, o);
- });
- XNodeSet.prototype.equals = XNodeSet.compareWith(Operators.equals);
- XNodeSet.prototype.notequal = XNodeSet.compareWith(Operators.notequal);
- XNodeSet.prototype.lessthan = XNodeSet.compareWith(Operators.lessthan);
- XNodeSet.prototype.greaterthan = XNodeSet.compareWith(Operators.greaterthan);
- XNodeSet.prototype.lessthanorequal = XNodeSet.compareWith(Operators.lessthanorequal);
- XNodeSet.prototype.greaterthanorequal = XNodeSet.compareWith(Operators.greaterthanorequal);
- XNodeSet.prototype.union = function(r) {
- var ns = new XNodeSet();
- ns.addArray(this.toUnsortedArray());
- ns.addArray(r.toUnsortedArray());
- return ns;
- };
- XPathNamespace.prototype = new Object();
- XPathNamespace.prototype.constructor = XPathNamespace;
- XPathNamespace.superclass = Object.prototype;
- function XPathNamespace(pre, node, uri, p) {
- this.isXPathNamespace = true;
- this.baseNode = node;
- this.ownerDocument = p.ownerDocument;
- this.nodeName = pre;
- this.prefix = pre;
- this.localName = pre;
- this.namespaceURI = null;
- this.nodeValue = uri;
- this.ownerElement = p;
- this.nodeType = NodeTypes.NAMESPACE_NODE;
- }
- XPathNamespace.prototype.toString = function() {
- return '{ "' + this.prefix + '", "' + this.namespaceURI + '" }';
- };
- XPathContext.prototype = new Object();
- XPathContext.prototype.constructor = XPathContext;
- XPathContext.superclass = Object.prototype;
- function XPathContext(vr, nr, fr) {
- this.variableResolver = vr != null ? vr : new VariableResolver();
- this.namespaceResolver = nr != null ? nr : new NamespaceResolver();
- this.functionResolver = fr != null ? fr : new FunctionResolver();
- }
- XPathContext.prototype.extend = function(newProps) {
- return assign(new XPathContext(), this, newProps);
- };
- VariableResolver.prototype = new Object();
- VariableResolver.prototype.constructor = VariableResolver;
- VariableResolver.superclass = Object.prototype;
- function VariableResolver() {
- }
- VariableResolver.prototype.getVariable = function(ln, ns) {
- return null;
- };
- FunctionResolver.prototype = new Object();
- FunctionResolver.prototype.constructor = FunctionResolver;
- FunctionResolver.superclass = Object.prototype;
- function FunctionResolver(thisArg) {
- this.thisArg = thisArg != null ? thisArg : Functions;
- this.functions = new Object();
- this.addStandardFunctions();
- }
- FunctionResolver.prototype.addStandardFunctions = function() {
- this.functions["{}last"] = Functions.last;
- this.functions["{}position"] = Functions.position;
- this.functions["{}count"] = Functions.count;
- this.functions["{}id"] = Functions.id;
- this.functions["{}local-name"] = Functions.localName;
- this.functions["{}namespace-uri"] = Functions.namespaceURI;
- this.functions["{}name"] = Functions.name;
- this.functions["{}string"] = Functions.string;
- this.functions["{}concat"] = Functions.concat;
- this.functions["{}starts-with"] = Functions.startsWith;
- this.functions["{}contains"] = Functions.contains;
- this.functions["{}substring-before"] = Functions.substringBefore;
- this.functions["{}substring-after"] = Functions.substringAfter;
- this.functions["{}substring"] = Functions.substring;
- this.functions["{}string-length"] = Functions.stringLength;
- this.functions["{}normalize-space"] = Functions.normalizeSpace;
- this.functions["{}translate"] = Functions.translate;
- this.functions["{}boolean"] = Functions.boolean_;
- this.functions["{}not"] = Functions.not;
- this.functions["{}true"] = Functions.true_;
- this.functions["{}false"] = Functions.false_;
- this.functions["{}lang"] = Functions.lang;
- this.functions["{}number"] = Functions.number;
- this.functions["{}sum"] = Functions.sum;
- this.functions["{}floor"] = Functions.floor;
- this.functions["{}ceiling"] = Functions.ceiling;
- this.functions["{}round"] = Functions.round;
- };
- FunctionResolver.prototype.addFunction = function(ns, ln, f) {
- this.functions["{" + ns + "}" + ln] = f;
- };
- FunctionResolver.getFunctionFromContext = function(qName, context) {
- var parts = Utilities.resolveQName(qName, context.namespaceResolver, context.contextNode, false);
- if (parts[0] === null) {
- throw new Error("Cannot resolve QName " + name);
- }
- return context.functionResolver.getFunction(parts[1], parts[0]);
- };
- FunctionResolver.prototype.getFunction = function(localName, namespace) {
- return this.functions["{" + namespace + "}" + localName];
- };
- NamespaceResolver.prototype = new Object();
- NamespaceResolver.prototype.constructor = NamespaceResolver;
- NamespaceResolver.superclass = Object.prototype;
- function NamespaceResolver() {
- }
- NamespaceResolver.prototype.getNamespace = function(prefix, n) {
- if (prefix == "xml") {
- return XPath.XML_NAMESPACE_URI;
- } else if (prefix == "xmlns") {
- return XPath.XMLNS_NAMESPACE_URI;
- }
- if (n.nodeType == NodeTypes.DOCUMENT_NODE) {
- n = n.documentElement;
- } else if (n.nodeType == NodeTypes.ATTRIBUTE_NODE) {
- n = PathExpr.getOwnerElement(n);
- } else if (n.nodeType != NodeTypes.ELEMENT_NODE) {
- n = n.parentNode;
- }
- while (n != null && n.nodeType == NodeTypes.ELEMENT_NODE) {
- var nnm = n.attributes;
- for (var i = 0; i < nnm.length; i++) {
- var a = nnm.item(i);
- var aname = a.name || a.nodeName;
- if (aname === "xmlns" && prefix === "" || aname === "xmlns:" + prefix) {
- return String(a.value || a.nodeValue);
- }
- }
- n = n.parentNode;
- }
- return null;
- };
- var Functions = new Object();
- Functions.last = function(c) {
- if (arguments.length != 1) {
- throw new Error("Function last expects ()");
- }
- return new XNumber(c.contextSize);
- };
- Functions.position = function(c) {
- if (arguments.length != 1) {
- throw new Error("Function position expects ()");
- }
- return new XNumber(c.contextPosition);
- };
- Functions.count = function() {
- var c = arguments[0];
- var ns;
- if (arguments.length != 2 || !Utilities.instance_of(ns = arguments[1].evaluate(c), XNodeSet)) {
- throw new Error("Function count expects (node-set)");
- }
- return new XNumber(ns.size);
- };
- Functions.id = function() {
- var c = arguments[0];
- var id;
- if (arguments.length != 2) {
- throw new Error("Function id expects (object)");
- }
- id = arguments[1].evaluate(c);
- if (Utilities.instance_of(id, XNodeSet)) {
- id = id.toArray().join(" ");
- } else {
- id = id.stringValue();
- }
- var ids = id.split(/[\x0d\x0a\x09\x20]+/);
- var count = 0;
- var ns = new XNodeSet();
- var doc = c.contextNode.nodeType == NodeTypes.DOCUMENT_NODE ? c.contextNode : c.contextNode.ownerDocument;
- for (var i = 0; i < ids.length; i++) {
- var n;
- if (doc.getElementById) {
- n = doc.getElementById(ids[i]);
- } else {
- n = Utilities.getElementById(doc, ids[i]);
- }
- if (n != null) {
- ns.add(n);
- count++;
- }
- }
- return ns;
- };
- Functions.localName = function(c, eNode) {
- var n;
- if (arguments.length == 1) {
- n = c.contextNode;
- } else if (arguments.length == 2) {
- n = eNode.evaluate(c).first();
- } else {
- throw new Error("Function local-name expects (node-set?)");
- }
- if (n == null) {
- return new XString("");
- }
- return new XString(
- n.localName || // standard elements and attributes
- n.baseName || // IE
- n.target || // processing instructions
- n.nodeName || // DOM1 elements
- ""
- // fallback
- );
- };
- Functions.namespaceURI = function() {
- var c = arguments[0];
- var n;
- if (arguments.length == 1) {
- n = c.contextNode;
- } else if (arguments.length == 2) {
- n = arguments[1].evaluate(c).first();
- } else {
- throw new Error("Function namespace-uri expects (node-set?)");
- }
- if (n == null) {
- return new XString("");
- }
- return new XString(n.namespaceURI || "");
- };
- Functions.name = function() {
- var c = arguments[0];
- var n;
- if (arguments.length == 1) {
- n = c.contextNode;
- } else if (arguments.length == 2) {
- n = arguments[1].evaluate(c).first();
- } else {
- throw new Error("Function name expects (node-set?)");
- }
- if (n == null) {
- return new XString("");
- }
- if (n.nodeType == NodeTypes.ELEMENT_NODE) {
- return new XString(n.nodeName);
- } else if (n.nodeType == NodeTypes.ATTRIBUTE_NODE) {
- return new XString(n.name || n.nodeName);
- } else if (n.nodeType === NodeTypes.PROCESSING_INSTRUCTION_NODE) {
- return new XString(n.target || n.nodeName);
- } else if (n.localName == null) {
- return new XString("");
- } else {
- return new XString(n.localName);
- }
- };
- Functions.string = function() {
- var c = arguments[0];
- if (arguments.length == 1) {
- return new XString(XNodeSet.prototype.stringForNode(c.contextNode));
- } else if (arguments.length == 2) {
- return arguments[1].evaluate(c).string();
- }
- throw new Error("Function string expects (object?)");
- };
- Functions.concat = function(c) {
- if (arguments.length < 3) {
- throw new Error("Function concat expects (string, string[, string]*)");
- }
- var s = "";
- for (var i = 1; i < arguments.length; i++) {
- s += arguments[i].evaluate(c).stringValue();
- }
- return new XString(s);
- };
- Functions.startsWith = function() {
- var c = arguments[0];
- if (arguments.length != 3) {
- throw new Error("Function startsWith expects (string, string)");
- }
- var s1 = arguments[1].evaluate(c).stringValue();
- var s2 = arguments[2].evaluate(c).stringValue();
- return new XBoolean(s1.substring(0, s2.length) == s2);
- };
- Functions.contains = function() {
- var c = arguments[0];
- if (arguments.length != 3) {
- throw new Error("Function contains expects (string, string)");
- }
- var s1 = arguments[1].evaluate(c).stringValue();
- var s2 = arguments[2].evaluate(c).stringValue();
- return new XBoolean(s1.indexOf(s2) !== -1);
- };
- Functions.substringBefore = function() {
- var c = arguments[0];
- if (arguments.length != 3) {
- throw new Error("Function substring-before expects (string, string)");
- }
- var s1 = arguments[1].evaluate(c).stringValue();
- var s2 = arguments[2].evaluate(c).stringValue();
- return new XString(s1.substring(0, s1.indexOf(s2)));
- };
- Functions.substringAfter = function() {
- var c = arguments[0];
- if (arguments.length != 3) {
- throw new Error("Function substring-after expects (string, string)");
- }
- var s1 = arguments[1].evaluate(c).stringValue();
- var s2 = arguments[2].evaluate(c).stringValue();
- if (s2.length == 0) {
- return new XString(s1);
- }
- var i = s1.indexOf(s2);
- if (i == -1) {
- return new XString("");
- }
- return new XString(s1.substring(i + s2.length));
- };
- Functions.substring = function() {
- var c = arguments[0];
- if (!(arguments.length == 3 || arguments.length == 4)) {
- throw new Error("Function substring expects (string, number, number?)");
- }
- var s = arguments[1].evaluate(c).stringValue();
- var n1 = Math.round(arguments[2].evaluate(c).numberValue()) - 1;
- var n2 = arguments.length == 4 ? n1 + Math.round(arguments[3].evaluate(c).numberValue()) : void 0;
- return new XString(s.substring(n1, n2));
- };
- Functions.stringLength = function() {
- var c = arguments[0];
- var s;
- if (arguments.length == 1) {
- s = XNodeSet.prototype.stringForNode(c.contextNode);
- } else if (arguments.length == 2) {
- s = arguments[1].evaluate(c).stringValue();
- } else {
- throw new Error("Function string-length expects (string?)");
- }
- return new XNumber(s.length);
- };
- Functions.normalizeSpace = function() {
- var c = arguments[0];
- var s;
- if (arguments.length == 1) {
- s = XNodeSet.prototype.stringForNode(c.contextNode);
- } else if (arguments.length == 2) {
- s = arguments[1].evaluate(c).stringValue();
- } else {
- throw new Error("Function normalize-space expects (string?)");
- }
- var i = 0;
- var j = s.length - 1;
- while (Utilities.isSpace(s.charCodeAt(j))) {
- j--;
- }
- var t = "";
- while (i <= j && Utilities.isSpace(s.charCodeAt(i))) {
- i++;
- }
- while (i <= j) {
- if (Utilities.isSpace(s.charCodeAt(i))) {
- t += " ";
- while (i <= j && Utilities.isSpace(s.charCodeAt(i))) {
- i++;
- }
- } else {
- t += s.charAt(i);
- i++;
- }
- }
- return new XString(t);
- };
- Functions.translate = function(c, eValue, eFrom, eTo) {
- if (arguments.length != 4) {
- throw new Error("Function translate expects (string, string, string)");
- }
- var value = eValue.evaluate(c).stringValue();
- var from = eFrom.evaluate(c).stringValue();
- var to = eTo.evaluate(c).stringValue();
- var cMap = reduce(function(acc, ch, i) {
- if (!(ch in acc)) {
- acc[ch] = i > to.length ? "" : to[i];
- }
- return acc;
- }, {}, from);
- var t = join(
- "",
- map(function(ch) {
- return ch in cMap ? cMap[ch] : ch;
- }, value)
- );
- return new XString(t);
- };
- Functions.boolean_ = function() {
- var c = arguments[0];
- if (arguments.length != 2) {
- throw new Error("Function boolean expects (object)");
- }
- return arguments[1].evaluate(c).bool();
- };
- Functions.not = function(c, eValue) {
- if (arguments.length != 2) {
- throw new Error("Function not expects (object)");
- }
- return eValue.evaluate(c).bool().not();
- };
- Functions.true_ = function() {
- if (arguments.length != 1) {
- throw new Error("Function true expects ()");
- }
- return XBoolean.true_;
- };
- Functions.false_ = function() {
- if (arguments.length != 1) {
- throw new Error("Function false expects ()");
- }
- return XBoolean.false_;
- };
- Functions.lang = function() {
- var c = arguments[0];
- if (arguments.length != 2) {
- throw new Error("Function lang expects (string)");
- }
- var lang;
- for (var n = c.contextNode; n != null && n.nodeType != NodeTypes.DOCUMENT_NODE; n = n.parentNode) {
- var a = n.getAttributeNS(XPath.XML_NAMESPACE_URI, "lang");
- if (a != null) {
- lang = String(a);
- break;
- }
- }
- if (lang == null) {
- return XBoolean.false_;
- }
- var s = arguments[1].evaluate(c).stringValue();
- return new XBoolean(lang.substring(0, s.length) == s && (lang.length == s.length || lang.charAt(s.length) == "-"));
- };
- Functions.number = function() {
- var c = arguments[0];
- if (!(arguments.length == 1 || arguments.length == 2)) {
- throw new Error("Function number expects (object?)");
- }
- if (arguments.length == 1) {
- return new XNumber(XNodeSet.prototype.stringForNode(c.contextNode));
- }
- return arguments[1].evaluate(c).number();
- };
- Functions.sum = function() {
- var c = arguments[0];
- var ns;
- if (arguments.length != 2 || !Utilities.instance_of(ns = arguments[1].evaluate(c), XNodeSet)) {
- throw new Error("Function sum expects (node-set)");
- }
- ns = ns.toUnsortedArray();
- var n = 0;
- for (var i = 0; i < ns.length; i++) {
- n += new XNumber(XNodeSet.prototype.stringForNode(ns[i])).numberValue();
- }
- return new XNumber(n);
- };
- Functions.floor = function() {
- var c = arguments[0];
- if (arguments.length != 2) {
- throw new Error("Function floor expects (number)");
- }
- return new XNumber(Math.floor(arguments[1].evaluate(c).numberValue()));
- };
- Functions.ceiling = function() {
- var c = arguments[0];
- if (arguments.length != 2) {
- throw new Error("Function ceiling expects (number)");
- }
- return new XNumber(Math.ceil(arguments[1].evaluate(c).numberValue()));
- };
- Functions.round = function() {
- var c = arguments[0];
- if (arguments.length != 2) {
- throw new Error("Function round expects (number)");
- }
- return new XNumber(Math.round(arguments[1].evaluate(c).numberValue()));
- };
- var Utilities = new Object();
- var isAttributeLike = function(val) {
- return val && (val.nodeType === NodeTypes.ATTRIBUTE_NODE || val.ownerElement || val.isXPathNamespace);
- };
- Utilities.splitQName = function(qn) {
- var i = qn.indexOf(":");
- if (i == -1) {
- return [null, qn];
- }
- return [qn.substring(0, i), qn.substring(i + 1)];
- };
- Utilities.resolveQName = function(qn, nr, n, useDefault) {
- var parts = Utilities.splitQName(qn);
- if (parts[0] != null) {
- parts[0] = nr.getNamespace(parts[0], n);
- } else {
- if (useDefault) {
- parts[0] = nr.getNamespace("", n);
- if (parts[0] == null) {
- parts[0] = "";
- }
- } else {
- parts[0] = "";
- }
- }
- return parts;
- };
- Utilities.isSpace = function(c) {
- return c == 9 || c == 13 || c == 10 || c == 32;
- };
- Utilities.isLetter = function(c) {
- return c >= 65 && c <= 90 || c >= 97 && c <= 122 || c >= 192 && c <= 214 || c >= 216 && c <= 246 || c >= 248 && c <= 255 || c >= 256 && c <= 305 || c >= 308 && c <= 318 || c >= 321 && c <= 328 || c >= 330 && c <= 382 || c >= 384 && c <= 451 || c >= 461 && c <= 496 || c >= 500 && c <= 501 || c >= 506 && c <= 535 || c >= 592 && c <= 680 || c >= 699 && c <= 705 || c == 902 || c >= 904 && c <= 906 || c == 908 || c >= 910 && c <= 929 || c >= 931 && c <= 974 || c >= 976 && c <= 982 || c == 986 || c == 988 || c == 990 || c == 992 || c >= 994 && c <= 1011 || c >= 1025 && c <= 1036 || c >= 1038 && c <= 1103 || c >= 1105 && c <= 1116 || c >= 1118 && c <= 1153 || c >= 1168 && c <= 1220 || c >= 1223 && c <= 1224 || c >= 1227 && c <= 1228 || c >= 1232 && c <= 1259 || c >= 1262 && c <= 1269 || c >= 1272 && c <= 1273 || c >= 1329 && c <= 1366 || c == 1369 || c >= 1377 && c <= 1414 || c >= 1488 && c <= 1514 || c >= 1520 && c <= 1522 || c >= 1569 && c <= 1594 || c >= 1601 && c <= 1610 || c >= 1649 && c <= 1719 || c >= 1722 && c <= 1726 || c >= 1728 && c <= 1742 || c >= 1744 && c <= 1747 || c == 1749 || c >= 1765 && c <= 1766 || c >= 2309 && c <= 2361 || c == 2365 || c >= 2392 && c <= 2401 || c >= 2437 && c <= 2444 || c >= 2447 && c <= 2448 || c >= 2451 && c <= 2472 || c >= 2474 && c <= 2480 || c == 2482 || c >= 2486 && c <= 2489 || c >= 2524 && c <= 2525 || c >= 2527 && c <= 2529 || c >= 2544 && c <= 2545 || c >= 2565 && c <= 2570 || c >= 2575 && c <= 2576 || c >= 2579 && c <= 2600 || c >= 2602 && c <= 2608 || c >= 2610 && c <= 2611 || c >= 2613 && c <= 2614 || c >= 2616 && c <= 2617 || c >= 2649 && c <= 2652 || c == 2654 || c >= 2674 && c <= 2676 || c >= 2693 && c <= 2699 || c == 2701 || c >= 2703 && c <= 2705 || c >= 2707 && c <= 2728 || c >= 2730 && c <= 2736 || c >= 2738 && c <= 2739 || c >= 2741 && c <= 2745 || c == 2749 || c == 2784 || c >= 2821 && c <= 2828 || c >= 2831 && c <= 2832 || c >= 2835 && c <= 2856 || c >= 2858 && c <= 2864 || c >= 2866 && c <= 2867 || c >= 2870 && c <= 2873 || c == 2877 || c >= 2908 && c <= 2909 || c >= 2911 && c <= 2913 || c >= 2949 && c <= 2954 || c >= 2958 && c <= 2960 || c >= 2962 && c <= 2965 || c >= 2969 && c <= 2970 || c == 2972 || c >= 2974 && c <= 2975 || c >= 2979 && c <= 2980 || c >= 2984 && c <= 2986 || c >= 2990 && c <= 2997 || c >= 2999 && c <= 3001 || c >= 3077 && c <= 3084 || c >= 3086 && c <= 3088 || c >= 3090 && c <= 3112 || c >= 3114 && c <= 3123 || c >= 3125 && c <= 3129 || c >= 3168 && c <= 3169 || c >= 3205 && c <= 3212 || c >= 3214 && c <= 3216 || c >= 3218 && c <= 3240 || c >= 3242 && c <= 3251 || c >= 3253 && c <= 3257 || c == 3294 || c >= 3296 && c <= 3297 || c >= 3333 && c <= 3340 || c >= 3342 && c <= 3344 || c >= 3346 && c <= 3368 || c >= 3370 && c <= 3385 || c >= 3424 && c <= 3425 || c >= 3585 && c <= 3630 || c == 3632 || c >= 3634 && c <= 3635 || c >= 3648 && c <= 3653 || c >= 3713 && c <= 3714 || c == 3716 || c >= 3719 && c <= 3720 || c == 3722 || c == 3725 || c >= 3732 && c <= 3735 || c >= 3737 && c <= 3743 || c >= 3745 && c <= 3747 || c == 3749 || c == 3751 || c >= 3754 && c <= 3755 || c >= 3757 && c <= 3758 || c == 3760 || c >= 3762 && c <= 3763 || c == 3773 || c >= 3776 && c <= 3780 || c >= 3904 && c <= 3911 || c >= 3913 && c <= 3945 || c >= 4256 && c <= 4293 || c >= 4304 && c <= 4342 || c == 4352 || c >= 4354 && c <= 4355 || c >= 4357 && c <= 4359 || c == 4361 || c >= 4363 && c <= 4364 || c >= 4366 && c <= 4370 || c == 4412 || c == 4414 || c == 4416 || c == 4428 || c == 4430 || c == 4432 || c >= 4436 && c <= 4437 || c == 4441 || c >= 4447 && c <= 4449 || c == 4451 || c == 4453 || c == 4455 || c == 4457 || c >= 4461 && c <= 4462 || c >= 4466 && c <= 4467 || c == 4469 || c == 4510 || c == 4520 || c == 4523 || c >= 4526 && c <= 4527 || c >= 4535 && c <= 4536 || c == 4538 || c >= 4540 && c <= 4546 || c == 4587 || c == 4592 || c == 4601 || c >= 7680 && c <= 7835 || c >= 7840 && c <= 7929 || c >= 7936 && c <= 7957 || c >= 7960 && c <= 7965 || c >= 7968 && c <= 8005 || c >= 8008 && c <= 8013 || c >= 8016 && c <= 8023 || c == 8025 || c == 8027 || c == 8029 || c >= 8031 && c <= 8061 || c >= 8064 && c <= 8116 || c >= 8118 && c <= 8124 || c == 8126 || c >= 8130 && c <= 8132 || c >= 8134 && c <= 8140 || c >= 8144 && c <= 8147 || c >= 8150 && c <= 8155 || c >= 8160 && c <= 8172 || c >= 8178 && c <= 8180 || c >= 8182 && c <= 8188 || c == 8486 || c >= 8490 && c <= 8491 || c == 8494 || c >= 8576 && c <= 8578 || c >= 12353 && c <= 12436 || c >= 12449 && c <= 12538 || c >= 12549 && c <= 12588 || c >= 44032 && c <= 55203 || c >= 19968 && c <= 40869 || c == 12295 || c >= 12321 && c <= 12329;
- };
- Utilities.isNCNameChar = function(c) {
- return c >= 48 && c <= 57 || c >= 1632 && c <= 1641 || c >= 1776 && c <= 1785 || c >= 2406 && c <= 2415 || c >= 2534 && c <= 2543 || c >= 2662 && c <= 2671 || c >= 2790 && c <= 2799 || c >= 2918 && c <= 2927 || c >= 3047 && c <= 3055 || c >= 3174 && c <= 3183 || c >= 3302 && c <= 3311 || c >= 3430 && c <= 3439 || c >= 3664 && c <= 3673 || c >= 3792 && c <= 3801 || c >= 3872 && c <= 3881 || c == 46 || c == 45 || c == 95 || Utilities.isLetter(c) || c >= 768 && c <= 837 || c >= 864 && c <= 865 || c >= 1155 && c <= 1158 || c >= 1425 && c <= 1441 || c >= 1443 && c <= 1465 || c >= 1467 && c <= 1469 || c == 1471 || c >= 1473 && c <= 1474 || c == 1476 || c >= 1611 && c <= 1618 || c == 1648 || c >= 1750 && c <= 1756 || c >= 1757 && c <= 1759 || c >= 1760 && c <= 1764 || c >= 1767 && c <= 1768 || c >= 1770 && c <= 1773 || c >= 2305 && c <= 2307 || c == 2364 || c >= 2366 && c <= 2380 || c == 2381 || c >= 2385 && c <= 2388 || c >= 2402 && c <= 2403 || c >= 2433 && c <= 2435 || c == 2492 || c == 2494 || c == 2495 || c >= 2496 && c <= 2500 || c >= 2503 && c <= 2504 || c >= 2507 && c <= 2509 || c == 2519 || c >= 2530 && c <= 2531 || c == 2562 || c == 2620 || c == 2622 || c == 2623 || c >= 2624 && c <= 2626 || c >= 2631 && c <= 2632 || c >= 2635 && c <= 2637 || c >= 2672 && c <= 2673 || c >= 2689 && c <= 2691 || c == 2748 || c >= 2750 && c <= 2757 || c >= 2759 && c <= 2761 || c >= 2763 && c <= 2765 || c >= 2817 && c <= 2819 || c == 2876 || c >= 2878 && c <= 2883 || c >= 2887 && c <= 2888 || c >= 2891 && c <= 2893 || c >= 2902 && c <= 2903 || c >= 2946 && c <= 2947 || c >= 3006 && c <= 3010 || c >= 3014 && c <= 3016 || c >= 3018 && c <= 3021 || c == 3031 || c >= 3073 && c <= 3075 || c >= 3134 && c <= 3140 || c >= 3142 && c <= 3144 || c >= 3146 && c <= 3149 || c >= 3157 && c <= 3158 || c >= 3202 && c <= 3203 || c >= 3262 && c <= 3268 || c >= 3270 && c <= 3272 || c >= 3274 && c <= 3277 || c >= 3285 && c <= 3286 || c >= 3330 && c <= 3331 || c >= 3390 && c <= 3395 || c >= 3398 && c <= 3400 || c >= 3402 && c <= 3405 || c == 3415 || c == 3633 || c >= 3636 && c <= 3642 || c >= 3655 && c <= 3662 || c == 3761 || c >= 3764 && c <= 3769 || c >= 3771 && c <= 3772 || c >= 3784 && c <= 3789 || c >= 3864 && c <= 3865 || c == 3893 || c == 3895 || c == 3897 || c == 3902 || c == 3903 || c >= 3953 && c <= 3972 || c >= 3974 && c <= 3979 || c >= 3984 && c <= 3989 || c == 3991 || c >= 3993 && c <= 4013 || c >= 4017 && c <= 4023 || c == 4025 || c >= 8400 && c <= 8412 || c == 8417 || c >= 12330 && c <= 12335 || c == 12441 || c == 12442 || c == 183 || c == 720 || c == 721 || c == 903 || c == 1600 || c == 3654 || c == 3782 || c == 12293 || c >= 12337 && c <= 12341 || c >= 12445 && c <= 12446 || c >= 12540 && c <= 12542;
- };
- Utilities.coalesceText = function(n) {
- for (var m = n.firstChild; m != null; m = m.nextSibling) {
- if (m.nodeType == NodeTypes.TEXT_NODE || m.nodeType == NodeTypes.CDATA_SECTION_NODE) {
- var s = m.nodeValue;
- var first = m;
- m = m.nextSibling;
- while (m != null && (m.nodeType == NodeTypes.TEXT_NODE || m.nodeType == NodeTypes.CDATA_SECTION_NODE)) {
- s += m.nodeValue;
- var del = m;
- m = m.nextSibling;
- del.parentNode.removeChild(del);
- }
- if (first.nodeType == NodeTypes.CDATA_SECTION_NODE) {
- var p = first.parentNode;
- if (first.nextSibling == null) {
- p.removeChild(first);
- p.appendChild(p.ownerDocument.createTextNode(s));
- } else {
- var next = first.nextSibling;
- p.removeChild(first);
- p.insertBefore(p.ownerDocument.createTextNode(s), next);
- }
- } else {
- first.nodeValue = s;
- }
- if (m == null) {
- break;
- }
- } else if (m.nodeType == NodeTypes.ELEMENT_NODE) {
- Utilities.coalesceText(m);
- }
- }
- };
- Utilities.instance_of = function(o, c) {
- while (o != null) {
- if (o.constructor === c) {
- return true;
- }
- if (o === Object) {
- return false;
- }
- o = o.constructor.superclass;
- }
- return false;
- };
- Utilities.getElementById = function(n, id) {
- if (n.nodeType == NodeTypes.ELEMENT_NODE) {
- if (n.getAttribute("id") == id || n.getAttributeNS(null, "id") == id) {
- return n;
- }
- }
- for (var m = n.firstChild; m != null; m = m.nextSibling) {
- var res = Utilities.getElementById(m, id);
- if (res != null) {
- return res;
- }
- }
- return null;
- };
- var XPathException = function() {
- function getMessage(code, exception) {
- var msg = exception ? ": " + exception.toString() : "";
- switch (code) {
- case XPathException2.INVALID_EXPRESSION_ERR:
- return "Invalid expression" + msg;
- case XPathException2.TYPE_ERR:
- return "Type error" + msg;
- }
- return null;
- }
- function XPathException2(code, error, message) {
- var err = Error.call(this, getMessage(code, error) || message);
- err.code = code;
- err.exception = error;
- return err;
- }
- XPathException2.prototype = Object.create(Error.prototype);
- XPathException2.prototype.constructor = XPathException2;
- XPathException2.superclass = Error;
- XPathException2.prototype.toString = function() {
- return this.message;
- };
- XPathException2.fromMessage = function(message, error) {
- return new XPathException2(null, error, message);
- };
- XPathException2.INVALID_EXPRESSION_ERR = 51;
- XPathException2.TYPE_ERR = 52;
- return XPathException2;
- }();
- XPathExpression.prototype = {};
- XPathExpression.prototype.constructor = XPathExpression;
- XPathExpression.superclass = Object.prototype;
- function XPathExpression(e, r, p) {
- this.xpath = p.parse(e);
- this.context = new XPathContext();
- this.context.namespaceResolver = new XPathNSResolverWrapper(r);
- }
- XPathExpression.getOwnerDocument = function(n) {
- return n.nodeType === NodeTypes.DOCUMENT_NODE ? n : n.ownerDocument;
- };
- XPathExpression.detectHtmlDom = function(n) {
- if (!n) {
- return false;
- }
- var doc = XPathExpression.getOwnerDocument(n);
- try {
- return doc.implementation.hasFeature("HTML", "2.0");
- } catch (e) {
- return true;
- }
- };
- XPathExpression.prototype.evaluate = function(n, t, res) {
- this.context.expressionContextNode = n;
- this.context.caseInsensitive = XPathExpression.detectHtmlDom(n);
- var result = this.xpath.evaluate(this.context);
- return new XPathResult(result, t);
- };
- XPathNSResolverWrapper.prototype = {};
- XPathNSResolverWrapper.prototype.constructor = XPathNSResolverWrapper;
- XPathNSResolverWrapper.superclass = Object.prototype;
- function XPathNSResolverWrapper(r) {
- this.xpathNSResolver = r;
- }
- XPathNSResolverWrapper.prototype.getNamespace = function(prefix, n) {
- if (this.xpathNSResolver == null) {
- return null;
- }
- return this.xpathNSResolver.lookupNamespaceURI(prefix);
- };
- NodeXPathNSResolver.prototype = {};
- NodeXPathNSResolver.prototype.constructor = NodeXPathNSResolver;
- NodeXPathNSResolver.superclass = Object.prototype;
- function NodeXPathNSResolver(n) {
- this.node = n;
- this.namespaceResolver = new NamespaceResolver();
- }
- NodeXPathNSResolver.prototype.lookupNamespaceURI = function(prefix) {
- return this.namespaceResolver.getNamespace(prefix, this.node);
- };
- XPathResult.prototype = {};
- XPathResult.prototype.constructor = XPathResult;
- XPathResult.superclass = Object.prototype;
- function XPathResult(v, t) {
- if (t == XPathResult.ANY_TYPE) {
- if (v.constructor === XString) {
- t = XPathResult.STRING_TYPE;
- } else if (v.constructor === XNumber) {
- t = XPathResult.NUMBER_TYPE;
- } else if (v.constructor === XBoolean) {
- t = XPathResult.BOOLEAN_TYPE;
- } else if (v.constructor === XNodeSet) {
- t = XPathResult.UNORDERED_NODE_ITERATOR_TYPE;
- }
- }
- this.resultType = t;
- switch (t) {
- case XPathResult.NUMBER_TYPE:
- this.numberValue = v.numberValue();
- return;
- case XPathResult.STRING_TYPE:
- this.stringValue = v.stringValue();
- return;
- case XPathResult.BOOLEAN_TYPE:
- this.booleanValue = v.booleanValue();
- return;
- case XPathResult.ANY_UNORDERED_NODE_TYPE:
- case XPathResult.FIRST_ORDERED_NODE_TYPE:
- if (v.constructor === XNodeSet) {
- this.singleNodeValue = v.first();
- return;
- }
- break;
- case XPathResult.UNORDERED_NODE_ITERATOR_TYPE:
- case XPathResult.ORDERED_NODE_ITERATOR_TYPE:
- if (v.constructor === XNodeSet) {
- this.invalidIteratorState = false;
- this.nodes = v.toArray();
- this.iteratorIndex = 0;
- return;
- }
- break;
- case XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE:
- case XPathResult.ORDERED_NODE_SNAPSHOT_TYPE:
- if (v.constructor === XNodeSet) {
- this.nodes = v.toArray();
- this.snapshotLength = this.nodes.length;
- return;
- }
- break;
- }
- throw new XPathException(XPathException.TYPE_ERR);
- }
- ;
- XPathResult.prototype.iterateNext = function() {
- if (this.resultType != XPathResult.UNORDERED_NODE_ITERATOR_TYPE && this.resultType != XPathResult.ORDERED_NODE_ITERATOR_TYPE) {
- throw new XPathException(XPathException.TYPE_ERR);
- }
- return this.nodes[this.iteratorIndex++];
- };
- XPathResult.prototype.snapshotItem = function(i) {
- if (this.resultType != XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE && this.resultType != XPathResult.ORDERED_NODE_SNAPSHOT_TYPE) {
- throw new XPathException(XPathException.TYPE_ERR);
- }
- return this.nodes[i];
- };
- XPathResult.ANY_TYPE = 0;
- XPathResult.NUMBER_TYPE = 1;
- XPathResult.STRING_TYPE = 2;
- XPathResult.BOOLEAN_TYPE = 3;
- XPathResult.UNORDERED_NODE_ITERATOR_TYPE = 4;
- XPathResult.ORDERED_NODE_ITERATOR_TYPE = 5;
- XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE = 6;
- XPathResult.ORDERED_NODE_SNAPSHOT_TYPE = 7;
- XPathResult.ANY_UNORDERED_NODE_TYPE = 8;
- XPathResult.FIRST_ORDERED_NODE_TYPE = 9;
- function installDOM3XPathSupport(doc, p) {
- doc.createExpression = function(e, r) {
- try {
- return new XPathExpression(e, r, p);
- } catch (e2) {
- throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, e2);
- }
- };
- doc.createNSResolver = function(n) {
- return new NodeXPathNSResolver(n);
- };
- doc.evaluate = function(e, cn, r, t, res) {
- if (t < 0 || t > 9) {
- throw { code: 0, toString: function() {
- return "Request type not supported";
- } };
- }
- return doc.createExpression(e, r, p).evaluate(cn, t, res);
- };
- }
- ;
- try {
- var shouldInstall = true;
- try {
- if (document.implementation && document.implementation.hasFeature && document.implementation.hasFeature("XPath", null)) {
- shouldInstall = false;
- }
- } catch (e) {
- }
- if (shouldInstall) {
- installDOM3XPathSupport(document, new XPathParser());
- }
- } catch (e) {
- }
- installDOM3XPathSupport(exports3, new XPathParser());
- (function() {
- var parser = new XPathParser();
- var defaultNSResolver = new NamespaceResolver();
- var defaultFunctionResolver = new FunctionResolver();
- var defaultVariableResolver = new VariableResolver();
- function makeNSResolverFromFunction(func) {
- return {
- getNamespace: function(prefix, node) {
- var ns = func(prefix, node);
- return ns || defaultNSResolver.getNamespace(prefix, node);
- }
- };
- }
- function makeNSResolverFromObject(obj) {
- return makeNSResolverFromFunction(obj.getNamespace.bind(obj));
- }
- function makeNSResolverFromMap(map2) {
- return makeNSResolverFromFunction(function(prefix) {
- return map2[prefix];
- });
- }
- function makeNSResolver(resolver) {
- if (resolver && typeof resolver.getNamespace === "function") {
- return makeNSResolverFromObject(resolver);
- }
- if (typeof resolver === "function") {
- return makeNSResolverFromFunction(resolver);
- }
- if (typeof resolver === "object") {
- return makeNSResolverFromMap(resolver);
- }
- return defaultNSResolver;
- }
- function convertValue(value) {
- if (value === null || typeof value === "undefined" || value instanceof XString || value instanceof XBoolean || value instanceof XNumber || value instanceof XNodeSet) {
- return value;
- }
- switch (typeof value) {
- case "string":
- return new XString(value);
- case "boolean":
- return new XBoolean(value);
- case "number":
- return new XNumber(value);
- }
- var ns = new XNodeSet();
- ns.addArray([].concat(value));
- return ns;
- }
- function makeEvaluator(func) {
- return function(context) {
- var args = Array.prototype.slice.call(arguments, 1).map(function(arg) {
- return arg.evaluate(context);
- });
- var result = func.apply(this, [].concat(context, args));
- return convertValue(result);
- };
- }
- function makeFunctionResolverFromFunction(func) {
- return {
- getFunction: function(name2, namespace) {
- var found = func(name2, namespace);
- if (found) {
- return makeEvaluator(found);
- }
- return defaultFunctionResolver.getFunction(name2, namespace);
- }
- };
- }
- function makeFunctionResolverFromObject(obj) {
- return makeFunctionResolverFromFunction(obj.getFunction.bind(obj));
- }
- function makeFunctionResolverFromMap(map2) {
- return makeFunctionResolverFromFunction(function(name2) {
- return map2[name2];
- });
- }
- function makeFunctionResolver(resolver) {
- if (resolver && typeof resolver.getFunction === "function") {
- return makeFunctionResolverFromObject(resolver);
- }
- if (typeof resolver === "function") {
- return makeFunctionResolverFromFunction(resolver);
- }
- if (typeof resolver === "object") {
- return makeFunctionResolverFromMap(resolver);
- }
- return defaultFunctionResolver;
- }
- function makeVariableResolverFromFunction(func) {
- return {
- getVariable: function(name2, namespace) {
- var value = func(name2, namespace);
- return convertValue(value);
- }
- };
- }
- function makeVariableResolver(resolver) {
- if (resolver) {
- if (typeof resolver.getVariable === "function") {
- return makeVariableResolverFromFunction(resolver.getVariable.bind(resolver));
- }
- if (typeof resolver === "function") {
- return makeVariableResolverFromFunction(resolver);
- }
- if (typeof resolver === "object") {
- return makeVariableResolverFromFunction(function(name2) {
- return resolver[name2];
- });
- }
- }
- return defaultVariableResolver;
- }
- function copyIfPresent(prop, dest, source) {
- if (prop in source) {
- dest[prop] = source[prop];
- }
- }
- function makeContext(options) {
- var context = new XPathContext();
- if (options) {
- context.namespaceResolver = makeNSResolver(options.namespaces);
- context.functionResolver = makeFunctionResolver(options.functions);
- context.variableResolver = makeVariableResolver(options.variables);
- context.expressionContextNode = options.node;
- copyIfPresent("allowAnyNamespaceForNoPrefix", context, options);
- copyIfPresent("isHtml", context, options);
- } else {
- context.namespaceResolver = defaultNSResolver;
- }
- return context;
- }
- function evaluate(parsedExpression, options) {
- var context = makeContext(options);
- return parsedExpression.evaluate(context);
- }
- var evaluatorPrototype = {
- evaluate: function(options) {
- return evaluate(this.expression, options);
- },
- evaluateNumber: function(options) {
- return this.evaluate(options).numberValue();
- },
- evaluateString: function(options) {
- return this.evaluate(options).stringValue();
- },
- evaluateBoolean: function(options) {
- return this.evaluate(options).booleanValue();
- },
- evaluateNodeSet: function(options) {
- return this.evaluate(options).nodeset();
- },
- select: function(options) {
- return this.evaluateNodeSet(options).toArray();
- },
- select1: function(options) {
- return this.select(options)[0];
- }
- };
- function parse(xpath3) {
- var parsed = parser.parse(xpath3);
- return Object.create(evaluatorPrototype, {
- expression: {
- value: parsed
- }
- });
- }
- exports3.parse = parse;
- })();
- assign(
- exports3,
- {
- XPath,
- XPathParser,
- XPathResult,
- Step,
- PathExpr,
- NodeTest,
- LocationPath,
- OrOperation,
- AndOperation,
- BarOperation,
- EqualsOperation,
- NotEqualOperation,
- LessThanOperation,
- GreaterThanOperation,
- LessThanOrEqualOperation,
- GreaterThanOrEqualOperation,
- PlusOperation,
- MinusOperation,
- MultiplyOperation,
- DivOperation,
- ModOperation,
- UnaryMinusOperation,
- FunctionCall,
- VariableReference,
- XPathContext,
- XNodeSet,
- XBoolean,
- XString,
- XNumber,
- NamespaceResolver,
- FunctionResolver,
- VariableResolver,
- Utilities
- }
- );
- exports3.select = function(e, doc, single) {
- return exports3.selectWithResolver(e, doc, null, single);
- };
- exports3.useNamespaces = function(mappings) {
- var resolver = {
- mappings: mappings || {},
- lookupNamespaceURI: function(prefix) {
- return this.mappings[prefix];
- }
- };
- return function(e, doc, single) {
- return exports3.selectWithResolver(e, doc, resolver, single);
- };
- };
- exports3.selectWithResolver = function(e, doc, resolver, single) {
- var expression = new XPathExpression(e, resolver, new XPathParser());
- var type = XPathResult.ANY_TYPE;
- var result = expression.evaluate(doc, type, null);
- if (result.resultType == XPathResult.STRING_TYPE) {
- result = result.stringValue;
- } else if (result.resultType == XPathResult.NUMBER_TYPE) {
- result = result.numberValue;
- } else if (result.resultType == XPathResult.BOOLEAN_TYPE) {
- result = result.booleanValue;
- } else {
- result = result.nodes;
- if (single) {
- result = result[0];
- }
- }
- return result;
- };
- exports3.select1 = function(e, doc) {
- return exports3.select(e, doc, true);
- };
- var isArrayOfNodes = function(value) {
- return Array.isArray(value) && value.every(isNodeLike);
- };
- var isNodeOfType = function(type) {
- return function(value) {
- return isNodeLike(value) && value.nodeType === type;
- };
- };
- assign(
- exports3,
- {
- isNodeLike,
- isArrayOfNodes,
- isElement: isNodeOfType(NodeTypes.ELEMENT_NODE),
- isAttribute: isNodeOfType(NodeTypes.ATTRIBUTE_NODE),
- isTextNode: isNodeOfType(NodeTypes.TEXT_NODE),
- isCDATASection: isNodeOfType(NodeTypes.CDATA_SECTION_NODE),
- isProcessingInstruction: isNodeOfType(NodeTypes.PROCESSING_INSTRUCTION_NODE),
- isComment: isNodeOfType(NodeTypes.COMMENT_NODE),
- isDocumentNode: isNodeOfType(NodeTypes.DOCUMENT_NODE),
- isDocumentTypeNode: isNodeOfType(NodeTypes.DOCUMENT_TYPE_NODE),
- isDocumentFragment: isNodeOfType(NodeTypes.DOCUMENT_FRAGMENT_NODE)
- }
- );
- })(xpath2);
- }
-});
-
-// src/index.ts
-var src_exports = {};
-__export(src_exports, {
- plugin: () => plugin
-});
-module.exports = __toCommonJS(src_exports);
-var import_xmldom = __toESM(require_lib());
-var import_xpath = __toESM(require_xpath());
-var plugin = {
- filter: {
- name: "XPath",
- description: "Filter XPath",
- onFilter(_ctx, args) {
- const doc = new import_xmldom.DOMParser().parseFromString(args.payload, "text/xml");
- const result = import_xpath.default.select(args.filter, doc, false);
- if (Array.isArray(result)) {
- return { filtered: result.map((r) => String(r)).join("\n") };
- } else {
- return { filtered: String(result) };
- }
- }
- }
-};
-// Annotate the CommonJS export names for ESM import in node:
-0 && (module.exports = {
- plugin
-});
diff --git a/src-tauri/vendored/plugins/importer-curl/build/index.js b/src-tauri/vendored/plugins/importer-curl/build/index.js
deleted file mode 100644
index 23d09ea5..00000000
--- a/src-tauri/vendored/plugins/importer-curl/build/index.js
+++ /dev/null
@@ -1,591 +0,0 @@
-"use strict";
-var __create = Object.create;
-var __defProp = Object.defineProperty;
-var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
-var __getOwnPropNames = Object.getOwnPropertyNames;
-var __getProtoOf = Object.getPrototypeOf;
-var __hasOwnProp = Object.prototype.hasOwnProperty;
-var __commonJS = (cb, mod) => function __require() {
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
-};
-var __export = (target, all) => {
- for (var name in all)
- __defProp(target, name, { get: all[name], enumerable: true });
-};
-var __copyProps = (to, from, except, desc) => {
- if (from && typeof from === "object" || typeof from === "function") {
- for (let key of __getOwnPropNames(from))
- if (!__hasOwnProp.call(to, key) && key !== except)
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
- }
- return to;
-};
-var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
- // If the importer is in node compatibility mode or this is not an ESM
- // file that has been converted to a CommonJS file using a Babel-
- // compatible transform (i.e. "__esModule" has not been set), then set
- // "default" to the CommonJS "module.exports" for node compatibility.
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
- mod
-));
-var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
-
-// ../../node_modules/shell-quote/quote.js
-var require_quote = __commonJS({
- "../../node_modules/shell-quote/quote.js"(exports2, module2) {
- "use strict";
- module2.exports = function quote(xs) {
- return xs.map(function(s) {
- if (s === "") {
- return "''";
- }
- if (s && typeof s === "object") {
- return s.op.replace(/(.)/g, "\\$1");
- }
- if (/["\s]/.test(s) && !/'/.test(s)) {
- return "'" + s.replace(/(['\\])/g, "\\$1") + "'";
- }
- if (/["'\s]/.test(s)) {
- return '"' + s.replace(/(["\\$`!])/g, "\\$1") + '"';
- }
- return String(s).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g, "$1\\$2");
- }).join(" ");
- };
- }
-});
-
-// ../../node_modules/shell-quote/parse.js
-var require_parse = __commonJS({
- "../../node_modules/shell-quote/parse.js"(exports2, module2) {
- "use strict";
- var CONTROL = "(?:" + [
- "\\|\\|",
- "\\&\\&",
- ";;",
- "\\|\\&",
- "\\<\\(",
- "\\<\\<\\<",
- ">>",
- ">\\&",
- "<\\&",
- "[&;()|<>]"
- ].join("|") + ")";
- var controlRE = new RegExp("^" + CONTROL + "$");
- var META = "|&;()<> \\t";
- var SINGLE_QUOTE = '"((\\\\"|[^"])*?)"';
- var DOUBLE_QUOTE = "'((\\\\'|[^'])*?)'";
- var hash = /^#$/;
- var SQ = "'";
- var DQ = '"';
- var DS = "$";
- var TOKEN = "";
- var mult = 4294967296;
- for (i = 0; i < 4; i++) {
- TOKEN += (mult * Math.random()).toString(16);
- }
- var i;
- var startsWithToken = new RegExp("^" + TOKEN);
- function matchAll(s, r) {
- var origIndex = r.lastIndex;
- var matches = [];
- var matchObj;
- while (matchObj = r.exec(s)) {
- matches.push(matchObj);
- if (r.lastIndex === matchObj.index) {
- r.lastIndex += 1;
- }
- }
- r.lastIndex = origIndex;
- return matches;
- }
- function getVar(env, pre, key) {
- var r = typeof env === "function" ? env(key) : env[key];
- if (typeof r === "undefined" && key != "") {
- r = "";
- } else if (typeof r === "undefined") {
- r = "$";
- }
- if (typeof r === "object") {
- return pre + TOKEN + JSON.stringify(r) + TOKEN;
- }
- return pre + r;
- }
- function parseInternal(string, env, opts) {
- if (!opts) {
- opts = {};
- }
- var BS = opts.escape || "\\";
- var BAREWORD = "(\\" + BS + `['"` + META + `]|[^\\s'"` + META + "])+";
- var chunker = new RegExp([
- "(" + CONTROL + ")",
- // control chars
- "(" + BAREWORD + "|" + SINGLE_QUOTE + "|" + DOUBLE_QUOTE + ")+"
- ].join("|"), "g");
- var matches = matchAll(string, chunker);
- if (matches.length === 0) {
- return [];
- }
- if (!env) {
- env = {};
- }
- var commented = false;
- return matches.map(function(match) {
- var s = match[0];
- if (!s || commented) {
- return void 0;
- }
- if (controlRE.test(s)) {
- return { op: s };
- }
- var quote = false;
- var esc = false;
- var out = "";
- var isGlob = false;
- var i2;
- function parseEnvVar() {
- i2 += 1;
- var varend;
- var varname;
- var char = s.charAt(i2);
- if (char === "{") {
- i2 += 1;
- if (s.charAt(i2) === "}") {
- throw new Error("Bad substitution: " + s.slice(i2 - 2, i2 + 1));
- }
- varend = s.indexOf("}", i2);
- if (varend < 0) {
- throw new Error("Bad substitution: " + s.slice(i2));
- }
- varname = s.slice(i2, varend);
- i2 = varend;
- } else if (/[*@#?$!_-]/.test(char)) {
- varname = char;
- i2 += 1;
- } else {
- var slicedFromI = s.slice(i2);
- varend = slicedFromI.match(/[^\w\d_]/);
- if (!varend) {
- varname = slicedFromI;
- i2 = s.length;
- } else {
- varname = slicedFromI.slice(0, varend.index);
- i2 += varend.index - 1;
- }
- }
- return getVar(env, "", varname);
- }
- for (i2 = 0; i2 < s.length; i2++) {
- var c = s.charAt(i2);
- isGlob = isGlob || !quote && (c === "*" || c === "?");
- if (esc) {
- out += c;
- esc = false;
- } else if (quote) {
- if (c === quote) {
- quote = false;
- } else if (quote == SQ) {
- out += c;
- } else {
- if (c === BS) {
- i2 += 1;
- c = s.charAt(i2);
- if (c === DQ || c === BS || c === DS) {
- out += c;
- } else {
- out += BS + c;
- }
- } else if (c === DS) {
- out += parseEnvVar();
- } else {
- out += c;
- }
- }
- } else if (c === DQ || c === SQ) {
- quote = c;
- } else if (controlRE.test(c)) {
- return { op: s };
- } else if (hash.test(c)) {
- commented = true;
- var commentObj = { comment: string.slice(match.index + i2 + 1) };
- if (out.length) {
- return [out, commentObj];
- }
- return [commentObj];
- } else if (c === BS) {
- esc = true;
- } else if (c === DS) {
- out += parseEnvVar();
- } else {
- out += c;
- }
- }
- if (isGlob) {
- return { op: "glob", pattern: out };
- }
- return out;
- }).reduce(function(prev, arg) {
- return typeof arg === "undefined" ? prev : prev.concat(arg);
- }, []);
- }
- module2.exports = function parse2(s, env, opts) {
- var mapped = parseInternal(s, env, opts);
- if (typeof env !== "function") {
- return mapped;
- }
- return mapped.reduce(function(acc, s2) {
- if (typeof s2 === "object") {
- return acc.concat(s2);
- }
- var xs = s2.split(RegExp("(" + TOKEN + ".*?" + TOKEN + ")", "g"));
- if (xs.length === 1) {
- return acc.concat(xs[0]);
- }
- return acc.concat(xs.filter(Boolean).map(function(x) {
- if (startsWithToken.test(x)) {
- return JSON.parse(x.split(TOKEN)[1]);
- }
- return x;
- }));
- }, []);
- };
- }
-});
-
-// ../../node_modules/shell-quote/index.js
-var require_shell_quote = __commonJS({
- "../../node_modules/shell-quote/index.js"(exports2) {
- "use strict";
- exports2.quote = require_quote();
- exports2.parse = require_parse();
- }
-});
-
-// src/index.ts
-var src_exports = {};
-__export(src_exports, {
- convertCurl: () => convertCurl,
- plugin: () => plugin
-});
-module.exports = __toCommonJS(src_exports);
-var import_shell_quote = __toESM(require_shell_quote());
-var DATA_FLAGS = ["d", "data", "data-raw", "data-urlencode", "data-binary", "data-ascii"];
-var SUPPORTED_FLAGS = [
- ["cookie", "b"],
- ["d", "data"],
- // Add url encoded data
- ["data-ascii"],
- ["data-binary"],
- ["data-raw"],
- ["data-urlencode"],
- ["digest"],
- // Apply auth as digest
- ["form", "F"],
- // Add multipart data
- ["get", "G"],
- // Put the post data in the URL
- ["header", "H"],
- ["request", "X"],
- // Request method
- ["url"],
- // Specify the URL explicitly
- ["url-query"],
- ["user", "u"],
- // Authentication
- DATA_FLAGS
-].flatMap((v) => v);
-var BOOLEAN_FLAGS = ["G", "get", "digest"];
-var plugin = {
- importer: {
- name: "cURL",
- description: "Import cURL commands",
- onImport(_ctx, args) {
- return convertCurl(args.text);
- }
- }
-};
-function convertCurl(rawData) {
- if (!rawData.match(/^\s*curl /)) {
- return null;
- }
- const commands = [];
- const normalizedData = rawData.replace(/\ncurl/g, "; curl");
- let currentCommand = [];
- const parsed = (0, import_shell_quote.parse)(normalizedData);
- const normalizedParseEntries = parsed.flatMap((entry) => {
- if (typeof entry === "string" && entry.startsWith("-") && !entry.startsWith("--") && entry.length > 2) {
- return [entry.slice(0, 2), entry.slice(2)];
- }
- return entry;
- });
- for (const parseEntry of normalizedParseEntries) {
- if (typeof parseEntry === "string") {
- if (parseEntry.startsWith("$")) {
- currentCommand.push(parseEntry.slice(1));
- } else {
- currentCommand.push(parseEntry);
- }
- continue;
- }
- if ("comment" in parseEntry) {
- continue;
- }
- const { op } = parseEntry;
- if (op === ";") {
- commands.push(currentCommand);
- currentCommand = [];
- continue;
- }
- if (op?.startsWith("$")) {
- const str = op.slice(2, op.length - 1).replace(/\\'/g, "'");
- currentCommand.push(str);
- continue;
- }
- if (op === "glob") {
- currentCommand.push(parseEntry.pattern);
- }
- }
- commands.push(currentCommand);
- const workspace = {
- model: "workspace",
- id: generateId("workspace"),
- name: "Curl Import"
- };
- const requests = commands.filter((command) => command[0] === "curl").map((v) => importCommand(v, workspace.id));
- return {
- resources: {
- httpRequests: requests,
- workspaces: [workspace]
- }
- };
-}
-function importCommand(parseEntries, workspaceId) {
- const flagsByName = {};
- const singletons = [];
- for (let i = 1; i < parseEntries.length; i++) {
- let parseEntry = parseEntries[i];
- if (typeof parseEntry === "string") {
- parseEntry = parseEntry.trim();
- }
- if (typeof parseEntry === "string" && parseEntry.match(/^-{1,2}[\w-]+/)) {
- const isSingleDash = parseEntry[0] === "-" && parseEntry[1] !== "-";
- let name = parseEntry.replace(/^-{1,2}/, "");
- if (!SUPPORTED_FLAGS.includes(name)) {
- continue;
- }
- let value;
- const nextEntry = parseEntries[i + 1];
- const hasValue = !BOOLEAN_FLAGS.includes(name);
- if (isSingleDash && name.length > 1) {
- value = name.slice(1);
- name = name.slice(0, 1);
- } else if (typeof nextEntry === "string" && hasValue && !nextEntry.startsWith("-")) {
- value = nextEntry;
- i++;
- } else {
- value = true;
- }
- flagsByName[name] = flagsByName[name] || [];
- flagsByName[name].push(value);
- } else if (parseEntry) {
- singletons.push(parseEntry);
- }
- }
- let urlParameters;
- let url;
- const urlArg = getPairValue(flagsByName, singletons[0] || "", ["url"]);
- const [baseUrl, search] = splitOnce(urlArg, "?");
- urlParameters = search?.split("&").map((p) => {
- const v = splitOnce(p, "=");
- return { name: decodeURIComponent(v[0] ?? ""), value: decodeURIComponent(v[1] ?? ""), enabled: true };
- }) ?? [];
- url = baseUrl ?? urlArg;
- for (const p of flagsByName["url-query"] ?? []) {
- if (typeof p !== "string") {
- continue;
- }
- const [name, value] = p.split("=");
- urlParameters.push({
- name: name ?? "",
- value: value ?? "",
- enabled: true
- });
- }
- const [username, password] = getPairValue(flagsByName, "", ["u", "user"]).split(/:(.*)$/);
- const isDigest = getPairValue(flagsByName, false, ["digest"]);
- const authenticationType = username ? isDigest ? "digest" : "basic" : null;
- const authentication = username ? {
- username: username.trim(),
- password: (password ?? "").trim()
- } : {};
- const headers = [
- ...flagsByName["header"] || [],
- ...flagsByName["H"] || []
- ].map((header) => {
- const [name, value] = header.split(/:(.*)$/);
- if (!value) {
- return {
- name: (name ?? "").trim().replace(/;$/, ""),
- value: "",
- enabled: true
- };
- }
- return {
- name: (name ?? "").trim(),
- value: value.trim(),
- enabled: true
- };
- });
- const cookieHeaderValue = [
- ...flagsByName["cookie"] || [],
- ...flagsByName["b"] || []
- ].map((str) => {
- const name = str.split("=", 1)[0];
- const value = str.replace(`${name}=`, "");
- return `${name}=${value}`;
- }).join("; ");
- const existingCookieHeader = headers.find((header) => header.name.toLowerCase() === "cookie");
- if (cookieHeaderValue && existingCookieHeader) {
- existingCookieHeader.value += `; ${cookieHeaderValue}`;
- } else if (cookieHeaderValue) {
- headers.push({
- name: "Cookie",
- value: cookieHeaderValue,
- enabled: true
- });
- }
- const dataParameters = pairsToDataParameters(flagsByName);
- const contentTypeHeader = headers.find((header) => header.name.toLowerCase() === "content-type");
- const mimeType = contentTypeHeader ? contentTypeHeader.value.split(";")[0] : null;
- const formDataParams = [
- ...flagsByName["form"] || [],
- ...flagsByName["F"] || []
- ].map((str) => {
- const parts = str.split("=");
- const name = parts[0] ?? "";
- const value = parts[1] ?? "";
- const item = {
- name,
- enabled: true
- };
- if (value.indexOf("@") === 0) {
- item["file"] = value.slice(1);
- } else {
- item["value"] = value;
- }
- return item;
- });
- let body = {};
- let bodyType = null;
- const bodyAsGET = getPairValue(flagsByName, false, ["G", "get"]);
- if (dataParameters.length > 0 && bodyAsGET) {
- urlParameters.push(...dataParameters);
- } else if (dataParameters.length > 0 && (mimeType == null || mimeType === "application/x-www-form-urlencoded")) {
- bodyType = mimeType ?? "application/x-www-form-urlencoded";
- body = {
- form: dataParameters.map((parameter) => ({
- ...parameter,
- name: decodeURIComponent(parameter.name || ""),
- value: decodeURIComponent(parameter.value || "")
- }))
- };
- headers.push({
- name: "Content-Type",
- value: "application/x-www-form-urlencoded",
- enabled: true
- });
- } else if (dataParameters.length > 0) {
- bodyType = mimeType === "application/json" || mimeType === "text/xml" || mimeType === "text/plain" ? mimeType : "other";
- body = {
- text: dataParameters.map(({ name, value }) => name && value ? `${name}=${value}` : name || value).join("&")
- };
- } else if (formDataParams.length) {
- bodyType = mimeType ?? "multipart/form-data";
- body = {
- form: formDataParams
- };
- if (mimeType == null) {
- headers.push({
- name: "Content-Type",
- value: "multipart/form-data",
- enabled: true
- });
- }
- }
- let method = getPairValue(flagsByName, "", ["X", "request"]).toUpperCase();
- if (method === "" && body) {
- method = "text" in body || "form" in body ? "POST" : "GET";
- }
- const request = {
- id: generateId("http_request"),
- model: "http_request",
- workspaceId,
- name: "",
- urlParameters,
- url,
- method,
- headers,
- authentication,
- authenticationType,
- body,
- bodyType,
- folderId: null,
- sortPriority: 0
- };
- return request;
-}
-function pairsToDataParameters(keyedPairs) {
- let dataParameters = [];
- for (const flagName of DATA_FLAGS) {
- const pairs = keyedPairs[flagName];
- if (!pairs || pairs.length === 0) {
- continue;
- }
- for (const p of pairs) {
- if (typeof p !== "string") continue;
- let params = p.split("&");
- for (const param of params) {
- const [name, value] = param.split("=");
- if (param.startsWith("@")) {
- dataParameters.push({
- name: name ?? "",
- value: "",
- filePath: param.slice(1),
- enabled: true
- });
- } else {
- dataParameters.push({
- name: name ?? "",
- value: flagName === "data-urlencode" ? encodeURIComponent(value ?? "") : value ?? "",
- enabled: true
- });
- }
- }
- }
- }
- return dataParameters;
-}
-var getPairValue = (pairsByName, defaultValue, names) => {
- for (const name of names) {
- if (pairsByName[name] && pairsByName[name].length) {
- return pairsByName[name][0];
- }
- }
- return defaultValue;
-};
-function splitOnce(str, sep) {
- const index = str.indexOf(sep);
- if (index > -1) {
- return [str.slice(0, index), str.slice(index + 1)];
- }
- return [str];
-}
-var idCount = {};
-function generateId(model) {
- idCount[model] = (idCount[model] ?? -1) + 1;
- return `GENERATE_ID::${model.toUpperCase()}_${idCount[model]}`;
-}
-// Annotate the CommonJS export names for ESM import in node:
-0 && (module.exports = {
- convertCurl,
- plugin
-});
diff --git a/src-tauri/vendored/plugins/importer-insomnia/build/index.js b/src-tauri/vendored/plugins/importer-insomnia/build/index.js
deleted file mode 100644
index c23878b0..00000000
--- a/src-tauri/vendored/plugins/importer-insomnia/build/index.js
+++ /dev/null
@@ -1,7759 +0,0 @@
-"use strict";
-var __create = Object.create;
-var __defProp = Object.defineProperty;
-var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
-var __getOwnPropNames = Object.getOwnPropertyNames;
-var __getProtoOf = Object.getPrototypeOf;
-var __hasOwnProp = Object.prototype.hasOwnProperty;
-var __commonJS = (cb, mod) => function __require() {
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
-};
-var __export = (target, all) => {
- for (var name in all)
- __defProp(target, name, { get: all[name], enumerable: true });
-};
-var __copyProps = (to, from, except, desc) => {
- if (from && typeof from === "object" || typeof from === "function") {
- for (let key of __getOwnPropNames(from))
- if (!__hasOwnProp.call(to, key) && key !== except)
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
- }
- return to;
-};
-var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
- // If the importer is in node compatibility mode or this is not an ESM
- // file that has been converted to a CommonJS file using a Babel-
- // compatible transform (i.e. "__esModule" has not been set), then set
- // "default" to the CommonJS "module.exports" for node compatibility.
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
- mod
-));
-var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
-
-// ../../node_modules/yaml/dist/nodes/identity.js
-var require_identity = __commonJS({
- "../../node_modules/yaml/dist/nodes/identity.js"(exports2) {
- "use strict";
- var ALIAS = Symbol.for("yaml.alias");
- var DOC = Symbol.for("yaml.document");
- var MAP = Symbol.for("yaml.map");
- var PAIR = Symbol.for("yaml.pair");
- var SCALAR = Symbol.for("yaml.scalar");
- var SEQ = Symbol.for("yaml.seq");
- var NODE_TYPE = Symbol.for("yaml.node.type");
- var isAlias = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === ALIAS;
- var isDocument = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === DOC;
- var isMap = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === MAP;
- var isPair = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === PAIR;
- var isScalar = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === SCALAR;
- var isSeq = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === SEQ;
- function isCollection(node) {
- if (node && typeof node === "object")
- switch (node[NODE_TYPE]) {
- case MAP:
- case SEQ:
- return true;
- }
- return false;
- }
- function isNode(node) {
- if (node && typeof node === "object")
- switch (node[NODE_TYPE]) {
- case ALIAS:
- case MAP:
- case SCALAR:
- case SEQ:
- return true;
- }
- return false;
- }
- var hasAnchor = (node) => (isScalar(node) || isCollection(node)) && !!node.anchor;
- exports2.ALIAS = ALIAS;
- exports2.DOC = DOC;
- exports2.MAP = MAP;
- exports2.NODE_TYPE = NODE_TYPE;
- exports2.PAIR = PAIR;
- exports2.SCALAR = SCALAR;
- exports2.SEQ = SEQ;
- exports2.hasAnchor = hasAnchor;
- exports2.isAlias = isAlias;
- exports2.isCollection = isCollection;
- exports2.isDocument = isDocument;
- exports2.isMap = isMap;
- exports2.isNode = isNode;
- exports2.isPair = isPair;
- exports2.isScalar = isScalar;
- exports2.isSeq = isSeq;
- }
-});
-
-// ../../node_modules/yaml/dist/visit.js
-var require_visit = __commonJS({
- "../../node_modules/yaml/dist/visit.js"(exports2) {
- "use strict";
- var identity = require_identity();
- var BREAK = Symbol("break visit");
- var SKIP = Symbol("skip children");
- var REMOVE = Symbol("remove node");
- function visit(node, visitor) {
- const visitor_ = initVisitor(visitor);
- if (identity.isDocument(node)) {
- const cd = visit_(null, node.contents, visitor_, Object.freeze([node]));
- if (cd === REMOVE)
- node.contents = null;
- } else
- visit_(null, node, visitor_, Object.freeze([]));
- }
- visit.BREAK = BREAK;
- visit.SKIP = SKIP;
- visit.REMOVE = REMOVE;
- function visit_(key, node, visitor, path) {
- const ctrl = callVisitor(key, node, visitor, path);
- if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
- replaceNode(key, path, ctrl);
- return visit_(key, ctrl, visitor, path);
- }
- if (typeof ctrl !== "symbol") {
- if (identity.isCollection(node)) {
- path = Object.freeze(path.concat(node));
- for (let i = 0; i < node.items.length; ++i) {
- const ci = visit_(i, node.items[i], visitor, path);
- if (typeof ci === "number")
- i = ci - 1;
- else if (ci === BREAK)
- return BREAK;
- else if (ci === REMOVE) {
- node.items.splice(i, 1);
- i -= 1;
- }
- }
- } else if (identity.isPair(node)) {
- path = Object.freeze(path.concat(node));
- const ck = visit_("key", node.key, visitor, path);
- if (ck === BREAK)
- return BREAK;
- else if (ck === REMOVE)
- node.key = null;
- const cv = visit_("value", node.value, visitor, path);
- if (cv === BREAK)
- return BREAK;
- else if (cv === REMOVE)
- node.value = null;
- }
- }
- return ctrl;
- }
- async function visitAsync(node, visitor) {
- const visitor_ = initVisitor(visitor);
- if (identity.isDocument(node)) {
- const cd = await visitAsync_(null, node.contents, visitor_, Object.freeze([node]));
- if (cd === REMOVE)
- node.contents = null;
- } else
- await visitAsync_(null, node, visitor_, Object.freeze([]));
- }
- visitAsync.BREAK = BREAK;
- visitAsync.SKIP = SKIP;
- visitAsync.REMOVE = REMOVE;
- async function visitAsync_(key, node, visitor, path) {
- const ctrl = await callVisitor(key, node, visitor, path);
- if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
- replaceNode(key, path, ctrl);
- return visitAsync_(key, ctrl, visitor, path);
- }
- if (typeof ctrl !== "symbol") {
- if (identity.isCollection(node)) {
- path = Object.freeze(path.concat(node));
- for (let i = 0; i < node.items.length; ++i) {
- const ci = await visitAsync_(i, node.items[i], visitor, path);
- if (typeof ci === "number")
- i = ci - 1;
- else if (ci === BREAK)
- return BREAK;
- else if (ci === REMOVE) {
- node.items.splice(i, 1);
- i -= 1;
- }
- }
- } else if (identity.isPair(node)) {
- path = Object.freeze(path.concat(node));
- const ck = await visitAsync_("key", node.key, visitor, path);
- if (ck === BREAK)
- return BREAK;
- else if (ck === REMOVE)
- node.key = null;
- const cv = await visitAsync_("value", node.value, visitor, path);
- if (cv === BREAK)
- return BREAK;
- else if (cv === REMOVE)
- node.value = null;
- }
- }
- return ctrl;
- }
- function initVisitor(visitor) {
- if (typeof visitor === "object" && (visitor.Collection || visitor.Node || visitor.Value)) {
- return Object.assign({
- Alias: visitor.Node,
- Map: visitor.Node,
- Scalar: visitor.Node,
- Seq: visitor.Node
- }, visitor.Value && {
- Map: visitor.Value,
- Scalar: visitor.Value,
- Seq: visitor.Value
- }, visitor.Collection && {
- Map: visitor.Collection,
- Seq: visitor.Collection
- }, visitor);
- }
- return visitor;
- }
- function callVisitor(key, node, visitor, path) {
- if (typeof visitor === "function")
- return visitor(key, node, path);
- if (identity.isMap(node))
- return visitor.Map?.(key, node, path);
- if (identity.isSeq(node))
- return visitor.Seq?.(key, node, path);
- if (identity.isPair(node))
- return visitor.Pair?.(key, node, path);
- if (identity.isScalar(node))
- return visitor.Scalar?.(key, node, path);
- if (identity.isAlias(node))
- return visitor.Alias?.(key, node, path);
- return void 0;
- }
- function replaceNode(key, path, node) {
- const parent = path[path.length - 1];
- if (identity.isCollection(parent)) {
- parent.items[key] = node;
- } else if (identity.isPair(parent)) {
- if (key === "key")
- parent.key = node;
- else
- parent.value = node;
- } else if (identity.isDocument(parent)) {
- parent.contents = node;
- } else {
- const pt = identity.isAlias(parent) ? "alias" : "scalar";
- throw new Error(`Cannot replace node with ${pt} parent`);
- }
- }
- exports2.visit = visit;
- exports2.visitAsync = visitAsync;
- }
-});
-
-// ../../node_modules/yaml/dist/doc/directives.js
-var require_directives = __commonJS({
- "../../node_modules/yaml/dist/doc/directives.js"(exports2) {
- "use strict";
- var identity = require_identity();
- var visit = require_visit();
- var escapeChars = {
- "!": "%21",
- ",": "%2C",
- "[": "%5B",
- "]": "%5D",
- "{": "%7B",
- "}": "%7D"
- };
- var escapeTagName = (tn) => tn.replace(/[!,[\]{}]/g, (ch) => escapeChars[ch]);
- var Directives = class _Directives {
- constructor(yaml, tags) {
- this.docStart = null;
- this.docEnd = false;
- this.yaml = Object.assign({}, _Directives.defaultYaml, yaml);
- this.tags = Object.assign({}, _Directives.defaultTags, tags);
- }
- clone() {
- const copy = new _Directives(this.yaml, this.tags);
- copy.docStart = this.docStart;
- return copy;
- }
- /**
- * During parsing, get a Directives instance for the current document and
- * update the stream state according to the current version's spec.
- */
- atDocument() {
- const res = new _Directives(this.yaml, this.tags);
- switch (this.yaml.version) {
- case "1.1":
- this.atNextDocument = true;
- break;
- case "1.2":
- this.atNextDocument = false;
- this.yaml = {
- explicit: _Directives.defaultYaml.explicit,
- version: "1.2"
- };
- this.tags = Object.assign({}, _Directives.defaultTags);
- break;
- }
- return res;
- }
- /**
- * @param onError - May be called even if the action was successful
- * @returns `true` on success
- */
- add(line, onError) {
- if (this.atNextDocument) {
- this.yaml = { explicit: _Directives.defaultYaml.explicit, version: "1.1" };
- this.tags = Object.assign({}, _Directives.defaultTags);
- this.atNextDocument = false;
- }
- const parts = line.trim().split(/[ \t]+/);
- const name = parts.shift();
- switch (name) {
- case "%TAG": {
- if (parts.length !== 2) {
- onError(0, "%TAG directive should contain exactly two parts");
- if (parts.length < 2)
- return false;
- }
- const [handle, prefix] = parts;
- this.tags[handle] = prefix;
- return true;
- }
- case "%YAML": {
- this.yaml.explicit = true;
- if (parts.length !== 1) {
- onError(0, "%YAML directive should contain exactly one part");
- return false;
- }
- const [version] = parts;
- if (version === "1.1" || version === "1.2") {
- this.yaml.version = version;
- return true;
- } else {
- const isValid = /^\d+\.\d+$/.test(version);
- onError(6, `Unsupported YAML version ${version}`, isValid);
- return false;
- }
- }
- default:
- onError(0, `Unknown directive ${name}`, true);
- return false;
- }
- }
- /**
- * Resolves a tag, matching handles to those defined in %TAG directives.
- *
- * @returns Resolved tag, which may also be the non-specific tag `'!'` or a
- * `'!local'` tag, or `null` if unresolvable.
- */
- tagName(source, onError) {
- if (source === "!")
- return "!";
- if (source[0] !== "!") {
- onError(`Not a valid tag: ${source}`);
- return null;
- }
- if (source[1] === "<") {
- const verbatim = source.slice(2, -1);
- if (verbatim === "!" || verbatim === "!!") {
- onError(`Verbatim tags aren't resolved, so ${source} is invalid.`);
- return null;
- }
- if (source[source.length - 1] !== ">")
- onError("Verbatim tags must end with a >");
- return verbatim;
- }
- const [, handle, suffix] = source.match(/^(.*!)([^!]*)$/s);
- if (!suffix)
- onError(`The ${source} tag has no suffix`);
- const prefix = this.tags[handle];
- if (prefix) {
- try {
- return prefix + decodeURIComponent(suffix);
- } catch (error) {
- onError(String(error));
- return null;
- }
- }
- if (handle === "!")
- return source;
- onError(`Could not resolve tag: ${source}`);
- return null;
- }
- /**
- * Given a fully resolved tag, returns its printable string form,
- * taking into account current tag prefixes and defaults.
- */
- tagString(tag) {
- for (const [handle, prefix] of Object.entries(this.tags)) {
- if (tag.startsWith(prefix))
- return handle + escapeTagName(tag.substring(prefix.length));
- }
- return tag[0] === "!" ? tag : `!<${tag}>`;
- }
- toString(doc) {
- const lines = this.yaml.explicit ? [`%YAML ${this.yaml.version || "1.2"}`] : [];
- const tagEntries = Object.entries(this.tags);
- let tagNames;
- if (doc && tagEntries.length > 0 && identity.isNode(doc.contents)) {
- const tags = {};
- visit.visit(doc.contents, (_key, node) => {
- if (identity.isNode(node) && node.tag)
- tags[node.tag] = true;
- });
- tagNames = Object.keys(tags);
- } else
- tagNames = [];
- for (const [handle, prefix] of tagEntries) {
- if (handle === "!!" && prefix === "tag:yaml.org,2002:")
- continue;
- if (!doc || tagNames.some((tn) => tn.startsWith(prefix)))
- lines.push(`%TAG ${handle} ${prefix}`);
- }
- return lines.join("\n");
- }
- };
- Directives.defaultYaml = { explicit: false, version: "1.2" };
- Directives.defaultTags = { "!!": "tag:yaml.org,2002:" };
- exports2.Directives = Directives;
- }
-});
-
-// ../../node_modules/yaml/dist/doc/anchors.js
-var require_anchors = __commonJS({
- "../../node_modules/yaml/dist/doc/anchors.js"(exports2) {
- "use strict";
- var identity = require_identity();
- var visit = require_visit();
- function anchorIsValid(anchor) {
- if (/[\x00-\x19\s,[\]{}]/.test(anchor)) {
- const sa = JSON.stringify(anchor);
- const msg = `Anchor must not contain whitespace or control characters: ${sa}`;
- throw new Error(msg);
- }
- return true;
- }
- function anchorNames(root) {
- const anchors = /* @__PURE__ */ new Set();
- visit.visit(root, {
- Value(_key, node) {
- if (node.anchor)
- anchors.add(node.anchor);
- }
- });
- return anchors;
- }
- function findNewAnchor(prefix, exclude) {
- for (let i = 1; true; ++i) {
- const name = `${prefix}${i}`;
- if (!exclude.has(name))
- return name;
- }
- }
- function createNodeAnchors(doc, prefix) {
- const aliasObjects = [];
- const sourceObjects = /* @__PURE__ */ new Map();
- let prevAnchors = null;
- return {
- onAnchor: (source) => {
- aliasObjects.push(source);
- if (!prevAnchors)
- prevAnchors = anchorNames(doc);
- const anchor = findNewAnchor(prefix, prevAnchors);
- prevAnchors.add(anchor);
- return anchor;
- },
- /**
- * With circular references, the source node is only resolved after all
- * of its child nodes are. This is why anchors are set only after all of
- * the nodes have been created.
- */
- setAnchors: () => {
- for (const source of aliasObjects) {
- const ref = sourceObjects.get(source);
- if (typeof ref === "object" && ref.anchor && (identity.isScalar(ref.node) || identity.isCollection(ref.node))) {
- ref.node.anchor = ref.anchor;
- } else {
- const error = new Error("Failed to resolve repeated object (this should not happen)");
- error.source = source;
- throw error;
- }
- }
- },
- sourceObjects
- };
- }
- exports2.anchorIsValid = anchorIsValid;
- exports2.anchorNames = anchorNames;
- exports2.createNodeAnchors = createNodeAnchors;
- exports2.findNewAnchor = findNewAnchor;
- }
-});
-
-// ../../node_modules/yaml/dist/doc/applyReviver.js
-var require_applyReviver = __commonJS({
- "../../node_modules/yaml/dist/doc/applyReviver.js"(exports2) {
- "use strict";
- function applyReviver(reviver, obj, key, val) {
- if (val && typeof val === "object") {
- if (Array.isArray(val)) {
- for (let i = 0, len = val.length; i < len; ++i) {
- const v0 = val[i];
- const v1 = applyReviver(reviver, val, String(i), v0);
- if (v1 === void 0)
- delete val[i];
- else if (v1 !== v0)
- val[i] = v1;
- }
- } else if (val instanceof Map) {
- for (const k of Array.from(val.keys())) {
- const v0 = val.get(k);
- const v1 = applyReviver(reviver, val, k, v0);
- if (v1 === void 0)
- val.delete(k);
- else if (v1 !== v0)
- val.set(k, v1);
- }
- } else if (val instanceof Set) {
- for (const v0 of Array.from(val)) {
- const v1 = applyReviver(reviver, val, v0, v0);
- if (v1 === void 0)
- val.delete(v0);
- else if (v1 !== v0) {
- val.delete(v0);
- val.add(v1);
- }
- }
- } else {
- for (const [k, v0] of Object.entries(val)) {
- const v1 = applyReviver(reviver, val, k, v0);
- if (v1 === void 0)
- delete val[k];
- else if (v1 !== v0)
- val[k] = v1;
- }
- }
- }
- return reviver.call(obj, key, val);
- }
- exports2.applyReviver = applyReviver;
- }
-});
-
-// ../../node_modules/yaml/dist/nodes/toJS.js
-var require_toJS = __commonJS({
- "../../node_modules/yaml/dist/nodes/toJS.js"(exports2) {
- "use strict";
- var identity = require_identity();
- function toJS(value, arg, ctx) {
- if (Array.isArray(value))
- return value.map((v, i) => toJS(v, String(i), ctx));
- if (value && typeof value.toJSON === "function") {
- if (!ctx || !identity.hasAnchor(value))
- return value.toJSON(arg, ctx);
- const data = { aliasCount: 0, count: 1, res: void 0 };
- ctx.anchors.set(value, data);
- ctx.onCreate = (res2) => {
- data.res = res2;
- delete ctx.onCreate;
- };
- const res = value.toJSON(arg, ctx);
- if (ctx.onCreate)
- ctx.onCreate(res);
- return res;
- }
- if (typeof value === "bigint" && !ctx?.keep)
- return Number(value);
- return value;
- }
- exports2.toJS = toJS;
- }
-});
-
-// ../../node_modules/yaml/dist/nodes/Node.js
-var require_Node = __commonJS({
- "../../node_modules/yaml/dist/nodes/Node.js"(exports2) {
- "use strict";
- var applyReviver = require_applyReviver();
- var identity = require_identity();
- var toJS = require_toJS();
- var NodeBase = class {
- constructor(type) {
- Object.defineProperty(this, identity.NODE_TYPE, { value: type });
- }
- /** Create a copy of this node. */
- clone() {
- const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
- if (this.range)
- copy.range = this.range.slice();
- return copy;
- }
- /** A plain JavaScript representation of this node. */
- toJS(doc, { mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {
- if (!identity.isDocument(doc))
- throw new TypeError("A document argument is required");
- const ctx = {
- anchors: /* @__PURE__ */ new Map(),
- doc,
- keep: true,
- mapAsMap: mapAsMap === true,
- mapKeyWarned: false,
- maxAliasCount: typeof maxAliasCount === "number" ? maxAliasCount : 100
- };
- const res = toJS.toJS(this, "", ctx);
- if (typeof onAnchor === "function")
- for (const { count, res: res2 } of ctx.anchors.values())
- onAnchor(res2, count);
- return typeof reviver === "function" ? applyReviver.applyReviver(reviver, { "": res }, "", res) : res;
- }
- };
- exports2.NodeBase = NodeBase;
- }
-});
-
-// ../../node_modules/yaml/dist/nodes/Alias.js
-var require_Alias = __commonJS({
- "../../node_modules/yaml/dist/nodes/Alias.js"(exports2) {
- "use strict";
- var anchors = require_anchors();
- var visit = require_visit();
- var identity = require_identity();
- var Node = require_Node();
- var toJS = require_toJS();
- var Alias = class extends Node.NodeBase {
- constructor(source) {
- super(identity.ALIAS);
- this.source = source;
- Object.defineProperty(this, "tag", {
- set() {
- throw new Error("Alias nodes cannot have tags");
- }
- });
- }
- /**
- * Resolve the value of this alias within `doc`, finding the last
- * instance of the `source` anchor before this node.
- */
- resolve(doc) {
- let found = void 0;
- visit.visit(doc, {
- Node: (_key, node) => {
- if (node === this)
- return visit.visit.BREAK;
- if (node.anchor === this.source)
- found = node;
- }
- });
- return found;
- }
- toJSON(_arg, ctx) {
- if (!ctx)
- return { source: this.source };
- const { anchors: anchors2, doc, maxAliasCount } = ctx;
- const source = this.resolve(doc);
- if (!source) {
- const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
- throw new ReferenceError(msg);
- }
- let data = anchors2.get(source);
- if (!data) {
- toJS.toJS(source, null, ctx);
- data = anchors2.get(source);
- }
- if (!data || data.res === void 0) {
- const msg = "This should not happen: Alias anchor was not resolved?";
- throw new ReferenceError(msg);
- }
- if (maxAliasCount >= 0) {
- data.count += 1;
- if (data.aliasCount === 0)
- data.aliasCount = getAliasCount(doc, source, anchors2);
- if (data.count * data.aliasCount > maxAliasCount) {
- const msg = "Excessive alias count indicates a resource exhaustion attack";
- throw new ReferenceError(msg);
- }
- }
- return data.res;
- }
- toString(ctx, _onComment, _onChompKeep) {
- const src = `*${this.source}`;
- if (ctx) {
- anchors.anchorIsValid(this.source);
- if (ctx.options.verifyAliasOrder && !ctx.anchors.has(this.source)) {
- const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
- throw new Error(msg);
- }
- if (ctx.implicitKey)
- return `${src} `;
- }
- return src;
- }
- };
- function getAliasCount(doc, node, anchors2) {
- if (identity.isAlias(node)) {
- const source = node.resolve(doc);
- const anchor = anchors2 && source && anchors2.get(source);
- return anchor ? anchor.count * anchor.aliasCount : 0;
- } else if (identity.isCollection(node)) {
- let count = 0;
- for (const item of node.items) {
- const c = getAliasCount(doc, item, anchors2);
- if (c > count)
- count = c;
- }
- return count;
- } else if (identity.isPair(node)) {
- const kc = getAliasCount(doc, node.key, anchors2);
- const vc = getAliasCount(doc, node.value, anchors2);
- return Math.max(kc, vc);
- }
- return 1;
- }
- exports2.Alias = Alias;
- }
-});
-
-// ../../node_modules/yaml/dist/nodes/Scalar.js
-var require_Scalar = __commonJS({
- "../../node_modules/yaml/dist/nodes/Scalar.js"(exports2) {
- "use strict";
- var identity = require_identity();
- var Node = require_Node();
- var toJS = require_toJS();
- var isScalarValue = (value) => !value || typeof value !== "function" && typeof value !== "object";
- var Scalar = class extends Node.NodeBase {
- constructor(value) {
- super(identity.SCALAR);
- this.value = value;
- }
- toJSON(arg, ctx) {
- return ctx?.keep ? this.value : toJS.toJS(this.value, arg, ctx);
- }
- toString() {
- return String(this.value);
- }
- };
- Scalar.BLOCK_FOLDED = "BLOCK_FOLDED";
- Scalar.BLOCK_LITERAL = "BLOCK_LITERAL";
- Scalar.PLAIN = "PLAIN";
- Scalar.QUOTE_DOUBLE = "QUOTE_DOUBLE";
- Scalar.QUOTE_SINGLE = "QUOTE_SINGLE";
- exports2.Scalar = Scalar;
- exports2.isScalarValue = isScalarValue;
- }
-});
-
-// ../../node_modules/yaml/dist/doc/createNode.js
-var require_createNode = __commonJS({
- "../../node_modules/yaml/dist/doc/createNode.js"(exports2) {
- "use strict";
- var Alias = require_Alias();
- var identity = require_identity();
- var Scalar = require_Scalar();
- var defaultTagPrefix = "tag:yaml.org,2002:";
- function findTagObject(value, tagName, tags) {
- if (tagName) {
- const match = tags.filter((t) => t.tag === tagName);
- const tagObj = match.find((t) => !t.format) ?? match[0];
- if (!tagObj)
- throw new Error(`Tag ${tagName} not found`);
- return tagObj;
- }
- return tags.find((t) => t.identify?.(value) && !t.format);
- }
- function createNode(value, tagName, ctx) {
- if (identity.isDocument(value))
- value = value.contents;
- if (identity.isNode(value))
- return value;
- if (identity.isPair(value)) {
- const map = ctx.schema[identity.MAP].createNode?.(ctx.schema, null, ctx);
- map.items.push(value);
- return map;
- }
- if (value instanceof String || value instanceof Number || value instanceof Boolean || typeof BigInt !== "undefined" && value instanceof BigInt) {
- value = value.valueOf();
- }
- const { aliasDuplicateObjects, onAnchor, onTagObj, schema, sourceObjects } = ctx;
- let ref = void 0;
- if (aliasDuplicateObjects && value && typeof value === "object") {
- ref = sourceObjects.get(value);
- if (ref) {
- if (!ref.anchor)
- ref.anchor = onAnchor(value);
- return new Alias.Alias(ref.anchor);
- } else {
- ref = { anchor: null, node: null };
- sourceObjects.set(value, ref);
- }
- }
- if (tagName?.startsWith("!!"))
- tagName = defaultTagPrefix + tagName.slice(2);
- let tagObj = findTagObject(value, tagName, schema.tags);
- if (!tagObj) {
- if (value && typeof value.toJSON === "function") {
- value = value.toJSON();
- }
- if (!value || typeof value !== "object") {
- const node2 = new Scalar.Scalar(value);
- if (ref)
- ref.node = node2;
- return node2;
- }
- tagObj = value instanceof Map ? schema[identity.MAP] : Symbol.iterator in Object(value) ? schema[identity.SEQ] : schema[identity.MAP];
- }
- if (onTagObj) {
- onTagObj(tagObj);
- delete ctx.onTagObj;
- }
- const node = tagObj?.createNode ? tagObj.createNode(ctx.schema, value, ctx) : typeof tagObj?.nodeClass?.from === "function" ? tagObj.nodeClass.from(ctx.schema, value, ctx) : new Scalar.Scalar(value);
- if (tagName)
- node.tag = tagName;
- else if (!tagObj.default)
- node.tag = tagObj.tag;
- if (ref)
- ref.node = node;
- return node;
- }
- exports2.createNode = createNode;
- }
-});
-
-// ../../node_modules/yaml/dist/nodes/Collection.js
-var require_Collection = __commonJS({
- "../../node_modules/yaml/dist/nodes/Collection.js"(exports2) {
- "use strict";
- var createNode = require_createNode();
- var identity = require_identity();
- var Node = require_Node();
- function collectionFromPath(schema, path, value) {
- let v = value;
- for (let i = path.length - 1; i >= 0; --i) {
- const k = path[i];
- if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
- const a = [];
- a[k] = v;
- v = a;
- } else {
- v = /* @__PURE__ */ new Map([[k, v]]);
- }
- }
- return createNode.createNode(v, void 0, {
- aliasDuplicateObjects: false,
- keepUndefined: false,
- onAnchor: () => {
- throw new Error("This should not happen, please report a bug.");
- },
- schema,
- sourceObjects: /* @__PURE__ */ new Map()
- });
- }
- var isEmptyPath = (path) => path == null || typeof path === "object" && !!path[Symbol.iterator]().next().done;
- var Collection = class extends Node.NodeBase {
- constructor(type, schema) {
- super(type);
- Object.defineProperty(this, "schema", {
- value: schema,
- configurable: true,
- enumerable: false,
- writable: true
- });
- }
- /**
- * Create a copy of this collection.
- *
- * @param schema - If defined, overwrites the original's schema
- */
- clone(schema) {
- const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
- if (schema)
- copy.schema = schema;
- copy.items = copy.items.map((it) => identity.isNode(it) || identity.isPair(it) ? it.clone(schema) : it);
- if (this.range)
- copy.range = this.range.slice();
- return copy;
- }
- /**
- * Adds a value to the collection. For `!!map` and `!!omap` the value must
- * be a Pair instance or a `{ key, value }` object, which may not have a key
- * that already exists in the map.
- */
- addIn(path, value) {
- if (isEmptyPath(path))
- this.add(value);
- else {
- const [key, ...rest] = path;
- const node = this.get(key, true);
- if (identity.isCollection(node))
- node.addIn(rest, value);
- else if (node === void 0 && this.schema)
- this.set(key, collectionFromPath(this.schema, rest, value));
- else
- throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
- }
- }
- /**
- * Removes a value from the collection.
- * @returns `true` if the item was found and removed.
- */
- deleteIn(path) {
- const [key, ...rest] = path;
- if (rest.length === 0)
- return this.delete(key);
- const node = this.get(key, true);
- if (identity.isCollection(node))
- return node.deleteIn(rest);
- else
- throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
- }
- /**
- * Returns item at `key`, or `undefined` if not found. By default unwraps
- * scalar values from their surrounding node; to disable set `keepScalar` to
- * `true` (collections are always returned intact).
- */
- getIn(path, keepScalar) {
- const [key, ...rest] = path;
- const node = this.get(key, true);
- if (rest.length === 0)
- return !keepScalar && identity.isScalar(node) ? node.value : node;
- else
- return identity.isCollection(node) ? node.getIn(rest, keepScalar) : void 0;
- }
- hasAllNullValues(allowScalar) {
- return this.items.every((node) => {
- if (!identity.isPair(node))
- return false;
- const n = node.value;
- return n == null || allowScalar && identity.isScalar(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
- });
- }
- /**
- * Checks if the collection includes a value with the key `key`.
- */
- hasIn(path) {
- const [key, ...rest] = path;
- if (rest.length === 0)
- return this.has(key);
- const node = this.get(key, true);
- return identity.isCollection(node) ? node.hasIn(rest) : false;
- }
- /**
- * Sets a value in this collection. For `!!set`, `value` needs to be a
- * boolean to add/remove the item from the set.
- */
- setIn(path, value) {
- const [key, ...rest] = path;
- if (rest.length === 0) {
- this.set(key, value);
- } else {
- const node = this.get(key, true);
- if (identity.isCollection(node))
- node.setIn(rest, value);
- else if (node === void 0 && this.schema)
- this.set(key, collectionFromPath(this.schema, rest, value));
- else
- throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
- }
- }
- };
- exports2.Collection = Collection;
- exports2.collectionFromPath = collectionFromPath;
- exports2.isEmptyPath = isEmptyPath;
- }
-});
-
-// ../../node_modules/yaml/dist/stringify/stringifyComment.js
-var require_stringifyComment = __commonJS({
- "../../node_modules/yaml/dist/stringify/stringifyComment.js"(exports2) {
- "use strict";
- var stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, "#");
- function indentComment(comment, indent) {
- if (/^\n+$/.test(comment))
- return comment.substring(1);
- return indent ? comment.replace(/^(?! *$)/gm, indent) : comment;
- }
- var lineComment = (str, indent, comment) => str.endsWith("\n") ? indentComment(comment, indent) : comment.includes("\n") ? "\n" + indentComment(comment, indent) : (str.endsWith(" ") ? "" : " ") + comment;
- exports2.indentComment = indentComment;
- exports2.lineComment = lineComment;
- exports2.stringifyComment = stringifyComment;
- }
-});
-
-// ../../node_modules/yaml/dist/stringify/foldFlowLines.js
-var require_foldFlowLines = __commonJS({
- "../../node_modules/yaml/dist/stringify/foldFlowLines.js"(exports2) {
- "use strict";
- var FOLD_FLOW = "flow";
- var FOLD_BLOCK = "block";
- var FOLD_QUOTED = "quoted";
- function foldFlowLines(text, indent, mode = "flow", { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) {
- if (!lineWidth || lineWidth < 0)
- return text;
- if (lineWidth < minContentWidth)
- minContentWidth = 0;
- const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);
- if (text.length <= endStep)
- return text;
- const folds = [];
- const escapedFolds = {};
- let end = lineWidth - indent.length;
- if (typeof indentAtStart === "number") {
- if (indentAtStart > lineWidth - Math.max(2, minContentWidth))
- folds.push(0);
- else
- end = lineWidth - indentAtStart;
- }
- let split = void 0;
- let prev = void 0;
- let overflow = false;
- let i = -1;
- let escStart = -1;
- let escEnd = -1;
- if (mode === FOLD_BLOCK) {
- i = consumeMoreIndentedLines(text, i, indent.length);
- if (i !== -1)
- end = i + endStep;
- }
- for (let ch; ch = text[i += 1]; ) {
- if (mode === FOLD_QUOTED && ch === "\\") {
- escStart = i;
- switch (text[i + 1]) {
- case "x":
- i += 3;
- break;
- case "u":
- i += 5;
- break;
- case "U":
- i += 9;
- break;
- default:
- i += 1;
- }
- escEnd = i;
- }
- if (ch === "\n") {
- if (mode === FOLD_BLOCK)
- i = consumeMoreIndentedLines(text, i, indent.length);
- end = i + indent.length + endStep;
- split = void 0;
- } else {
- if (ch === " " && prev && prev !== " " && prev !== "\n" && prev !== " ") {
- const next = text[i + 1];
- if (next && next !== " " && next !== "\n" && next !== " ")
- split = i;
- }
- if (i >= end) {
- if (split) {
- folds.push(split);
- end = split + endStep;
- split = void 0;
- } else if (mode === FOLD_QUOTED) {
- while (prev === " " || prev === " ") {
- prev = ch;
- ch = text[i += 1];
- overflow = true;
- }
- const j = i > escEnd + 1 ? i - 2 : escStart - 1;
- if (escapedFolds[j])
- return text;
- folds.push(j);
- escapedFolds[j] = true;
- end = j + endStep;
- split = void 0;
- } else {
- overflow = true;
- }
- }
- }
- prev = ch;
- }
- if (overflow && onOverflow)
- onOverflow();
- if (folds.length === 0)
- return text;
- if (onFold)
- onFold();
- let res = text.slice(0, folds[0]);
- for (let i2 = 0; i2 < folds.length; ++i2) {
- const fold = folds[i2];
- const end2 = folds[i2 + 1] || text.length;
- if (fold === 0)
- res = `
-${indent}${text.slice(0, end2)}`;
- else {
- if (mode === FOLD_QUOTED && escapedFolds[fold])
- res += `${text[fold]}\\`;
- res += `
-${indent}${text.slice(fold + 1, end2)}`;
- }
- }
- return res;
- }
- function consumeMoreIndentedLines(text, i, indent) {
- let end = i;
- let start = i + 1;
- let ch = text[start];
- while (ch === " " || ch === " ") {
- if (i < start + indent) {
- ch = text[++i];
- } else {
- do {
- ch = text[++i];
- } while (ch && ch !== "\n");
- end = i;
- start = i + 1;
- ch = text[start];
- }
- }
- return end;
- }
- exports2.FOLD_BLOCK = FOLD_BLOCK;
- exports2.FOLD_FLOW = FOLD_FLOW;
- exports2.FOLD_QUOTED = FOLD_QUOTED;
- exports2.foldFlowLines = foldFlowLines;
- }
-});
-
-// ../../node_modules/yaml/dist/stringify/stringifyString.js
-var require_stringifyString = __commonJS({
- "../../node_modules/yaml/dist/stringify/stringifyString.js"(exports2) {
- "use strict";
- var Scalar = require_Scalar();
- var foldFlowLines = require_foldFlowLines();
- var getFoldOptions = (ctx, isBlock) => ({
- indentAtStart: isBlock ? ctx.indent.length : ctx.indentAtStart,
- lineWidth: ctx.options.lineWidth,
- minContentWidth: ctx.options.minContentWidth
- });
- var containsDocumentMarker = (str) => /^(%|---|\.\.\.)/m.test(str);
- function lineLengthOverLimit(str, lineWidth, indentLength) {
- if (!lineWidth || lineWidth < 0)
- return false;
- const limit = lineWidth - indentLength;
- const strLen = str.length;
- if (strLen <= limit)
- return false;
- for (let i = 0, start = 0; i < strLen; ++i) {
- if (str[i] === "\n") {
- if (i - start > limit)
- return true;
- start = i + 1;
- if (strLen - start <= limit)
- return false;
- }
- }
- return true;
- }
- function doubleQuotedString(value, ctx) {
- const json = JSON.stringify(value);
- if (ctx.options.doubleQuotedAsJSON)
- return json;
- const { implicitKey } = ctx;
- const minMultiLineLength = ctx.options.doubleQuotedMinMultiLineLength;
- const indent = ctx.indent || (containsDocumentMarker(value) ? " " : "");
- let str = "";
- let start = 0;
- for (let i = 0, ch = json[i]; ch; ch = json[++i]) {
- if (ch === " " && json[i + 1] === "\\" && json[i + 2] === "n") {
- str += json.slice(start, i) + "\\ ";
- i += 1;
- start = i;
- ch = "\\";
- }
- if (ch === "\\")
- switch (json[i + 1]) {
- case "u":
- {
- str += json.slice(start, i);
- const code = json.substr(i + 2, 4);
- switch (code) {
- case "0000":
- str += "\\0";
- break;
- case "0007":
- str += "\\a";
- break;
- case "000b":
- str += "\\v";
- break;
- case "001b":
- str += "\\e";
- break;
- case "0085":
- str += "\\N";
- break;
- case "00a0":
- str += "\\_";
- break;
- case "2028":
- str += "\\L";
- break;
- case "2029":
- str += "\\P";
- break;
- default:
- if (code.substr(0, 2) === "00")
- str += "\\x" + code.substr(2);
- else
- str += json.substr(i, 6);
- }
- i += 5;
- start = i + 1;
- }
- break;
- case "n":
- if (implicitKey || json[i + 2] === '"' || json.length < minMultiLineLength) {
- i += 1;
- } else {
- str += json.slice(start, i) + "\n\n";
- while (json[i + 2] === "\\" && json[i + 3] === "n" && json[i + 4] !== '"') {
- str += "\n";
- i += 2;
- }
- str += indent;
- if (json[i + 2] === " ")
- str += "\\";
- i += 1;
- start = i + 1;
- }
- break;
- default:
- i += 1;
- }
- }
- str = start ? str + json.slice(start) : json;
- return implicitKey ? str : foldFlowLines.foldFlowLines(str, indent, foldFlowLines.FOLD_QUOTED, getFoldOptions(ctx, false));
- }
- function singleQuotedString(value, ctx) {
- if (ctx.options.singleQuote === false || ctx.implicitKey && value.includes("\n") || /[ \t]\n|\n[ \t]/.test(value))
- return doubleQuotedString(value, ctx);
- const indent = ctx.indent || (containsDocumentMarker(value) ? " " : "");
- const res = "'" + value.replace(/'/g, "''").replace(/\n+/g, `$&
-${indent}`) + "'";
- return ctx.implicitKey ? res : foldFlowLines.foldFlowLines(res, indent, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx, false));
- }
- function quotedString(value, ctx) {
- const { singleQuote } = ctx.options;
- let qs;
- if (singleQuote === false)
- qs = doubleQuotedString;
- else {
- const hasDouble = value.includes('"');
- const hasSingle = value.includes("'");
- if (hasDouble && !hasSingle)
- qs = singleQuotedString;
- else if (hasSingle && !hasDouble)
- qs = doubleQuotedString;
- else
- qs = singleQuote ? singleQuotedString : doubleQuotedString;
- }
- return qs(value, ctx);
- }
- var blockEndNewlines;
- try {
- blockEndNewlines = new RegExp("(^|(?\n";
- let chomp;
- let endStart;
- for (endStart = value.length; endStart > 0; --endStart) {
- const ch = value[endStart - 1];
- if (ch !== "\n" && ch !== " " && ch !== " ")
- break;
- }
- let end = value.substring(endStart);
- const endNlPos = end.indexOf("\n");
- if (endNlPos === -1) {
- chomp = "-";
- } else if (value === end || endNlPos !== end.length - 1) {
- chomp = "+";
- if (onChompKeep)
- onChompKeep();
- } else {
- chomp = "";
- }
- if (end) {
- value = value.slice(0, -end.length);
- if (end[end.length - 1] === "\n")
- end = end.slice(0, -1);
- end = end.replace(blockEndNewlines, `$&${indent}`);
- }
- let startWithSpace = false;
- let startEnd;
- let startNlPos = -1;
- for (startEnd = 0; startEnd < value.length; ++startEnd) {
- const ch = value[startEnd];
- if (ch === " ")
- startWithSpace = true;
- else if (ch === "\n")
- startNlPos = startEnd;
- else
- break;
- }
- let start = value.substring(0, startNlPos < startEnd ? startNlPos + 1 : startEnd);
- if (start) {
- value = value.substring(start.length);
- start = start.replace(/\n+/g, `$&${indent}`);
- }
- const indentSize = indent ? "2" : "1";
- let header = (startWithSpace ? indentSize : "") + chomp;
- if (comment) {
- header += " " + commentString(comment.replace(/ ?[\r\n]+/g, " "));
- if (onComment)
- onComment();
- }
- if (!literal) {
- const foldedValue = value.replace(/\n+/g, "\n$&").replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${indent}`);
- let literalFallback = false;
- const foldOptions = getFoldOptions(ctx, true);
- if (blockQuote !== "folded" && type !== Scalar.Scalar.BLOCK_FOLDED) {
- foldOptions.onOverflow = () => {
- literalFallback = true;
- };
- }
- const body = foldFlowLines.foldFlowLines(`${start}${foldedValue}${end}`, indent, foldFlowLines.FOLD_BLOCK, foldOptions);
- if (!literalFallback)
- return `>${header}
-${indent}${body}`;
- }
- value = value.replace(/\n+/g, `$&${indent}`);
- return `|${header}
-${indent}${start}${value}${end}`;
- }
- function plainString(item, ctx, onComment, onChompKeep) {
- const { type, value } = item;
- const { actualString, implicitKey, indent, indentStep, inFlow } = ctx;
- if (implicitKey && value.includes("\n") || inFlow && /[[\]{},]/.test(value)) {
- return quotedString(value, ctx);
- }
- if (!value || /^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
- return implicitKey || inFlow || !value.includes("\n") ? quotedString(value, ctx) : blockString(item, ctx, onComment, onChompKeep);
- }
- if (!implicitKey && !inFlow && type !== Scalar.Scalar.PLAIN && value.includes("\n")) {
- return blockString(item, ctx, onComment, onChompKeep);
- }
- if (containsDocumentMarker(value)) {
- if (indent === "") {
- ctx.forceBlockIndent = true;
- return blockString(item, ctx, onComment, onChompKeep);
- } else if (implicitKey && indent === indentStep) {
- return quotedString(value, ctx);
- }
- }
- const str = value.replace(/\n+/g, `$&
-${indent}`);
- if (actualString) {
- const test = (tag) => tag.default && tag.tag !== "tag:yaml.org,2002:str" && tag.test?.test(str);
- const { compat, tags } = ctx.doc.schema;
- if (tags.some(test) || compat?.some(test))
- return quotedString(value, ctx);
- }
- return implicitKey ? str : foldFlowLines.foldFlowLines(str, indent, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx, false));
- }
- function stringifyString(item, ctx, onComment, onChompKeep) {
- const { implicitKey, inFlow } = ctx;
- const ss = typeof item.value === "string" ? item : Object.assign({}, item, { value: String(item.value) });
- let { type } = item;
- if (type !== Scalar.Scalar.QUOTE_DOUBLE) {
- if (/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(ss.value))
- type = Scalar.Scalar.QUOTE_DOUBLE;
- }
- const _stringify = (_type) => {
- switch (_type) {
- case Scalar.Scalar.BLOCK_FOLDED:
- case Scalar.Scalar.BLOCK_LITERAL:
- return implicitKey || inFlow ? quotedString(ss.value, ctx) : blockString(ss, ctx, onComment, onChompKeep);
- case Scalar.Scalar.QUOTE_DOUBLE:
- return doubleQuotedString(ss.value, ctx);
- case Scalar.Scalar.QUOTE_SINGLE:
- return singleQuotedString(ss.value, ctx);
- case Scalar.Scalar.PLAIN:
- return plainString(ss, ctx, onComment, onChompKeep);
- default:
- return null;
- }
- };
- let res = _stringify(type);
- if (res === null) {
- const { defaultKeyType, defaultStringType } = ctx.options;
- const t = implicitKey && defaultKeyType || defaultStringType;
- res = _stringify(t);
- if (res === null)
- throw new Error(`Unsupported default string type ${t}`);
- }
- return res;
- }
- exports2.stringifyString = stringifyString;
- }
-});
-
-// ../../node_modules/yaml/dist/stringify/stringify.js
-var require_stringify = __commonJS({
- "../../node_modules/yaml/dist/stringify/stringify.js"(exports2) {
- "use strict";
- var anchors = require_anchors();
- var identity = require_identity();
- var stringifyComment = require_stringifyComment();
- var stringifyString = require_stringifyString();
- function createStringifyContext(doc, options) {
- const opt = Object.assign({
- blockQuote: true,
- commentString: stringifyComment.stringifyComment,
- defaultKeyType: null,
- defaultStringType: "PLAIN",
- directives: null,
- doubleQuotedAsJSON: false,
- doubleQuotedMinMultiLineLength: 40,
- falseStr: "false",
- flowCollectionPadding: true,
- indentSeq: true,
- lineWidth: 80,
- minContentWidth: 20,
- nullStr: "null",
- simpleKeys: false,
- singleQuote: null,
- trueStr: "true",
- verifyAliasOrder: true
- }, doc.schema.toStringOptions, options);
- let inFlow;
- switch (opt.collectionStyle) {
- case "block":
- inFlow = false;
- break;
- case "flow":
- inFlow = true;
- break;
- default:
- inFlow = null;
- }
- return {
- anchors: /* @__PURE__ */ new Set(),
- doc,
- flowCollectionPadding: opt.flowCollectionPadding ? " " : "",
- indent: "",
- indentStep: typeof opt.indent === "number" ? " ".repeat(opt.indent) : " ",
- inFlow,
- options: opt
- };
- }
- function getTagObject(tags, item) {
- if (item.tag) {
- const match = tags.filter((t) => t.tag === item.tag);
- if (match.length > 0)
- return match.find((t) => t.format === item.format) ?? match[0];
- }
- let tagObj = void 0;
- let obj;
- if (identity.isScalar(item)) {
- obj = item.value;
- let match = tags.filter((t) => t.identify?.(obj));
- if (match.length > 1) {
- const testMatch = match.filter((t) => t.test);
- if (testMatch.length > 0)
- match = testMatch;
- }
- tagObj = match.find((t) => t.format === item.format) ?? match.find((t) => !t.format);
- } else {
- obj = item;
- tagObj = tags.find((t) => t.nodeClass && obj instanceof t.nodeClass);
- }
- if (!tagObj) {
- const name = obj?.constructor?.name ?? typeof obj;
- throw new Error(`Tag not resolved for ${name} value`);
- }
- return tagObj;
- }
- function stringifyProps(node, tagObj, { anchors: anchors$1, doc }) {
- if (!doc.directives)
- return "";
- const props = [];
- const anchor = (identity.isScalar(node) || identity.isCollection(node)) && node.anchor;
- if (anchor && anchors.anchorIsValid(anchor)) {
- anchors$1.add(anchor);
- props.push(`&${anchor}`);
- }
- const tag = node.tag ? node.tag : tagObj.default ? null : tagObj.tag;
- if (tag)
- props.push(doc.directives.tagString(tag));
- return props.join(" ");
- }
- function stringify(item, ctx, onComment, onChompKeep) {
- if (identity.isPair(item))
- return item.toString(ctx, onComment, onChompKeep);
- if (identity.isAlias(item)) {
- if (ctx.doc.directives)
- return item.toString(ctx);
- if (ctx.resolvedAliases?.has(item)) {
- throw new TypeError(`Cannot stringify circular structure without alias nodes`);
- } else {
- if (ctx.resolvedAliases)
- ctx.resolvedAliases.add(item);
- else
- ctx.resolvedAliases = /* @__PURE__ */ new Set([item]);
- item = item.resolve(ctx.doc);
- }
- }
- let tagObj = void 0;
- const node = identity.isNode(item) ? item : ctx.doc.createNode(item, { onTagObj: (o) => tagObj = o });
- if (!tagObj)
- tagObj = getTagObject(ctx.doc.schema.tags, node);
- const props = stringifyProps(node, tagObj, ctx);
- if (props.length > 0)
- ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
- const str = typeof tagObj.stringify === "function" ? tagObj.stringify(node, ctx, onComment, onChompKeep) : identity.isScalar(node) ? stringifyString.stringifyString(node, ctx, onComment, onChompKeep) : node.toString(ctx, onComment, onChompKeep);
- if (!props)
- return str;
- return identity.isScalar(node) || str[0] === "{" || str[0] === "[" ? `${props} ${str}` : `${props}
-${ctx.indent}${str}`;
- }
- exports2.createStringifyContext = createStringifyContext;
- exports2.stringify = stringify;
- }
-});
-
-// ../../node_modules/yaml/dist/stringify/stringifyPair.js
-var require_stringifyPair = __commonJS({
- "../../node_modules/yaml/dist/stringify/stringifyPair.js"(exports2) {
- "use strict";
- var identity = require_identity();
- var Scalar = require_Scalar();
- var stringify = require_stringify();
- var stringifyComment = require_stringifyComment();
- function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
- const { allNullValues, doc, indent, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx;
- let keyComment = identity.isNode(key) && key.comment || null;
- if (simpleKeys) {
- if (keyComment) {
- throw new Error("With simple keys, key nodes cannot have comments");
- }
- if (identity.isCollection(key) || !identity.isNode(key) && typeof key === "object") {
- const msg = "With simple keys, collection cannot be used as a key value";
- throw new Error(msg);
- }
- }
- let explicitKey = !simpleKeys && (!key || keyComment && value == null && !ctx.inFlow || identity.isCollection(key) || (identity.isScalar(key) ? key.type === Scalar.Scalar.BLOCK_FOLDED || key.type === Scalar.Scalar.BLOCK_LITERAL : typeof key === "object"));
- ctx = Object.assign({}, ctx, {
- allNullValues: false,
- implicitKey: !explicitKey && (simpleKeys || !allNullValues),
- indent: indent + indentStep
- });
- let keyCommentDone = false;
- let chompKeep = false;
- let str = stringify.stringify(key, ctx, () => keyCommentDone = true, () => chompKeep = true);
- if (!explicitKey && !ctx.inFlow && str.length > 1024) {
- if (simpleKeys)
- throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
- explicitKey = true;
- }
- if (ctx.inFlow) {
- if (allNullValues || value == null) {
- if (keyCommentDone && onComment)
- onComment();
- return str === "" ? "?" : explicitKey ? `? ${str}` : str;
- }
- } else if (allNullValues && !simpleKeys || value == null && explicitKey) {
- str = `? ${str}`;
- if (keyComment && !keyCommentDone) {
- str += stringifyComment.lineComment(str, ctx.indent, commentString(keyComment));
- } else if (chompKeep && onChompKeep)
- onChompKeep();
- return str;
- }
- if (keyCommentDone)
- keyComment = null;
- if (explicitKey) {
- if (keyComment)
- str += stringifyComment.lineComment(str, ctx.indent, commentString(keyComment));
- str = `? ${str}
-${indent}:`;
- } else {
- str = `${str}:`;
- if (keyComment)
- str += stringifyComment.lineComment(str, ctx.indent, commentString(keyComment));
- }
- let vsb, vcb, valueComment;
- if (identity.isNode(value)) {
- vsb = !!value.spaceBefore;
- vcb = value.commentBefore;
- valueComment = value.comment;
- } else {
- vsb = false;
- vcb = null;
- valueComment = null;
- if (value && typeof value === "object")
- value = doc.createNode(value);
- }
- ctx.implicitKey = false;
- if (!explicitKey && !keyComment && identity.isScalar(value))
- ctx.indentAtStart = str.length + 1;
- chompKeep = false;
- if (!indentSeq && indentStep.length >= 2 && !ctx.inFlow && !explicitKey && identity.isSeq(value) && !value.flow && !value.tag && !value.anchor) {
- ctx.indent = ctx.indent.substring(2);
- }
- let valueCommentDone = false;
- const valueStr = stringify.stringify(value, ctx, () => valueCommentDone = true, () => chompKeep = true);
- let ws = " ";
- if (keyComment || vsb || vcb) {
- ws = vsb ? "\n" : "";
- if (vcb) {
- const cs = commentString(vcb);
- ws += `
-${stringifyComment.indentComment(cs, ctx.indent)}`;
- }
- if (valueStr === "" && !ctx.inFlow) {
- if (ws === "\n")
- ws = "\n\n";
- } else {
- ws += `
-${ctx.indent}`;
- }
- } else if (!explicitKey && identity.isCollection(value)) {
- const vs0 = valueStr[0];
- const nl0 = valueStr.indexOf("\n");
- const hasNewline = nl0 !== -1;
- const flow = ctx.inFlow ?? value.flow ?? value.items.length === 0;
- if (hasNewline || !flow) {
- let hasPropsLine = false;
- if (hasNewline && (vs0 === "&" || vs0 === "!")) {
- let sp0 = valueStr.indexOf(" ");
- if (vs0 === "&" && sp0 !== -1 && sp0 < nl0 && valueStr[sp0 + 1] === "!") {
- sp0 = valueStr.indexOf(" ", sp0 + 1);
- }
- if (sp0 === -1 || nl0 < sp0)
- hasPropsLine = true;
- }
- if (!hasPropsLine)
- ws = `
-${ctx.indent}`;
- }
- } else if (valueStr === "" || valueStr[0] === "\n") {
- ws = "";
- }
- str += ws + valueStr;
- if (ctx.inFlow) {
- if (valueCommentDone && onComment)
- onComment();
- } else if (valueComment && !valueCommentDone) {
- str += stringifyComment.lineComment(str, ctx.indent, commentString(valueComment));
- } else if (chompKeep && onChompKeep) {
- onChompKeep();
- }
- return str;
- }
- exports2.stringifyPair = stringifyPair;
- }
-});
-
-// ../../node_modules/yaml/dist/log.js
-var require_log = __commonJS({
- "../../node_modules/yaml/dist/log.js"(exports2) {
- "use strict";
- var node_process = require("node:process");
- function debug(logLevel, ...messages) {
- if (logLevel === "debug")
- console.log(...messages);
- }
- function warn(logLevel, warning) {
- if (logLevel === "debug" || logLevel === "warn") {
- if (typeof node_process.emitWarning === "function")
- node_process.emitWarning(warning);
- else
- console.warn(warning);
- }
- }
- exports2.debug = debug;
- exports2.warn = warn;
- }
-});
-
-// ../../node_modules/yaml/dist/schema/yaml-1.1/merge.js
-var require_merge = __commonJS({
- "../../node_modules/yaml/dist/schema/yaml-1.1/merge.js"(exports2) {
- "use strict";
- var identity = require_identity();
- var Scalar = require_Scalar();
- var MERGE_KEY = "<<";
- var merge = {
- identify: (value) => value === MERGE_KEY || typeof value === "symbol" && value.description === MERGE_KEY,
- default: "key",
- tag: "tag:yaml.org,2002:merge",
- test: /^<<$/,
- resolve: () => Object.assign(new Scalar.Scalar(Symbol(MERGE_KEY)), {
- addToJSMap: addMergeToJSMap
- }),
- stringify: () => MERGE_KEY
- };
- var isMergeKey = (ctx, key) => (merge.identify(key) || identity.isScalar(key) && (!key.type || key.type === Scalar.Scalar.PLAIN) && merge.identify(key.value)) && ctx?.doc.schema.tags.some((tag) => tag.tag === merge.tag && tag.default);
- function addMergeToJSMap(ctx, map, value) {
- value = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
- if (identity.isSeq(value))
- for (const it of value.items)
- mergeValue(ctx, map, it);
- else if (Array.isArray(value))
- for (const it of value)
- mergeValue(ctx, map, it);
- else
- mergeValue(ctx, map, value);
- }
- function mergeValue(ctx, map, value) {
- const source = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
- if (!identity.isMap(source))
- throw new Error("Merge sources must be maps or map aliases");
- const srcMap = source.toJSON(null, ctx, Map);
- for (const [key, value2] of srcMap) {
- if (map instanceof Map) {
- if (!map.has(key))
- map.set(key, value2);
- } else if (map instanceof Set) {
- map.add(key);
- } else if (!Object.prototype.hasOwnProperty.call(map, key)) {
- Object.defineProperty(map, key, {
- value: value2,
- writable: true,
- enumerable: true,
- configurable: true
- });
- }
- }
- return map;
- }
- exports2.addMergeToJSMap = addMergeToJSMap;
- exports2.isMergeKey = isMergeKey;
- exports2.merge = merge;
- }
-});
-
-// ../../node_modules/yaml/dist/nodes/addPairToJSMap.js
-var require_addPairToJSMap = __commonJS({
- "../../node_modules/yaml/dist/nodes/addPairToJSMap.js"(exports2) {
- "use strict";
- var log = require_log();
- var merge = require_merge();
- var stringify = require_stringify();
- var identity = require_identity();
- var toJS = require_toJS();
- function addPairToJSMap(ctx, map, { key, value }) {
- if (identity.isNode(key) && key.addToJSMap)
- key.addToJSMap(ctx, map, value);
- else if (merge.isMergeKey(ctx, key))
- merge.addMergeToJSMap(ctx, map, value);
- else {
- const jsKey = toJS.toJS(key, "", ctx);
- if (map instanceof Map) {
- map.set(jsKey, toJS.toJS(value, jsKey, ctx));
- } else if (map instanceof Set) {
- map.add(jsKey);
- } else {
- const stringKey = stringifyKey(key, jsKey, ctx);
- const jsValue = toJS.toJS(value, stringKey, ctx);
- if (stringKey in map)
- Object.defineProperty(map, stringKey, {
- value: jsValue,
- writable: true,
- enumerable: true,
- configurable: true
- });
- else
- map[stringKey] = jsValue;
- }
- }
- return map;
- }
- function stringifyKey(key, jsKey, ctx) {
- if (jsKey === null)
- return "";
- if (typeof jsKey !== "object")
- return String(jsKey);
- if (identity.isNode(key) && ctx?.doc) {
- const strCtx = stringify.createStringifyContext(ctx.doc, {});
- strCtx.anchors = /* @__PURE__ */ new Set();
- for (const node of ctx.anchors.keys())
- strCtx.anchors.add(node.anchor);
- strCtx.inFlow = true;
- strCtx.inStringifyKey = true;
- const strKey = key.toString(strCtx);
- if (!ctx.mapKeyWarned) {
- let jsonStr = JSON.stringify(strKey);
- if (jsonStr.length > 40)
- jsonStr = jsonStr.substring(0, 36) + '..."';
- log.warn(ctx.doc.options.logLevel, `Keys with collection values will be stringified due to JS Object restrictions: ${jsonStr}. Set mapAsMap: true to use object keys.`);
- ctx.mapKeyWarned = true;
- }
- return strKey;
- }
- return JSON.stringify(jsKey);
- }
- exports2.addPairToJSMap = addPairToJSMap;
- }
-});
-
-// ../../node_modules/yaml/dist/nodes/Pair.js
-var require_Pair = __commonJS({
- "../../node_modules/yaml/dist/nodes/Pair.js"(exports2) {
- "use strict";
- var createNode = require_createNode();
- var stringifyPair = require_stringifyPair();
- var addPairToJSMap = require_addPairToJSMap();
- var identity = require_identity();
- function createPair(key, value, ctx) {
- const k = createNode.createNode(key, void 0, ctx);
- const v = createNode.createNode(value, void 0, ctx);
- return new Pair(k, v);
- }
- var Pair = class _Pair {
- constructor(key, value = null) {
- Object.defineProperty(this, identity.NODE_TYPE, { value: identity.PAIR });
- this.key = key;
- this.value = value;
- }
- clone(schema) {
- let { key, value } = this;
- if (identity.isNode(key))
- key = key.clone(schema);
- if (identity.isNode(value))
- value = value.clone(schema);
- return new _Pair(key, value);
- }
- toJSON(_, ctx) {
- const pair = ctx?.mapAsMap ? /* @__PURE__ */ new Map() : {};
- return addPairToJSMap.addPairToJSMap(ctx, pair, this);
- }
- toString(ctx, onComment, onChompKeep) {
- return ctx?.doc ? stringifyPair.stringifyPair(this, ctx, onComment, onChompKeep) : JSON.stringify(this);
- }
- };
- exports2.Pair = Pair;
- exports2.createPair = createPair;
- }
-});
-
-// ../../node_modules/yaml/dist/stringify/stringifyCollection.js
-var require_stringifyCollection = __commonJS({
- "../../node_modules/yaml/dist/stringify/stringifyCollection.js"(exports2) {
- "use strict";
- var identity = require_identity();
- var stringify = require_stringify();
- var stringifyComment = require_stringifyComment();
- function stringifyCollection(collection, ctx, options) {
- const flow = ctx.inFlow ?? collection.flow;
- const stringify2 = flow ? stringifyFlowCollection : stringifyBlockCollection;
- return stringify2(collection, ctx, options);
- }
- function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, flowChars, itemIndent, onChompKeep, onComment }) {
- const { indent, options: { commentString } } = ctx;
- const itemCtx = Object.assign({}, ctx, { indent: itemIndent, type: null });
- let chompKeep = false;
- const lines = [];
- for (let i = 0; i < items.length; ++i) {
- const item = items[i];
- let comment2 = null;
- if (identity.isNode(item)) {
- if (!chompKeep && item.spaceBefore)
- lines.push("");
- addCommentBefore(ctx, lines, item.commentBefore, chompKeep);
- if (item.comment)
- comment2 = item.comment;
- } else if (identity.isPair(item)) {
- const ik = identity.isNode(item.key) ? item.key : null;
- if (ik) {
- if (!chompKeep && ik.spaceBefore)
- lines.push("");
- addCommentBefore(ctx, lines, ik.commentBefore, chompKeep);
- }
- }
- chompKeep = false;
- let str2 = stringify.stringify(item, itemCtx, () => comment2 = null, () => chompKeep = true);
- if (comment2)
- str2 += stringifyComment.lineComment(str2, itemIndent, commentString(comment2));
- if (chompKeep && comment2)
- chompKeep = false;
- lines.push(blockItemPrefix + str2);
- }
- let str;
- if (lines.length === 0) {
- str = flowChars.start + flowChars.end;
- } else {
- str = lines[0];
- for (let i = 1; i < lines.length; ++i) {
- const line = lines[i];
- str += line ? `
-${indent}${line}` : "\n";
- }
- }
- if (comment) {
- str += "\n" + stringifyComment.indentComment(commentString(comment), indent);
- if (onComment)
- onComment();
- } else if (chompKeep && onChompKeep)
- onChompKeep();
- return str;
- }
- function stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {
- const { indent, indentStep, flowCollectionPadding: fcPadding, options: { commentString } } = ctx;
- itemIndent += indentStep;
- const itemCtx = Object.assign({}, ctx, {
- indent: itemIndent,
- inFlow: true,
- type: null
- });
- let reqNewline = false;
- let linesAtValue = 0;
- const lines = [];
- for (let i = 0; i < items.length; ++i) {
- const item = items[i];
- let comment = null;
- if (identity.isNode(item)) {
- if (item.spaceBefore)
- lines.push("");
- addCommentBefore(ctx, lines, item.commentBefore, false);
- if (item.comment)
- comment = item.comment;
- } else if (identity.isPair(item)) {
- const ik = identity.isNode(item.key) ? item.key : null;
- if (ik) {
- if (ik.spaceBefore)
- lines.push("");
- addCommentBefore(ctx, lines, ik.commentBefore, false);
- if (ik.comment)
- reqNewline = true;
- }
- const iv = identity.isNode(item.value) ? item.value : null;
- if (iv) {
- if (iv.comment)
- comment = iv.comment;
- if (iv.commentBefore)
- reqNewline = true;
- } else if (item.value == null && ik?.comment) {
- comment = ik.comment;
- }
- }
- if (comment)
- reqNewline = true;
- let str = stringify.stringify(item, itemCtx, () => comment = null);
- if (i < items.length - 1)
- str += ",";
- if (comment)
- str += stringifyComment.lineComment(str, itemIndent, commentString(comment));
- if (!reqNewline && (lines.length > linesAtValue || str.includes("\n")))
- reqNewline = true;
- lines.push(str);
- linesAtValue = lines.length;
- }
- const { start, end } = flowChars;
- if (lines.length === 0) {
- return start + end;
- } else {
- if (!reqNewline) {
- const len = lines.reduce((sum, line) => sum + line.length + 2, 2);
- reqNewline = ctx.options.lineWidth > 0 && len > ctx.options.lineWidth;
- }
- if (reqNewline) {
- let str = start;
- for (const line of lines)
- str += line ? `
-${indentStep}${indent}${line}` : "\n";
- return `${str}
-${indent}${end}`;
- } else {
- return `${start}${fcPadding}${lines.join(" ")}${fcPadding}${end}`;
- }
- }
- }
- function addCommentBefore({ indent, options: { commentString } }, lines, comment, chompKeep) {
- if (comment && chompKeep)
- comment = comment.replace(/^\n+/, "");
- if (comment) {
- const ic = stringifyComment.indentComment(commentString(comment), indent);
- lines.push(ic.trimStart());
- }
- }
- exports2.stringifyCollection = stringifyCollection;
- }
-});
-
-// ../../node_modules/yaml/dist/nodes/YAMLMap.js
-var require_YAMLMap = __commonJS({
- "../../node_modules/yaml/dist/nodes/YAMLMap.js"(exports2) {
- "use strict";
- var stringifyCollection = require_stringifyCollection();
- var addPairToJSMap = require_addPairToJSMap();
- var Collection = require_Collection();
- var identity = require_identity();
- var Pair = require_Pair();
- var Scalar = require_Scalar();
- function findPair(items, key) {
- const k = identity.isScalar(key) ? key.value : key;
- for (const it of items) {
- if (identity.isPair(it)) {
- if (it.key === key || it.key === k)
- return it;
- if (identity.isScalar(it.key) && it.key.value === k)
- return it;
- }
- }
- return void 0;
- }
- var YAMLMap = class extends Collection.Collection {
- static get tagName() {
- return "tag:yaml.org,2002:map";
- }
- constructor(schema) {
- super(identity.MAP, schema);
- this.items = [];
- }
- /**
- * A generic collection parsing method that can be extended
- * to other node classes that inherit from YAMLMap
- */
- static from(schema, obj, ctx) {
- const { keepUndefined, replacer } = ctx;
- const map = new this(schema);
- const add = (key, value) => {
- if (typeof replacer === "function")
- value = replacer.call(obj, key, value);
- else if (Array.isArray(replacer) && !replacer.includes(key))
- return;
- if (value !== void 0 || keepUndefined)
- map.items.push(Pair.createPair(key, value, ctx));
- };
- if (obj instanceof Map) {
- for (const [key, value] of obj)
- add(key, value);
- } else if (obj && typeof obj === "object") {
- for (const key of Object.keys(obj))
- add(key, obj[key]);
- }
- if (typeof schema.sortMapEntries === "function") {
- map.items.sort(schema.sortMapEntries);
- }
- return map;
- }
- /**
- * Adds a value to the collection.
- *
- * @param overwrite - If not set `true`, using a key that is already in the
- * collection will throw. Otherwise, overwrites the previous value.
- */
- add(pair, overwrite) {
- let _pair;
- if (identity.isPair(pair))
- _pair = pair;
- else if (!pair || typeof pair !== "object" || !("key" in pair)) {
- _pair = new Pair.Pair(pair, pair?.value);
- } else
- _pair = new Pair.Pair(pair.key, pair.value);
- const prev = findPair(this.items, _pair.key);
- const sortEntries = this.schema?.sortMapEntries;
- if (prev) {
- if (!overwrite)
- throw new Error(`Key ${_pair.key} already set`);
- if (identity.isScalar(prev.value) && Scalar.isScalarValue(_pair.value))
- prev.value.value = _pair.value;
- else
- prev.value = _pair.value;
- } else if (sortEntries) {
- const i = this.items.findIndex((item) => sortEntries(_pair, item) < 0);
- if (i === -1)
- this.items.push(_pair);
- else
- this.items.splice(i, 0, _pair);
- } else {
- this.items.push(_pair);
- }
- }
- delete(key) {
- const it = findPair(this.items, key);
- if (!it)
- return false;
- const del = this.items.splice(this.items.indexOf(it), 1);
- return del.length > 0;
- }
- get(key, keepScalar) {
- const it = findPair(this.items, key);
- const node = it?.value;
- return (!keepScalar && identity.isScalar(node) ? node.value : node) ?? void 0;
- }
- has(key) {
- return !!findPair(this.items, key);
- }
- set(key, value) {
- this.add(new Pair.Pair(key, value), true);
- }
- /**
- * @param ctx - Conversion context, originally set in Document#toJS()
- * @param {Class} Type - If set, forces the returned collection type
- * @returns Instance of Type, Map, or Object
- */
- toJSON(_, ctx, Type) {
- const map = Type ? new Type() : ctx?.mapAsMap ? /* @__PURE__ */ new Map() : {};
- if (ctx?.onCreate)
- ctx.onCreate(map);
- for (const item of this.items)
- addPairToJSMap.addPairToJSMap(ctx, map, item);
- return map;
- }
- toString(ctx, onComment, onChompKeep) {
- if (!ctx)
- return JSON.stringify(this);
- for (const item of this.items) {
- if (!identity.isPair(item))
- throw new Error(`Map items must all be pairs; found ${JSON.stringify(item)} instead`);
- }
- if (!ctx.allNullValues && this.hasAllNullValues(false))
- ctx = Object.assign({}, ctx, { allNullValues: true });
- return stringifyCollection.stringifyCollection(this, ctx, {
- blockItemPrefix: "",
- flowChars: { start: "{", end: "}" },
- itemIndent: ctx.indent || "",
- onChompKeep,
- onComment
- });
- }
- };
- exports2.YAMLMap = YAMLMap;
- exports2.findPair = findPair;
- }
-});
-
-// ../../node_modules/yaml/dist/schema/common/map.js
-var require_map = __commonJS({
- "../../node_modules/yaml/dist/schema/common/map.js"(exports2) {
- "use strict";
- var identity = require_identity();
- var YAMLMap = require_YAMLMap();
- var map = {
- collection: "map",
- default: true,
- nodeClass: YAMLMap.YAMLMap,
- tag: "tag:yaml.org,2002:map",
- resolve(map2, onError) {
- if (!identity.isMap(map2))
- onError("Expected a mapping for this tag");
- return map2;
- },
- createNode: (schema, obj, ctx) => YAMLMap.YAMLMap.from(schema, obj, ctx)
- };
- exports2.map = map;
- }
-});
-
-// ../../node_modules/yaml/dist/nodes/YAMLSeq.js
-var require_YAMLSeq = __commonJS({
- "../../node_modules/yaml/dist/nodes/YAMLSeq.js"(exports2) {
- "use strict";
- var createNode = require_createNode();
- var stringifyCollection = require_stringifyCollection();
- var Collection = require_Collection();
- var identity = require_identity();
- var Scalar = require_Scalar();
- var toJS = require_toJS();
- var YAMLSeq = class extends Collection.Collection {
- static get tagName() {
- return "tag:yaml.org,2002:seq";
- }
- constructor(schema) {
- super(identity.SEQ, schema);
- this.items = [];
- }
- add(value) {
- this.items.push(value);
- }
- /**
- * Removes a value from the collection.
- *
- * `key` must contain a representation of an integer for this to succeed.
- * It may be wrapped in a `Scalar`.
- *
- * @returns `true` if the item was found and removed.
- */
- delete(key) {
- const idx = asItemIndex(key);
- if (typeof idx !== "number")
- return false;
- const del = this.items.splice(idx, 1);
- return del.length > 0;
- }
- get(key, keepScalar) {
- const idx = asItemIndex(key);
- if (typeof idx !== "number")
- return void 0;
- const it = this.items[idx];
- return !keepScalar && identity.isScalar(it) ? it.value : it;
- }
- /**
- * Checks if the collection includes a value with the key `key`.
- *
- * `key` must contain a representation of an integer for this to succeed.
- * It may be wrapped in a `Scalar`.
- */
- has(key) {
- const idx = asItemIndex(key);
- return typeof idx === "number" && idx < this.items.length;
- }
- /**
- * Sets a value in this collection. For `!!set`, `value` needs to be a
- * boolean to add/remove the item from the set.
- *
- * If `key` does not contain a representation of an integer, this will throw.
- * It may be wrapped in a `Scalar`.
- */
- set(key, value) {
- const idx = asItemIndex(key);
- if (typeof idx !== "number")
- throw new Error(`Expected a valid index, not ${key}.`);
- const prev = this.items[idx];
- if (identity.isScalar(prev) && Scalar.isScalarValue(value))
- prev.value = value;
- else
- this.items[idx] = value;
- }
- toJSON(_, ctx) {
- const seq = [];
- if (ctx?.onCreate)
- ctx.onCreate(seq);
- let i = 0;
- for (const item of this.items)
- seq.push(toJS.toJS(item, String(i++), ctx));
- return seq;
- }
- toString(ctx, onComment, onChompKeep) {
- if (!ctx)
- return JSON.stringify(this);
- return stringifyCollection.stringifyCollection(this, ctx, {
- blockItemPrefix: "- ",
- flowChars: { start: "[", end: "]" },
- itemIndent: (ctx.indent || "") + " ",
- onChompKeep,
- onComment
- });
- }
- static from(schema, obj, ctx) {
- const { replacer } = ctx;
- const seq = new this(schema);
- if (obj && Symbol.iterator in Object(obj)) {
- let i = 0;
- for (let it of obj) {
- if (typeof replacer === "function") {
- const key = obj instanceof Set ? it : String(i++);
- it = replacer.call(obj, key, it);
- }
- seq.items.push(createNode.createNode(it, void 0, ctx));
- }
- }
- return seq;
- }
- };
- function asItemIndex(key) {
- let idx = identity.isScalar(key) ? key.value : key;
- if (idx && typeof idx === "string")
- idx = Number(idx);
- return typeof idx === "number" && Number.isInteger(idx) && idx >= 0 ? idx : null;
- }
- exports2.YAMLSeq = YAMLSeq;
- }
-});
-
-// ../../node_modules/yaml/dist/schema/common/seq.js
-var require_seq = __commonJS({
- "../../node_modules/yaml/dist/schema/common/seq.js"(exports2) {
- "use strict";
- var identity = require_identity();
- var YAMLSeq = require_YAMLSeq();
- var seq = {
- collection: "seq",
- default: true,
- nodeClass: YAMLSeq.YAMLSeq,
- tag: "tag:yaml.org,2002:seq",
- resolve(seq2, onError) {
- if (!identity.isSeq(seq2))
- onError("Expected a sequence for this tag");
- return seq2;
- },
- createNode: (schema, obj, ctx) => YAMLSeq.YAMLSeq.from(schema, obj, ctx)
- };
- exports2.seq = seq;
- }
-});
-
-// ../../node_modules/yaml/dist/schema/common/string.js
-var require_string = __commonJS({
- "../../node_modules/yaml/dist/schema/common/string.js"(exports2) {
- "use strict";
- var stringifyString = require_stringifyString();
- var string = {
- identify: (value) => typeof value === "string",
- default: true,
- tag: "tag:yaml.org,2002:str",
- resolve: (str) => str,
- stringify(item, ctx, onComment, onChompKeep) {
- ctx = Object.assign({ actualString: true }, ctx);
- return stringifyString.stringifyString(item, ctx, onComment, onChompKeep);
- }
- };
- exports2.string = string;
- }
-});
-
-// ../../node_modules/yaml/dist/schema/common/null.js
-var require_null = __commonJS({
- "../../node_modules/yaml/dist/schema/common/null.js"(exports2) {
- "use strict";
- var Scalar = require_Scalar();
- var nullTag = {
- identify: (value) => value == null,
- createNode: () => new Scalar.Scalar(null),
- default: true,
- tag: "tag:yaml.org,2002:null",
- test: /^(?:~|[Nn]ull|NULL)?$/,
- resolve: () => new Scalar.Scalar(null),
- stringify: ({ source }, ctx) => typeof source === "string" && nullTag.test.test(source) ? source : ctx.options.nullStr
- };
- exports2.nullTag = nullTag;
- }
-});
-
-// ../../node_modules/yaml/dist/schema/core/bool.js
-var require_bool = __commonJS({
- "../../node_modules/yaml/dist/schema/core/bool.js"(exports2) {
- "use strict";
- var Scalar = require_Scalar();
- var boolTag = {
- identify: (value) => typeof value === "boolean",
- default: true,
- tag: "tag:yaml.org,2002:bool",
- test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
- resolve: (str) => new Scalar.Scalar(str[0] === "t" || str[0] === "T"),
- stringify({ source, value }, ctx) {
- if (source && boolTag.test.test(source)) {
- const sv = source[0] === "t" || source[0] === "T";
- if (value === sv)
- return source;
- }
- return value ? ctx.options.trueStr : ctx.options.falseStr;
- }
- };
- exports2.boolTag = boolTag;
- }
-});
-
-// ../../node_modules/yaml/dist/stringify/stringifyNumber.js
-var require_stringifyNumber = __commonJS({
- "../../node_modules/yaml/dist/stringify/stringifyNumber.js"(exports2) {
- "use strict";
- function stringifyNumber({ format, minFractionDigits, tag, value }) {
- if (typeof value === "bigint")
- return String(value);
- const num = typeof value === "number" ? value : Number(value);
- if (!isFinite(num))
- return isNaN(num) ? ".nan" : num < 0 ? "-.inf" : ".inf";
- let n = JSON.stringify(value);
- if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^\d/.test(n)) {
- let i = n.indexOf(".");
- if (i < 0) {
- i = n.length;
- n += ".";
- }
- let d = minFractionDigits - (n.length - i - 1);
- while (d-- > 0)
- n += "0";
- }
- return n;
- }
- exports2.stringifyNumber = stringifyNumber;
- }
-});
-
-// ../../node_modules/yaml/dist/schema/core/float.js
-var require_float = __commonJS({
- "../../node_modules/yaml/dist/schema/core/float.js"(exports2) {
- "use strict";
- var Scalar = require_Scalar();
- var stringifyNumber = require_stringifyNumber();
- var floatNaN = {
- identify: (value) => typeof value === "number",
- default: true,
- tag: "tag:yaml.org,2002:float",
- test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
- resolve: (str) => str.slice(-3).toLowerCase() === "nan" ? NaN : str[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
- stringify: stringifyNumber.stringifyNumber
- };
- var floatExp = {
- identify: (value) => typeof value === "number",
- default: true,
- tag: "tag:yaml.org,2002:float",
- format: "EXP",
- test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
- resolve: (str) => parseFloat(str),
- stringify(node) {
- const num = Number(node.value);
- return isFinite(num) ? num.toExponential() : stringifyNumber.stringifyNumber(node);
- }
- };
- var float = {
- identify: (value) => typeof value === "number",
- default: true,
- tag: "tag:yaml.org,2002:float",
- test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
- resolve(str) {
- const node = new Scalar.Scalar(parseFloat(str));
- const dot = str.indexOf(".");
- if (dot !== -1 && str[str.length - 1] === "0")
- node.minFractionDigits = str.length - dot - 1;
- return node;
- },
- stringify: stringifyNumber.stringifyNumber
- };
- exports2.float = float;
- exports2.floatExp = floatExp;
- exports2.floatNaN = floatNaN;
- }
-});
-
-// ../../node_modules/yaml/dist/schema/core/int.js
-var require_int = __commonJS({
- "../../node_modules/yaml/dist/schema/core/int.js"(exports2) {
- "use strict";
- var stringifyNumber = require_stringifyNumber();
- var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
- var intResolve = (str, offset, radix, { intAsBigInt }) => intAsBigInt ? BigInt(str) : parseInt(str.substring(offset), radix);
- function intStringify(node, radix, prefix) {
- const { value } = node;
- if (intIdentify(value) && value >= 0)
- return prefix + value.toString(radix);
- return stringifyNumber.stringifyNumber(node);
- }
- var intOct = {
- identify: (value) => intIdentify(value) && value >= 0,
- default: true,
- tag: "tag:yaml.org,2002:int",
- format: "OCT",
- test: /^0o[0-7]+$/,
- resolve: (str, _onError, opt) => intResolve(str, 2, 8, opt),
- stringify: (node) => intStringify(node, 8, "0o")
- };
- var int = {
- identify: intIdentify,
- default: true,
- tag: "tag:yaml.org,2002:int",
- test: /^[-+]?[0-9]+$/,
- resolve: (str, _onError, opt) => intResolve(str, 0, 10, opt),
- stringify: stringifyNumber.stringifyNumber
- };
- var intHex = {
- identify: (value) => intIdentify(value) && value >= 0,
- default: true,
- tag: "tag:yaml.org,2002:int",
- format: "HEX",
- test: /^0x[0-9a-fA-F]+$/,
- resolve: (str, _onError, opt) => intResolve(str, 2, 16, opt),
- stringify: (node) => intStringify(node, 16, "0x")
- };
- exports2.int = int;
- exports2.intHex = intHex;
- exports2.intOct = intOct;
- }
-});
-
-// ../../node_modules/yaml/dist/schema/core/schema.js
-var require_schema = __commonJS({
- "../../node_modules/yaml/dist/schema/core/schema.js"(exports2) {
- "use strict";
- var map = require_map();
- var _null = require_null();
- var seq = require_seq();
- var string = require_string();
- var bool = require_bool();
- var float = require_float();
- var int = require_int();
- var schema = [
- map.map,
- seq.seq,
- string.string,
- _null.nullTag,
- bool.boolTag,
- int.intOct,
- int.int,
- int.intHex,
- float.floatNaN,
- float.floatExp,
- float.float
- ];
- exports2.schema = schema;
- }
-});
-
-// ../../node_modules/yaml/dist/schema/json/schema.js
-var require_schema2 = __commonJS({
- "../../node_modules/yaml/dist/schema/json/schema.js"(exports2) {
- "use strict";
- var Scalar = require_Scalar();
- var map = require_map();
- var seq = require_seq();
- function intIdentify(value) {
- return typeof value === "bigint" || Number.isInteger(value);
- }
- var stringifyJSON = ({ value }) => JSON.stringify(value);
- var jsonScalars = [
- {
- identify: (value) => typeof value === "string",
- default: true,
- tag: "tag:yaml.org,2002:str",
- resolve: (str) => str,
- stringify: stringifyJSON
- },
- {
- identify: (value) => value == null,
- createNode: () => new Scalar.Scalar(null),
- default: true,
- tag: "tag:yaml.org,2002:null",
- test: /^null$/,
- resolve: () => null,
- stringify: stringifyJSON
- },
- {
- identify: (value) => typeof value === "boolean",
- default: true,
- tag: "tag:yaml.org,2002:bool",
- test: /^true$|^false$/,
- resolve: (str) => str === "true",
- stringify: stringifyJSON
- },
- {
- identify: intIdentify,
- default: true,
- tag: "tag:yaml.org,2002:int",
- test: /^-?(?:0|[1-9][0-9]*)$/,
- resolve: (str, _onError, { intAsBigInt }) => intAsBigInt ? BigInt(str) : parseInt(str, 10),
- stringify: ({ value }) => intIdentify(value) ? value.toString() : JSON.stringify(value)
- },
- {
- identify: (value) => typeof value === "number",
- default: true,
- tag: "tag:yaml.org,2002:float",
- test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
- resolve: (str) => parseFloat(str),
- stringify: stringifyJSON
- }
- ];
- var jsonError = {
- default: true,
- tag: "",
- test: /^/,
- resolve(str, onError) {
- onError(`Unresolved plain scalar ${JSON.stringify(str)}`);
- return str;
- }
- };
- var schema = [map.map, seq.seq].concat(jsonScalars, jsonError);
- exports2.schema = schema;
- }
-});
-
-// ../../node_modules/yaml/dist/schema/yaml-1.1/binary.js
-var require_binary = __commonJS({
- "../../node_modules/yaml/dist/schema/yaml-1.1/binary.js"(exports2) {
- "use strict";
- var node_buffer = require("node:buffer");
- var Scalar = require_Scalar();
- var stringifyString = require_stringifyString();
- var binary = {
- identify: (value) => value instanceof Uint8Array,
- // Buffer inherits from Uint8Array
- default: false,
- tag: "tag:yaml.org,2002:binary",
- /**
- * Returns a Buffer in node and an Uint8Array in browsers
- *
- * To use the resulting buffer as an image, you'll want to do something like:
- *
- * const blob = new Blob([buffer], { type: 'image/jpeg' })
- * document.querySelector('#photo').src = URL.createObjectURL(blob)
- */
- resolve(src, onError) {
- if (typeof node_buffer.Buffer === "function") {
- return node_buffer.Buffer.from(src, "base64");
- } else if (typeof atob === "function") {
- const str = atob(src.replace(/[\n\r]/g, ""));
- const buffer = new Uint8Array(str.length);
- for (let i = 0; i < str.length; ++i)
- buffer[i] = str.charCodeAt(i);
- return buffer;
- } else {
- onError("This environment does not support reading binary tags; either Buffer or atob is required");
- return src;
- }
- },
- stringify({ comment, type, value }, ctx, onComment, onChompKeep) {
- const buf = value;
- let str;
- if (typeof node_buffer.Buffer === "function") {
- str = buf instanceof node_buffer.Buffer ? buf.toString("base64") : node_buffer.Buffer.from(buf.buffer).toString("base64");
- } else if (typeof btoa === "function") {
- let s = "";
- for (let i = 0; i < buf.length; ++i)
- s += String.fromCharCode(buf[i]);
- str = btoa(s);
- } else {
- throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
- }
- if (!type)
- type = Scalar.Scalar.BLOCK_LITERAL;
- if (type !== Scalar.Scalar.QUOTE_DOUBLE) {
- const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
- const n = Math.ceil(str.length / lineWidth);
- const lines = new Array(n);
- for (let i = 0, o = 0; i < n; ++i, o += lineWidth) {
- lines[i] = str.substr(o, lineWidth);
- }
- str = lines.join(type === Scalar.Scalar.BLOCK_LITERAL ? "\n" : " ");
- }
- return stringifyString.stringifyString({ comment, type, value: str }, ctx, onComment, onChompKeep);
- }
- };
- exports2.binary = binary;
- }
-});
-
-// ../../node_modules/yaml/dist/schema/yaml-1.1/pairs.js
-var require_pairs = __commonJS({
- "../../node_modules/yaml/dist/schema/yaml-1.1/pairs.js"(exports2) {
- "use strict";
- var identity = require_identity();
- var Pair = require_Pair();
- var Scalar = require_Scalar();
- var YAMLSeq = require_YAMLSeq();
- function resolvePairs(seq, onError) {
- if (identity.isSeq(seq)) {
- for (let i = 0; i < seq.items.length; ++i) {
- let item = seq.items[i];
- if (identity.isPair(item))
- continue;
- else if (identity.isMap(item)) {
- if (item.items.length > 1)
- onError("Each pair must have its own sequence indicator");
- const pair = item.items[0] || new Pair.Pair(new Scalar.Scalar(null));
- if (item.commentBefore)
- pair.key.commentBefore = pair.key.commentBefore ? `${item.commentBefore}
-${pair.key.commentBefore}` : item.commentBefore;
- if (item.comment) {
- const cn = pair.value ?? pair.key;
- cn.comment = cn.comment ? `${item.comment}
-${cn.comment}` : item.comment;
- }
- item = pair;
- }
- seq.items[i] = identity.isPair(item) ? item : new Pair.Pair(item);
- }
- } else
- onError("Expected a sequence for this tag");
- return seq;
- }
- function createPairs(schema, iterable, ctx) {
- const { replacer } = ctx;
- const pairs2 = new YAMLSeq.YAMLSeq(schema);
- pairs2.tag = "tag:yaml.org,2002:pairs";
- let i = 0;
- if (iterable && Symbol.iterator in Object(iterable))
- for (let it of iterable) {
- if (typeof replacer === "function")
- it = replacer.call(iterable, String(i++), it);
- let key, value;
- if (Array.isArray(it)) {
- if (it.length === 2) {
- key = it[0];
- value = it[1];
- } else
- throw new TypeError(`Expected [key, value] tuple: ${it}`);
- } else if (it && it instanceof Object) {
- const keys = Object.keys(it);
- if (keys.length === 1) {
- key = keys[0];
- value = it[key];
- } else {
- throw new TypeError(`Expected tuple with one key, not ${keys.length} keys`);
- }
- } else {
- key = it;
- }
- pairs2.items.push(Pair.createPair(key, value, ctx));
- }
- return pairs2;
- }
- var pairs = {
- collection: "seq",
- default: false,
- tag: "tag:yaml.org,2002:pairs",
- resolve: resolvePairs,
- createNode: createPairs
- };
- exports2.createPairs = createPairs;
- exports2.pairs = pairs;
- exports2.resolvePairs = resolvePairs;
- }
-});
-
-// ../../node_modules/yaml/dist/schema/yaml-1.1/omap.js
-var require_omap = __commonJS({
- "../../node_modules/yaml/dist/schema/yaml-1.1/omap.js"(exports2) {
- "use strict";
- var identity = require_identity();
- var toJS = require_toJS();
- var YAMLMap = require_YAMLMap();
- var YAMLSeq = require_YAMLSeq();
- var pairs = require_pairs();
- var YAMLOMap = class _YAMLOMap extends YAMLSeq.YAMLSeq {
- constructor() {
- super();
- this.add = YAMLMap.YAMLMap.prototype.add.bind(this);
- this.delete = YAMLMap.YAMLMap.prototype.delete.bind(this);
- this.get = YAMLMap.YAMLMap.prototype.get.bind(this);
- this.has = YAMLMap.YAMLMap.prototype.has.bind(this);
- this.set = YAMLMap.YAMLMap.prototype.set.bind(this);
- this.tag = _YAMLOMap.tag;
- }
- /**
- * If `ctx` is given, the return type is actually `Map`,
- * but TypeScript won't allow widening the signature of a child method.
- */
- toJSON(_, ctx) {
- if (!ctx)
- return super.toJSON(_);
- const map = /* @__PURE__ */ new Map();
- if (ctx?.onCreate)
- ctx.onCreate(map);
- for (const pair of this.items) {
- let key, value;
- if (identity.isPair(pair)) {
- key = toJS.toJS(pair.key, "", ctx);
- value = toJS.toJS(pair.value, key, ctx);
- } else {
- key = toJS.toJS(pair, "", ctx);
- }
- if (map.has(key))
- throw new Error("Ordered maps must not include duplicate keys");
- map.set(key, value);
- }
- return map;
- }
- static from(schema, iterable, ctx) {
- const pairs$1 = pairs.createPairs(schema, iterable, ctx);
- const omap2 = new this();
- omap2.items = pairs$1.items;
- return omap2;
- }
- };
- YAMLOMap.tag = "tag:yaml.org,2002:omap";
- var omap = {
- collection: "seq",
- identify: (value) => value instanceof Map,
- nodeClass: YAMLOMap,
- default: false,
- tag: "tag:yaml.org,2002:omap",
- resolve(seq, onError) {
- const pairs$1 = pairs.resolvePairs(seq, onError);
- const seenKeys = [];
- for (const { key } of pairs$1.items) {
- if (identity.isScalar(key)) {
- if (seenKeys.includes(key.value)) {
- onError(`Ordered maps must not include duplicate keys: ${key.value}`);
- } else {
- seenKeys.push(key.value);
- }
- }
- }
- return Object.assign(new YAMLOMap(), pairs$1);
- },
- createNode: (schema, iterable, ctx) => YAMLOMap.from(schema, iterable, ctx)
- };
- exports2.YAMLOMap = YAMLOMap;
- exports2.omap = omap;
- }
-});
-
-// ../../node_modules/yaml/dist/schema/yaml-1.1/bool.js
-var require_bool2 = __commonJS({
- "../../node_modules/yaml/dist/schema/yaml-1.1/bool.js"(exports2) {
- "use strict";
- var Scalar = require_Scalar();
- function boolStringify({ value, source }, ctx) {
- const boolObj = value ? trueTag : falseTag;
- if (source && boolObj.test.test(source))
- return source;
- return value ? ctx.options.trueStr : ctx.options.falseStr;
- }
- var trueTag = {
- identify: (value) => value === true,
- default: true,
- tag: "tag:yaml.org,2002:bool",
- test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
- resolve: () => new Scalar.Scalar(true),
- stringify: boolStringify
- };
- var falseTag = {
- identify: (value) => value === false,
- default: true,
- tag: "tag:yaml.org,2002:bool",
- test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
- resolve: () => new Scalar.Scalar(false),
- stringify: boolStringify
- };
- exports2.falseTag = falseTag;
- exports2.trueTag = trueTag;
- }
-});
-
-// ../../node_modules/yaml/dist/schema/yaml-1.1/float.js
-var require_float2 = __commonJS({
- "../../node_modules/yaml/dist/schema/yaml-1.1/float.js"(exports2) {
- "use strict";
- var Scalar = require_Scalar();
- var stringifyNumber = require_stringifyNumber();
- var floatNaN = {
- identify: (value) => typeof value === "number",
- default: true,
- tag: "tag:yaml.org,2002:float",
- test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
- resolve: (str) => str.slice(-3).toLowerCase() === "nan" ? NaN : str[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
- stringify: stringifyNumber.stringifyNumber
- };
- var floatExp = {
- identify: (value) => typeof value === "number",
- default: true,
- tag: "tag:yaml.org,2002:float",
- format: "EXP",
- test: /^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,
- resolve: (str) => parseFloat(str.replace(/_/g, "")),
- stringify(node) {
- const num = Number(node.value);
- return isFinite(num) ? num.toExponential() : stringifyNumber.stringifyNumber(node);
- }
- };
- var float = {
- identify: (value) => typeof value === "number",
- default: true,
- tag: "tag:yaml.org,2002:float",
- test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
- resolve(str) {
- const node = new Scalar.Scalar(parseFloat(str.replace(/_/g, "")));
- const dot = str.indexOf(".");
- if (dot !== -1) {
- const f = str.substring(dot + 1).replace(/_/g, "");
- if (f[f.length - 1] === "0")
- node.minFractionDigits = f.length;
- }
- return node;
- },
- stringify: stringifyNumber.stringifyNumber
- };
- exports2.float = float;
- exports2.floatExp = floatExp;
- exports2.floatNaN = floatNaN;
- }
-});
-
-// ../../node_modules/yaml/dist/schema/yaml-1.1/int.js
-var require_int2 = __commonJS({
- "../../node_modules/yaml/dist/schema/yaml-1.1/int.js"(exports2) {
- "use strict";
- var stringifyNumber = require_stringifyNumber();
- var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
- function intResolve(str, offset, radix, { intAsBigInt }) {
- const sign = str[0];
- if (sign === "-" || sign === "+")
- offset += 1;
- str = str.substring(offset).replace(/_/g, "");
- if (intAsBigInt) {
- switch (radix) {
- case 2:
- str = `0b${str}`;
- break;
- case 8:
- str = `0o${str}`;
- break;
- case 16:
- str = `0x${str}`;
- break;
- }
- const n2 = BigInt(str);
- return sign === "-" ? BigInt(-1) * n2 : n2;
- }
- const n = parseInt(str, radix);
- return sign === "-" ? -1 * n : n;
- }
- function intStringify(node, radix, prefix) {
- const { value } = node;
- if (intIdentify(value)) {
- const str = value.toString(radix);
- return value < 0 ? "-" + prefix + str.substr(1) : prefix + str;
- }
- return stringifyNumber.stringifyNumber(node);
- }
- var intBin = {
- identify: intIdentify,
- default: true,
- tag: "tag:yaml.org,2002:int",
- format: "BIN",
- test: /^[-+]?0b[0-1_]+$/,
- resolve: (str, _onError, opt) => intResolve(str, 2, 2, opt),
- stringify: (node) => intStringify(node, 2, "0b")
- };
- var intOct = {
- identify: intIdentify,
- default: true,
- tag: "tag:yaml.org,2002:int",
- format: "OCT",
- test: /^[-+]?0[0-7_]+$/,
- resolve: (str, _onError, opt) => intResolve(str, 1, 8, opt),
- stringify: (node) => intStringify(node, 8, "0")
- };
- var int = {
- identify: intIdentify,
- default: true,
- tag: "tag:yaml.org,2002:int",
- test: /^[-+]?[0-9][0-9_]*$/,
- resolve: (str, _onError, opt) => intResolve(str, 0, 10, opt),
- stringify: stringifyNumber.stringifyNumber
- };
- var intHex = {
- identify: intIdentify,
- default: true,
- tag: "tag:yaml.org,2002:int",
- format: "HEX",
- test: /^[-+]?0x[0-9a-fA-F_]+$/,
- resolve: (str, _onError, opt) => intResolve(str, 2, 16, opt),
- stringify: (node) => intStringify(node, 16, "0x")
- };
- exports2.int = int;
- exports2.intBin = intBin;
- exports2.intHex = intHex;
- exports2.intOct = intOct;
- }
-});
-
-// ../../node_modules/yaml/dist/schema/yaml-1.1/set.js
-var require_set = __commonJS({
- "../../node_modules/yaml/dist/schema/yaml-1.1/set.js"(exports2) {
- "use strict";
- var identity = require_identity();
- var Pair = require_Pair();
- var YAMLMap = require_YAMLMap();
- var YAMLSet = class _YAMLSet extends YAMLMap.YAMLMap {
- constructor(schema) {
- super(schema);
- this.tag = _YAMLSet.tag;
- }
- add(key) {
- let pair;
- if (identity.isPair(key))
- pair = key;
- else if (key && typeof key === "object" && "key" in key && "value" in key && key.value === null)
- pair = new Pair.Pair(key.key, null);
- else
- pair = new Pair.Pair(key, null);
- const prev = YAMLMap.findPair(this.items, pair.key);
- if (!prev)
- this.items.push(pair);
- }
- /**
- * If `keepPair` is `true`, returns the Pair matching `key`.
- * Otherwise, returns the value of that Pair's key.
- */
- get(key, keepPair) {
- const pair = YAMLMap.findPair(this.items, key);
- return !keepPair && identity.isPair(pair) ? identity.isScalar(pair.key) ? pair.key.value : pair.key : pair;
- }
- set(key, value) {
- if (typeof value !== "boolean")
- throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof value}`);
- const prev = YAMLMap.findPair(this.items, key);
- if (prev && !value) {
- this.items.splice(this.items.indexOf(prev), 1);
- } else if (!prev && value) {
- this.items.push(new Pair.Pair(key));
- }
- }
- toJSON(_, ctx) {
- return super.toJSON(_, ctx, Set);
- }
- toString(ctx, onComment, onChompKeep) {
- if (!ctx)
- return JSON.stringify(this);
- if (this.hasAllNullValues(true))
- return super.toString(Object.assign({}, ctx, { allNullValues: true }), onComment, onChompKeep);
- else
- throw new Error("Set items must all have null values");
- }
- static from(schema, iterable, ctx) {
- const { replacer } = ctx;
- const set2 = new this(schema);
- if (iterable && Symbol.iterator in Object(iterable))
- for (let value of iterable) {
- if (typeof replacer === "function")
- value = replacer.call(iterable, value, value);
- set2.items.push(Pair.createPair(value, null, ctx));
- }
- return set2;
- }
- };
- YAMLSet.tag = "tag:yaml.org,2002:set";
- var set = {
- collection: "map",
- identify: (value) => value instanceof Set,
- nodeClass: YAMLSet,
- default: false,
- tag: "tag:yaml.org,2002:set",
- createNode: (schema, iterable, ctx) => YAMLSet.from(schema, iterable, ctx),
- resolve(map, onError) {
- if (identity.isMap(map)) {
- if (map.hasAllNullValues(true))
- return Object.assign(new YAMLSet(), map);
- else
- onError("Set items must all have null values");
- } else
- onError("Expected a mapping for this tag");
- return map;
- }
- };
- exports2.YAMLSet = YAMLSet;
- exports2.set = set;
- }
-});
-
-// ../../node_modules/yaml/dist/schema/yaml-1.1/timestamp.js
-var require_timestamp = __commonJS({
- "../../node_modules/yaml/dist/schema/yaml-1.1/timestamp.js"(exports2) {
- "use strict";
- var stringifyNumber = require_stringifyNumber();
- function parseSexagesimal(str, asBigInt) {
- const sign = str[0];
- const parts = sign === "-" || sign === "+" ? str.substring(1) : str;
- const num = (n) => asBigInt ? BigInt(n) : Number(n);
- const res = parts.replace(/_/g, "").split(":").reduce((res2, p) => res2 * num(60) + num(p), num(0));
- return sign === "-" ? num(-1) * res : res;
- }
- function stringifySexagesimal(node) {
- let { value } = node;
- let num = (n) => n;
- if (typeof value === "bigint")
- num = (n) => BigInt(n);
- else if (isNaN(value) || !isFinite(value))
- return stringifyNumber.stringifyNumber(node);
- let sign = "";
- if (value < 0) {
- sign = "-";
- value *= num(-1);
- }
- const _60 = num(60);
- const parts = [value % _60];
- if (value < 60) {
- parts.unshift(0);
- } else {
- value = (value - parts[0]) / _60;
- parts.unshift(value % _60);
- if (value >= 60) {
- value = (value - parts[0]) / _60;
- parts.unshift(value);
- }
- }
- return sign + parts.map((n) => String(n).padStart(2, "0")).join(":").replace(/000000\d*$/, "");
- }
- var intTime = {
- identify: (value) => typeof value === "bigint" || Number.isInteger(value),
- default: true,
- tag: "tag:yaml.org,2002:int",
- format: "TIME",
- test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,
- resolve: (str, _onError, { intAsBigInt }) => parseSexagesimal(str, intAsBigInt),
- stringify: stringifySexagesimal
- };
- var floatTime = {
- identify: (value) => typeof value === "number",
- default: true,
- tag: "tag:yaml.org,2002:float",
- format: "TIME",
- test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,
- resolve: (str) => parseSexagesimal(str, false),
- stringify: stringifySexagesimal
- };
- var timestamp = {
- identify: (value) => value instanceof Date,
- default: true,
- tag: "tag:yaml.org,2002:timestamp",
- // If the time zone is omitted, the timestamp is assumed to be specified in UTC. The time part
- // may be omitted altogether, resulting in a date format. In such a case, the time part is
- // assumed to be 00:00:00Z (start of day, UTC).
- test: RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),
- resolve(str) {
- const match = str.match(timestamp.test);
- if (!match)
- throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
- const [, year, month, day, hour, minute, second] = match.map(Number);
- const millisec = match[7] ? Number((match[7] + "00").substr(1, 3)) : 0;
- let date = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec);
- const tz = match[8];
- if (tz && tz !== "Z") {
- let d = parseSexagesimal(tz, false);
- if (Math.abs(d) < 30)
- d *= 60;
- date -= 6e4 * d;
- }
- return new Date(date);
- },
- stringify: ({ value }) => value.toISOString().replace(/(T00:00:00)?\.000Z$/, "")
- };
- exports2.floatTime = floatTime;
- exports2.intTime = intTime;
- exports2.timestamp = timestamp;
- }
-});
-
-// ../../node_modules/yaml/dist/schema/yaml-1.1/schema.js
-var require_schema3 = __commonJS({
- "../../node_modules/yaml/dist/schema/yaml-1.1/schema.js"(exports2) {
- "use strict";
- var map = require_map();
- var _null = require_null();
- var seq = require_seq();
- var string = require_string();
- var binary = require_binary();
- var bool = require_bool2();
- var float = require_float2();
- var int = require_int2();
- var merge = require_merge();
- var omap = require_omap();
- var pairs = require_pairs();
- var set = require_set();
- var timestamp = require_timestamp();
- var schema = [
- map.map,
- seq.seq,
- string.string,
- _null.nullTag,
- bool.trueTag,
- bool.falseTag,
- int.intBin,
- int.intOct,
- int.int,
- int.intHex,
- float.floatNaN,
- float.floatExp,
- float.float,
- binary.binary,
- merge.merge,
- omap.omap,
- pairs.pairs,
- set.set,
- timestamp.intTime,
- timestamp.floatTime,
- timestamp.timestamp
- ];
- exports2.schema = schema;
- }
-});
-
-// ../../node_modules/yaml/dist/schema/tags.js
-var require_tags = __commonJS({
- "../../node_modules/yaml/dist/schema/tags.js"(exports2) {
- "use strict";
- var map = require_map();
- var _null = require_null();
- var seq = require_seq();
- var string = require_string();
- var bool = require_bool();
- var float = require_float();
- var int = require_int();
- var schema = require_schema();
- var schema$1 = require_schema2();
- var binary = require_binary();
- var merge = require_merge();
- var omap = require_omap();
- var pairs = require_pairs();
- var schema$2 = require_schema3();
- var set = require_set();
- var timestamp = require_timestamp();
- var schemas = /* @__PURE__ */ new Map([
- ["core", schema.schema],
- ["failsafe", [map.map, seq.seq, string.string]],
- ["json", schema$1.schema],
- ["yaml11", schema$2.schema],
- ["yaml-1.1", schema$2.schema]
- ]);
- var tagsByName = {
- binary: binary.binary,
- bool: bool.boolTag,
- float: float.float,
- floatExp: float.floatExp,
- floatNaN: float.floatNaN,
- floatTime: timestamp.floatTime,
- int: int.int,
- intHex: int.intHex,
- intOct: int.intOct,
- intTime: timestamp.intTime,
- map: map.map,
- merge: merge.merge,
- null: _null.nullTag,
- omap: omap.omap,
- pairs: pairs.pairs,
- seq: seq.seq,
- set: set.set,
- timestamp: timestamp.timestamp
- };
- var coreKnownTags = {
- "tag:yaml.org,2002:binary": binary.binary,
- "tag:yaml.org,2002:merge": merge.merge,
- "tag:yaml.org,2002:omap": omap.omap,
- "tag:yaml.org,2002:pairs": pairs.pairs,
- "tag:yaml.org,2002:set": set.set,
- "tag:yaml.org,2002:timestamp": timestamp.timestamp
- };
- function getTags(customTags, schemaName, addMergeTag) {
- const schemaTags = schemas.get(schemaName);
- if (schemaTags && !customTags) {
- return addMergeTag && !schemaTags.includes(merge.merge) ? schemaTags.concat(merge.merge) : schemaTags.slice();
- }
- let tags = schemaTags;
- if (!tags) {
- if (Array.isArray(customTags))
- tags = [];
- else {
- const keys = Array.from(schemas.keys()).filter((key) => key !== "yaml11").map((key) => JSON.stringify(key)).join(", ");
- throw new Error(`Unknown schema "${schemaName}"; use one of ${keys} or define customTags array`);
- }
- }
- if (Array.isArray(customTags)) {
- for (const tag of customTags)
- tags = tags.concat(tag);
- } else if (typeof customTags === "function") {
- tags = customTags(tags.slice());
- }
- if (addMergeTag)
- tags = tags.concat(merge.merge);
- return tags.reduce((tags2, tag) => {
- const tagObj = typeof tag === "string" ? tagsByName[tag] : tag;
- if (!tagObj) {
- const tagName = JSON.stringify(tag);
- const keys = Object.keys(tagsByName).map((key) => JSON.stringify(key)).join(", ");
- throw new Error(`Unknown custom tag ${tagName}; use one of ${keys}`);
- }
- if (!tags2.includes(tagObj))
- tags2.push(tagObj);
- return tags2;
- }, []);
- }
- exports2.coreKnownTags = coreKnownTags;
- exports2.getTags = getTags;
- }
-});
-
-// ../../node_modules/yaml/dist/schema/Schema.js
-var require_Schema = __commonJS({
- "../../node_modules/yaml/dist/schema/Schema.js"(exports2) {
- "use strict";
- var identity = require_identity();
- var map = require_map();
- var seq = require_seq();
- var string = require_string();
- var tags = require_tags();
- var sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
- var Schema = class _Schema {
- constructor({ compat, customTags, merge, resolveKnownTags, schema, sortMapEntries, toStringDefaults }) {
- this.compat = Array.isArray(compat) ? tags.getTags(compat, "compat") : compat ? tags.getTags(null, compat) : null;
- this.name = typeof schema === "string" && schema || "core";
- this.knownTags = resolveKnownTags ? tags.coreKnownTags : {};
- this.tags = tags.getTags(customTags, this.name, merge);
- this.toStringOptions = toStringDefaults ?? null;
- Object.defineProperty(this, identity.MAP, { value: map.map });
- Object.defineProperty(this, identity.SCALAR, { value: string.string });
- Object.defineProperty(this, identity.SEQ, { value: seq.seq });
- this.sortMapEntries = typeof sortMapEntries === "function" ? sortMapEntries : sortMapEntries === true ? sortMapEntriesByKey : null;
- }
- clone() {
- const copy = Object.create(_Schema.prototype, Object.getOwnPropertyDescriptors(this));
- copy.tags = this.tags.slice();
- return copy;
- }
- };
- exports2.Schema = Schema;
- }
-});
-
-// ../../node_modules/yaml/dist/stringify/stringifyDocument.js
-var require_stringifyDocument = __commonJS({
- "../../node_modules/yaml/dist/stringify/stringifyDocument.js"(exports2) {
- "use strict";
- var identity = require_identity();
- var stringify = require_stringify();
- var stringifyComment = require_stringifyComment();
- function stringifyDocument(doc, options) {
- const lines = [];
- let hasDirectives = options.directives === true;
- if (options.directives !== false && doc.directives) {
- const dir = doc.directives.toString(doc);
- if (dir) {
- lines.push(dir);
- hasDirectives = true;
- } else if (doc.directives.docStart)
- hasDirectives = true;
- }
- if (hasDirectives)
- lines.push("---");
- const ctx = stringify.createStringifyContext(doc, options);
- const { commentString } = ctx.options;
- if (doc.commentBefore) {
- if (lines.length !== 1)
- lines.unshift("");
- const cs = commentString(doc.commentBefore);
- lines.unshift(stringifyComment.indentComment(cs, ""));
- }
- let chompKeep = false;
- let contentComment = null;
- if (doc.contents) {
- if (identity.isNode(doc.contents)) {
- if (doc.contents.spaceBefore && hasDirectives)
- lines.push("");
- if (doc.contents.commentBefore) {
- const cs = commentString(doc.contents.commentBefore);
- lines.push(stringifyComment.indentComment(cs, ""));
- }
- ctx.forceBlockIndent = !!doc.comment;
- contentComment = doc.contents.comment;
- }
- const onChompKeep = contentComment ? void 0 : () => chompKeep = true;
- let body = stringify.stringify(doc.contents, ctx, () => contentComment = null, onChompKeep);
- if (contentComment)
- body += stringifyComment.lineComment(body, "", commentString(contentComment));
- if ((body[0] === "|" || body[0] === ">") && lines[lines.length - 1] === "---") {
- lines[lines.length - 1] = `--- ${body}`;
- } else
- lines.push(body);
- } else {
- lines.push(stringify.stringify(doc.contents, ctx));
- }
- if (doc.directives?.docEnd) {
- if (doc.comment) {
- const cs = commentString(doc.comment);
- if (cs.includes("\n")) {
- lines.push("...");
- lines.push(stringifyComment.indentComment(cs, ""));
- } else {
- lines.push(`... ${cs}`);
- }
- } else {
- lines.push("...");
- }
- } else {
- let dc = doc.comment;
- if (dc && chompKeep)
- dc = dc.replace(/^\n+/, "");
- if (dc) {
- if ((!chompKeep || contentComment) && lines[lines.length - 1] !== "")
- lines.push("");
- lines.push(stringifyComment.indentComment(commentString(dc), ""));
- }
- }
- return lines.join("\n") + "\n";
- }
- exports2.stringifyDocument = stringifyDocument;
- }
-});
-
-// ../../node_modules/yaml/dist/doc/Document.js
-var require_Document = __commonJS({
- "../../node_modules/yaml/dist/doc/Document.js"(exports2) {
- "use strict";
- var Alias = require_Alias();
- var Collection = require_Collection();
- var identity = require_identity();
- var Pair = require_Pair();
- var toJS = require_toJS();
- var Schema = require_Schema();
- var stringifyDocument = require_stringifyDocument();
- var anchors = require_anchors();
- var applyReviver = require_applyReviver();
- var createNode = require_createNode();
- var directives = require_directives();
- var Document = class _Document {
- constructor(value, replacer, options) {
- this.commentBefore = null;
- this.comment = null;
- this.errors = [];
- this.warnings = [];
- Object.defineProperty(this, identity.NODE_TYPE, { value: identity.DOC });
- let _replacer = null;
- if (typeof replacer === "function" || Array.isArray(replacer)) {
- _replacer = replacer;
- } else if (options === void 0 && replacer) {
- options = replacer;
- replacer = void 0;
- }
- const opt = Object.assign({
- intAsBigInt: false,
- keepSourceTokens: false,
- logLevel: "warn",
- prettyErrors: true,
- strict: true,
- stringKeys: false,
- uniqueKeys: true,
- version: "1.2"
- }, options);
- this.options = opt;
- let { version } = opt;
- if (options?._directives) {
- this.directives = options._directives.atDocument();
- if (this.directives.yaml.explicit)
- version = this.directives.yaml.version;
- } else
- this.directives = new directives.Directives({ version });
- this.setSchema(version, options);
- this.contents = value === void 0 ? null : this.createNode(value, _replacer, options);
- }
- /**
- * Create a deep copy of this Document and its contents.
- *
- * Custom Node values that inherit from `Object` still refer to their original instances.
- */
- clone() {
- const copy = Object.create(_Document.prototype, {
- [identity.NODE_TYPE]: { value: identity.DOC }
- });
- copy.commentBefore = this.commentBefore;
- copy.comment = this.comment;
- copy.errors = this.errors.slice();
- copy.warnings = this.warnings.slice();
- copy.options = Object.assign({}, this.options);
- if (this.directives)
- copy.directives = this.directives.clone();
- copy.schema = this.schema.clone();
- copy.contents = identity.isNode(this.contents) ? this.contents.clone(copy.schema) : this.contents;
- if (this.range)
- copy.range = this.range.slice();
- return copy;
- }
- /** Adds a value to the document. */
- add(value) {
- if (assertCollection(this.contents))
- this.contents.add(value);
- }
- /** Adds a value to the document. */
- addIn(path, value) {
- if (assertCollection(this.contents))
- this.contents.addIn(path, value);
- }
- /**
- * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
- *
- * If `node` already has an anchor, `name` is ignored.
- * Otherwise, the `node.anchor` value will be set to `name`,
- * or if an anchor with that name is already present in the document,
- * `name` will be used as a prefix for a new unique anchor.
- * If `name` is undefined, the generated anchor will use 'a' as a prefix.
- */
- createAlias(node, name) {
- if (!node.anchor) {
- const prev = anchors.anchorNames(this);
- node.anchor = // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
- !name || prev.has(name) ? anchors.findNewAnchor(name || "a", prev) : name;
- }
- return new Alias.Alias(node.anchor);
- }
- createNode(value, replacer, options) {
- let _replacer = void 0;
- if (typeof replacer === "function") {
- value = replacer.call({ "": value }, "", value);
- _replacer = replacer;
- } else if (Array.isArray(replacer)) {
- const keyToStr = (v) => typeof v === "number" || v instanceof String || v instanceof Number;
- const asStr = replacer.filter(keyToStr).map(String);
- if (asStr.length > 0)
- replacer = replacer.concat(asStr);
- _replacer = replacer;
- } else if (options === void 0 && replacer) {
- options = replacer;
- replacer = void 0;
- }
- const { aliasDuplicateObjects, anchorPrefix, flow, keepUndefined, onTagObj, tag } = options ?? {};
- const { onAnchor, setAnchors, sourceObjects } = anchors.createNodeAnchors(
- this,
- // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
- anchorPrefix || "a"
- );
- const ctx = {
- aliasDuplicateObjects: aliasDuplicateObjects ?? true,
- keepUndefined: keepUndefined ?? false,
- onAnchor,
- onTagObj,
- replacer: _replacer,
- schema: this.schema,
- sourceObjects
- };
- const node = createNode.createNode(value, tag, ctx);
- if (flow && identity.isCollection(node))
- node.flow = true;
- setAnchors();
- return node;
- }
- /**
- * Convert a key and a value into a `Pair` using the current schema,
- * recursively wrapping all values as `Scalar` or `Collection` nodes.
- */
- createPair(key, value, options = {}) {
- const k = this.createNode(key, null, options);
- const v = this.createNode(value, null, options);
- return new Pair.Pair(k, v);
- }
- /**
- * Removes a value from the document.
- * @returns `true` if the item was found and removed.
- */
- delete(key) {
- return assertCollection(this.contents) ? this.contents.delete(key) : false;
- }
- /**
- * Removes a value from the document.
- * @returns `true` if the item was found and removed.
- */
- deleteIn(path) {
- if (Collection.isEmptyPath(path)) {
- if (this.contents == null)
- return false;
- this.contents = null;
- return true;
- }
- return assertCollection(this.contents) ? this.contents.deleteIn(path) : false;
- }
- /**
- * Returns item at `key`, or `undefined` if not found. By default unwraps
- * scalar values from their surrounding node; to disable set `keepScalar` to
- * `true` (collections are always returned intact).
- */
- get(key, keepScalar) {
- return identity.isCollection(this.contents) ? this.contents.get(key, keepScalar) : void 0;
- }
- /**
- * Returns item at `path`, or `undefined` if not found. By default unwraps
- * scalar values from their surrounding node; to disable set `keepScalar` to
- * `true` (collections are always returned intact).
- */
- getIn(path, keepScalar) {
- if (Collection.isEmptyPath(path))
- return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
- return identity.isCollection(this.contents) ? this.contents.getIn(path, keepScalar) : void 0;
- }
- /**
- * Checks if the document includes a value with the key `key`.
- */
- has(key) {
- return identity.isCollection(this.contents) ? this.contents.has(key) : false;
- }
- /**
- * Checks if the document includes a value at `path`.
- */
- hasIn(path) {
- if (Collection.isEmptyPath(path))
- return this.contents !== void 0;
- return identity.isCollection(this.contents) ? this.contents.hasIn(path) : false;
- }
- /**
- * Sets a value in this document. For `!!set`, `value` needs to be a
- * boolean to add/remove the item from the set.
- */
- set(key, value) {
- if (this.contents == null) {
- this.contents = Collection.collectionFromPath(this.schema, [key], value);
- } else if (assertCollection(this.contents)) {
- this.contents.set(key, value);
- }
- }
- /**
- * Sets a value in this document. For `!!set`, `value` needs to be a
- * boolean to add/remove the item from the set.
- */
- setIn(path, value) {
- if (Collection.isEmptyPath(path)) {
- this.contents = value;
- } else if (this.contents == null) {
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path), value);
- } else if (assertCollection(this.contents)) {
- this.contents.setIn(path, value);
- }
- }
- /**
- * Change the YAML version and schema used by the document.
- * A `null` version disables support for directives, explicit tags, anchors, and aliases.
- * It also requires the `schema` option to be given as a `Schema` instance value.
- *
- * Overrides all previously set schema options.
- */
- setSchema(version, options = {}) {
- if (typeof version === "number")
- version = String(version);
- let opt;
- switch (version) {
- case "1.1":
- if (this.directives)
- this.directives.yaml.version = "1.1";
- else
- this.directives = new directives.Directives({ version: "1.1" });
- opt = { resolveKnownTags: false, schema: "yaml-1.1" };
- break;
- case "1.2":
- case "next":
- if (this.directives)
- this.directives.yaml.version = version;
- else
- this.directives = new directives.Directives({ version });
- opt = { resolveKnownTags: true, schema: "core" };
- break;
- case null:
- if (this.directives)
- delete this.directives;
- opt = null;
- break;
- default: {
- const sv = JSON.stringify(version);
- throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${sv}`);
- }
- }
- if (options.schema instanceof Object)
- this.schema = options.schema;
- else if (opt)
- this.schema = new Schema.Schema(Object.assign(opt, options));
- else
- throw new Error(`With a null YAML version, the { schema: Schema } option is required`);
- }
- // json & jsonArg are only used from toJSON()
- toJS({ json, jsonArg, mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {
- const ctx = {
- anchors: /* @__PURE__ */ new Map(),
- doc: this,
- keep: !json,
- mapAsMap: mapAsMap === true,
- mapKeyWarned: false,
- maxAliasCount: typeof maxAliasCount === "number" ? maxAliasCount : 100
- };
- const res = toJS.toJS(this.contents, jsonArg ?? "", ctx);
- if (typeof onAnchor === "function")
- for (const { count, res: res2 } of ctx.anchors.values())
- onAnchor(res2, count);
- return typeof reviver === "function" ? applyReviver.applyReviver(reviver, { "": res }, "", res) : res;
- }
- /**
- * A JSON representation of the document `contents`.
- *
- * @param jsonArg Used by `JSON.stringify` to indicate the array index or
- * property name.
- */
- toJSON(jsonArg, onAnchor) {
- return this.toJS({ json: true, jsonArg, mapAsMap: false, onAnchor });
- }
- /** A YAML representation of the document. */
- toString(options = {}) {
- if (this.errors.length > 0)
- throw new Error("Document with errors cannot be stringified");
- if ("indent" in options && (!Number.isInteger(options.indent) || Number(options.indent) <= 0)) {
- const s = JSON.stringify(options.indent);
- throw new Error(`"indent" option must be a positive integer, not ${s}`);
- }
- return stringifyDocument.stringifyDocument(this, options);
- }
- };
- function assertCollection(contents) {
- if (identity.isCollection(contents))
- return true;
- throw new Error("Expected a YAML collection as document contents");
- }
- exports2.Document = Document;
- }
-});
-
-// ../../node_modules/yaml/dist/errors.js
-var require_errors = __commonJS({
- "../../node_modules/yaml/dist/errors.js"(exports2) {
- "use strict";
- var YAMLError = class extends Error {
- constructor(name, pos, code, message) {
- super();
- this.name = name;
- this.code = code;
- this.message = message;
- this.pos = pos;
- }
- };
- var YAMLParseError = class extends YAMLError {
- constructor(pos, code, message) {
- super("YAMLParseError", pos, code, message);
- }
- };
- var YAMLWarning = class extends YAMLError {
- constructor(pos, code, message) {
- super("YAMLWarning", pos, code, message);
- }
- };
- var prettifyError = (src, lc) => (error) => {
- if (error.pos[0] === -1)
- return;
- error.linePos = error.pos.map((pos) => lc.linePos(pos));
- const { line, col } = error.linePos[0];
- error.message += ` at line ${line}, column ${col}`;
- let ci = col - 1;
- let lineStr = src.substring(lc.lineStarts[line - 1], lc.lineStarts[line]).replace(/[\n\r]+$/, "");
- if (ci >= 60 && lineStr.length > 80) {
- const trimStart = Math.min(ci - 39, lineStr.length - 79);
- lineStr = "\u2026" + lineStr.substring(trimStart);
- ci -= trimStart - 1;
- }
- if (lineStr.length > 80)
- lineStr = lineStr.substring(0, 79) + "\u2026";
- if (line > 1 && /^ *$/.test(lineStr.substring(0, ci))) {
- let prev = src.substring(lc.lineStarts[line - 2], lc.lineStarts[line - 1]);
- if (prev.length > 80)
- prev = prev.substring(0, 79) + "\u2026\n";
- lineStr = prev + lineStr;
- }
- if (/[^ ]/.test(lineStr)) {
- let count = 1;
- const end = error.linePos[1];
- if (end && end.line === line && end.col > col) {
- count = Math.max(1, Math.min(end.col - col, 80 - ci));
- }
- const pointer = " ".repeat(ci) + "^".repeat(count);
- error.message += `:
-
-${lineStr}
-${pointer}
-`;
- }
- };
- exports2.YAMLError = YAMLError;
- exports2.YAMLParseError = YAMLParseError;
- exports2.YAMLWarning = YAMLWarning;
- exports2.prettifyError = prettifyError;
- }
-});
-
-// ../../node_modules/yaml/dist/compose/resolve-props.js
-var require_resolve_props = __commonJS({
- "../../node_modules/yaml/dist/compose/resolve-props.js"(exports2) {
- "use strict";
- function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {
- let spaceBefore = false;
- let atNewline = startOnNewline;
- let hasSpace = startOnNewline;
- let comment = "";
- let commentSep = "";
- let hasNewline = false;
- let reqSpace = false;
- let tab = null;
- let anchor = null;
- let tag = null;
- let newlineAfterProp = null;
- let comma = null;
- let found = null;
- let start = null;
- for (const token of tokens) {
- if (reqSpace) {
- if (token.type !== "space" && token.type !== "newline" && token.type !== "comma")
- onError(token.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space");
- reqSpace = false;
- }
- if (tab) {
- if (atNewline && token.type !== "comment" && token.type !== "newline") {
- onError(tab, "TAB_AS_INDENT", "Tabs are not allowed as indentation");
- }
- tab = null;
- }
- switch (token.type) {
- case "space":
- if (!flow && (indicator !== "doc-start" || next?.type !== "flow-collection") && token.source.includes(" ")) {
- tab = token;
- }
- hasSpace = true;
- break;
- case "comment": {
- if (!hasSpace)
- onError(token, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
- const cb = token.source.substring(1) || " ";
- if (!comment)
- comment = cb;
- else
- comment += commentSep + cb;
- commentSep = "";
- atNewline = false;
- break;
- }
- case "newline":
- if (atNewline) {
- if (comment)
- comment += token.source;
- else if (!found || indicator !== "seq-item-ind")
- spaceBefore = true;
- } else
- commentSep += token.source;
- atNewline = true;
- hasNewline = true;
- if (anchor || tag)
- newlineAfterProp = token;
- hasSpace = true;
- break;
- case "anchor":
- if (anchor)
- onError(token, "MULTIPLE_ANCHORS", "A node can have at most one anchor");
- if (token.source.endsWith(":"))
- onError(token.offset + token.source.length - 1, "BAD_ALIAS", "Anchor ending in : is ambiguous", true);
- anchor = token;
- if (start === null)
- start = token.offset;
- atNewline = false;
- hasSpace = false;
- reqSpace = true;
- break;
- case "tag": {
- if (tag)
- onError(token, "MULTIPLE_TAGS", "A node can have at most one tag");
- tag = token;
- if (start === null)
- start = token.offset;
- atNewline = false;
- hasSpace = false;
- reqSpace = true;
- break;
- }
- case indicator:
- if (anchor || tag)
- onError(token, "BAD_PROP_ORDER", `Anchors and tags must be after the ${token.source} indicator`);
- if (found)
- onError(token, "UNEXPECTED_TOKEN", `Unexpected ${token.source} in ${flow ?? "collection"}`);
- found = token;
- atNewline = indicator === "seq-item-ind" || indicator === "explicit-key-ind";
- hasSpace = false;
- break;
- case "comma":
- if (flow) {
- if (comma)
- onError(token, "UNEXPECTED_TOKEN", `Unexpected , in ${flow}`);
- comma = token;
- atNewline = false;
- hasSpace = false;
- break;
- }
- default:
- onError(token, "UNEXPECTED_TOKEN", `Unexpected ${token.type} token`);
- atNewline = false;
- hasSpace = false;
- }
- }
- const last = tokens[tokens.length - 1];
- const end = last ? last.offset + last.source.length : offset;
- if (reqSpace && next && next.type !== "space" && next.type !== "newline" && next.type !== "comma" && (next.type !== "scalar" || next.source !== "")) {
- onError(next.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space");
- }
- if (tab && (atNewline && tab.indent <= parentIndent || next?.type === "block-map" || next?.type === "block-seq"))
- onError(tab, "TAB_AS_INDENT", "Tabs are not allowed as indentation");
- return {
- comma,
- found,
- spaceBefore,
- comment,
- hasNewline,
- anchor,
- tag,
- newlineAfterProp,
- end,
- start: start ?? end
- };
- }
- exports2.resolveProps = resolveProps;
- }
-});
-
-// ../../node_modules/yaml/dist/compose/util-contains-newline.js
-var require_util_contains_newline = __commonJS({
- "../../node_modules/yaml/dist/compose/util-contains-newline.js"(exports2) {
- "use strict";
- function containsNewline(key) {
- if (!key)
- return null;
- switch (key.type) {
- case "alias":
- case "scalar":
- case "double-quoted-scalar":
- case "single-quoted-scalar":
- if (key.source.includes("\n"))
- return true;
- if (key.end) {
- for (const st of key.end)
- if (st.type === "newline")
- return true;
- }
- return false;
- case "flow-collection":
- for (const it of key.items) {
- for (const st of it.start)
- if (st.type === "newline")
- return true;
- if (it.sep) {
- for (const st of it.sep)
- if (st.type === "newline")
- return true;
- }
- if (containsNewline(it.key) || containsNewline(it.value))
- return true;
- }
- return false;
- default:
- return true;
- }
- }
- exports2.containsNewline = containsNewline;
- }
-});
-
-// ../../node_modules/yaml/dist/compose/util-flow-indent-check.js
-var require_util_flow_indent_check = __commonJS({
- "../../node_modules/yaml/dist/compose/util-flow-indent-check.js"(exports2) {
- "use strict";
- var utilContainsNewline = require_util_contains_newline();
- function flowIndentCheck(indent, fc, onError) {
- if (fc?.type === "flow-collection") {
- const end = fc.end[0];
- if (end.indent === indent && (end.source === "]" || end.source === "}") && utilContainsNewline.containsNewline(fc)) {
- const msg = "Flow end indicator should be more indented than parent";
- onError(end, "BAD_INDENT", msg, true);
- }
- }
- }
- exports2.flowIndentCheck = flowIndentCheck;
- }
-});
-
-// ../../node_modules/yaml/dist/compose/util-map-includes.js
-var require_util_map_includes = __commonJS({
- "../../node_modules/yaml/dist/compose/util-map-includes.js"(exports2) {
- "use strict";
- var identity = require_identity();
- function mapIncludes(ctx, items, search) {
- const { uniqueKeys } = ctx.options;
- if (uniqueKeys === false)
- return false;
- const isEqual = typeof uniqueKeys === "function" ? uniqueKeys : (a, b) => a === b || identity.isScalar(a) && identity.isScalar(b) && a.value === b.value;
- return items.some((pair) => isEqual(pair.key, search));
- }
- exports2.mapIncludes = mapIncludes;
- }
-});
-
-// ../../node_modules/yaml/dist/compose/resolve-block-map.js
-var require_resolve_block_map = __commonJS({
- "../../node_modules/yaml/dist/compose/resolve-block-map.js"(exports2) {
- "use strict";
- var Pair = require_Pair();
- var YAMLMap = require_YAMLMap();
- var resolveProps = require_resolve_props();
- var utilContainsNewline = require_util_contains_newline();
- var utilFlowIndentCheck = require_util_flow_indent_check();
- var utilMapIncludes = require_util_map_includes();
- var startColMsg = "All mapping items must start at the same column";
- function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, tag) {
- const NodeClass = tag?.nodeClass ?? YAMLMap.YAMLMap;
- const map = new NodeClass(ctx.schema);
- if (ctx.atRoot)
- ctx.atRoot = false;
- let offset = bm.offset;
- let commentEnd = null;
- for (const collItem of bm.items) {
- const { start, key, sep, value } = collItem;
- const keyProps = resolveProps.resolveProps(start, {
- indicator: "explicit-key-ind",
- next: key ?? sep?.[0],
- offset,
- onError,
- parentIndent: bm.indent,
- startOnNewline: true
- });
- const implicitKey = !keyProps.found;
- if (implicitKey) {
- if (key) {
- if (key.type === "block-seq")
- onError(offset, "BLOCK_AS_IMPLICIT_KEY", "A block sequence may not be used as an implicit map key");
- else if ("indent" in key && key.indent !== bm.indent)
- onError(offset, "BAD_INDENT", startColMsg);
- }
- if (!keyProps.anchor && !keyProps.tag && !sep) {
- commentEnd = keyProps.end;
- if (keyProps.comment) {
- if (map.comment)
- map.comment += "\n" + keyProps.comment;
- else
- map.comment = keyProps.comment;
- }
- continue;
- }
- if (keyProps.newlineAfterProp || utilContainsNewline.containsNewline(key)) {
- onError(key ?? start[start.length - 1], "MULTILINE_IMPLICIT_KEY", "Implicit keys need to be on a single line");
- }
- } else if (keyProps.found?.indent !== bm.indent) {
- onError(offset, "BAD_INDENT", startColMsg);
- }
- ctx.atKey = true;
- const keyStart = keyProps.end;
- const keyNode = key ? composeNode(ctx, key, keyProps, onError) : composeEmptyNode(ctx, keyStart, start, null, keyProps, onError);
- if (ctx.schema.compat)
- utilFlowIndentCheck.flowIndentCheck(bm.indent, key, onError);
- ctx.atKey = false;
- if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
- onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
- const valueProps = resolveProps.resolveProps(sep ?? [], {
- indicator: "map-value-ind",
- next: value,
- offset: keyNode.range[2],
- onError,
- parentIndent: bm.indent,
- startOnNewline: !key || key.type === "block-scalar"
- });
- offset = valueProps.end;
- if (valueProps.found) {
- if (implicitKey) {
- if (value?.type === "block-map" && !valueProps.hasNewline)
- onError(offset, "BLOCK_AS_IMPLICIT_KEY", "Nested mappings are not allowed in compact mappings");
- if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
- onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
- }
- const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep, null, valueProps, onError);
- if (ctx.schema.compat)
- utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
- offset = valueNode.range[2];
- const pair = new Pair.Pair(keyNode, valueNode);
- if (ctx.options.keepSourceTokens)
- pair.srcToken = collItem;
- map.items.push(pair);
- } else {
- if (implicitKey)
- onError(keyNode.range, "MISSING_CHAR", "Implicit map keys need to be followed by map values");
- if (valueProps.comment) {
- if (keyNode.comment)
- keyNode.comment += "\n" + valueProps.comment;
- else
- keyNode.comment = valueProps.comment;
- }
- const pair = new Pair.Pair(keyNode);
- if (ctx.options.keepSourceTokens)
- pair.srcToken = collItem;
- map.items.push(pair);
- }
- }
- if (commentEnd && commentEnd < offset)
- onError(commentEnd, "IMPOSSIBLE", "Map comment with trailing content");
- map.range = [bm.offset, offset, commentEnd ?? offset];
- return map;
- }
- exports2.resolveBlockMap = resolveBlockMap;
- }
-});
-
-// ../../node_modules/yaml/dist/compose/resolve-block-seq.js
-var require_resolve_block_seq = __commonJS({
- "../../node_modules/yaml/dist/compose/resolve-block-seq.js"(exports2) {
- "use strict";
- var YAMLSeq = require_YAMLSeq();
- var resolveProps = require_resolve_props();
- var utilFlowIndentCheck = require_util_flow_indent_check();
- function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError, tag) {
- const NodeClass = tag?.nodeClass ?? YAMLSeq.YAMLSeq;
- const seq = new NodeClass(ctx.schema);
- if (ctx.atRoot)
- ctx.atRoot = false;
- if (ctx.atKey)
- ctx.atKey = false;
- let offset = bs.offset;
- let commentEnd = null;
- for (const { start, value } of bs.items) {
- const props = resolveProps.resolveProps(start, {
- indicator: "seq-item-ind",
- next: value,
- offset,
- onError,
- parentIndent: bs.indent,
- startOnNewline: true
- });
- if (!props.found) {
- if (props.anchor || props.tag || value) {
- if (value && value.type === "block-seq")
- onError(props.end, "BAD_INDENT", "All sequence items must start at the same column");
- else
- onError(offset, "MISSING_CHAR", "Sequence item without - indicator");
- } else {
- commentEnd = props.end;
- if (props.comment)
- seq.comment = props.comment;
- continue;
- }
- }
- const node = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, start, null, props, onError);
- if (ctx.schema.compat)
- utilFlowIndentCheck.flowIndentCheck(bs.indent, value, onError);
- offset = node.range[2];
- seq.items.push(node);
- }
- seq.range = [bs.offset, offset, commentEnd ?? offset];
- return seq;
- }
- exports2.resolveBlockSeq = resolveBlockSeq;
- }
-});
-
-// ../../node_modules/yaml/dist/compose/resolve-end.js
-var require_resolve_end = __commonJS({
- "../../node_modules/yaml/dist/compose/resolve-end.js"(exports2) {
- "use strict";
- function resolveEnd(end, offset, reqSpace, onError) {
- let comment = "";
- if (end) {
- let hasSpace = false;
- let sep = "";
- for (const token of end) {
- const { source, type } = token;
- switch (type) {
- case "space":
- hasSpace = true;
- break;
- case "comment": {
- if (reqSpace && !hasSpace)
- onError(token, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
- const cb = source.substring(1) || " ";
- if (!comment)
- comment = cb;
- else
- comment += sep + cb;
- sep = "";
- break;
- }
- case "newline":
- if (comment)
- sep += source;
- hasSpace = true;
- break;
- default:
- onError(token, "UNEXPECTED_TOKEN", `Unexpected ${type} at node end`);
- }
- offset += source.length;
- }
- }
- return { comment, offset };
- }
- exports2.resolveEnd = resolveEnd;
- }
-});
-
-// ../../node_modules/yaml/dist/compose/resolve-flow-collection.js
-var require_resolve_flow_collection = __commonJS({
- "../../node_modules/yaml/dist/compose/resolve-flow-collection.js"(exports2) {
- "use strict";
- var identity = require_identity();
- var Pair = require_Pair();
- var YAMLMap = require_YAMLMap();
- var YAMLSeq = require_YAMLSeq();
- var resolveEnd = require_resolve_end();
- var resolveProps = require_resolve_props();
- var utilContainsNewline = require_util_contains_newline();
- var utilMapIncludes = require_util_map_includes();
- var blockMsg = "Block collections are not allowed within flow collections";
- var isBlock = (token) => token && (token.type === "block-map" || token.type === "block-seq");
- function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onError, tag) {
- const isMap = fc.start.source === "{";
- const fcName = isMap ? "flow map" : "flow sequence";
- const NodeClass = tag?.nodeClass ?? (isMap ? YAMLMap.YAMLMap : YAMLSeq.YAMLSeq);
- const coll = new NodeClass(ctx.schema);
- coll.flow = true;
- const atRoot = ctx.atRoot;
- if (atRoot)
- ctx.atRoot = false;
- if (ctx.atKey)
- ctx.atKey = false;
- let offset = fc.offset + fc.start.source.length;
- for (let i = 0; i < fc.items.length; ++i) {
- const collItem = fc.items[i];
- const { start, key, sep, value } = collItem;
- const props = resolveProps.resolveProps(start, {
- flow: fcName,
- indicator: "explicit-key-ind",
- next: key ?? sep?.[0],
- offset,
- onError,
- parentIndent: fc.indent,
- startOnNewline: false
- });
- if (!props.found) {
- if (!props.anchor && !props.tag && !sep && !value) {
- if (i === 0 && props.comma)
- onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
- else if (i < fc.items.length - 1)
- onError(props.start, "UNEXPECTED_TOKEN", `Unexpected empty item in ${fcName}`);
- if (props.comment) {
- if (coll.comment)
- coll.comment += "\n" + props.comment;
- else
- coll.comment = props.comment;
- }
- offset = props.end;
- continue;
- }
- if (!isMap && ctx.options.strict && utilContainsNewline.containsNewline(key))
- onError(
- key,
- // checked by containsNewline()
- "MULTILINE_IMPLICIT_KEY",
- "Implicit keys of flow sequence pairs need to be on a single line"
- );
- }
- if (i === 0) {
- if (props.comma)
- onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
- } else {
- if (!props.comma)
- onError(props.start, "MISSING_CHAR", `Missing , between ${fcName} items`);
- if (props.comment) {
- let prevItemComment = "";
- loop: for (const st of start) {
- switch (st.type) {
- case "comma":
- case "space":
- break;
- case "comment":
- prevItemComment = st.source.substring(1);
- break loop;
- default:
- break loop;
- }
- }
- if (prevItemComment) {
- let prev = coll.items[coll.items.length - 1];
- if (identity.isPair(prev))
- prev = prev.value ?? prev.key;
- if (prev.comment)
- prev.comment += "\n" + prevItemComment;
- else
- prev.comment = prevItemComment;
- props.comment = props.comment.substring(prevItemComment.length + 1);
- }
- }
- }
- if (!isMap && !sep && !props.found) {
- const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep, null, props, onError);
- coll.items.push(valueNode);
- offset = valueNode.range[2];
- if (isBlock(value))
- onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
- } else {
- ctx.atKey = true;
- const keyStart = props.end;
- const keyNode = key ? composeNode(ctx, key, props, onError) : composeEmptyNode(ctx, keyStart, start, null, props, onError);
- if (isBlock(key))
- onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
- ctx.atKey = false;
- const valueProps = resolveProps.resolveProps(sep ?? [], {
- flow: fcName,
- indicator: "map-value-ind",
- next: value,
- offset: keyNode.range[2],
- onError,
- parentIndent: fc.indent,
- startOnNewline: false
- });
- if (valueProps.found) {
- if (!isMap && !props.found && ctx.options.strict) {
- if (sep)
- for (const st of sep) {
- if (st === valueProps.found)
- break;
- if (st.type === "newline") {
- onError(st, "MULTILINE_IMPLICIT_KEY", "Implicit keys of flow sequence pairs need to be on a single line");
- break;
- }
- }
- if (props.start < valueProps.found.offset - 1024)
- onError(valueProps.found, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit flow sequence key");
- }
- } else if (value) {
- if ("source" in value && value.source && value.source[0] === ":")
- onError(value, "MISSING_CHAR", `Missing space after : in ${fcName}`);
- else
- onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
- }
- const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep, null, valueProps, onError) : null;
- if (valueNode) {
- if (isBlock(value))
- onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
- } else if (valueProps.comment) {
- if (keyNode.comment)
- keyNode.comment += "\n" + valueProps.comment;
- else
- keyNode.comment = valueProps.comment;
- }
- const pair = new Pair.Pair(keyNode, valueNode);
- if (ctx.options.keepSourceTokens)
- pair.srcToken = collItem;
- if (isMap) {
- const map = coll;
- if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
- onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
- map.items.push(pair);
- } else {
- const map = new YAMLMap.YAMLMap(ctx.schema);
- map.flow = true;
- map.items.push(pair);
- const endRange = (valueNode ?? keyNode).range;
- map.range = [keyNode.range[0], endRange[1], endRange[2]];
- coll.items.push(map);
- }
- offset = valueNode ? valueNode.range[2] : valueProps.end;
- }
- }
- const expectedEnd = isMap ? "}" : "]";
- const [ce, ...ee] = fc.end;
- let cePos = offset;
- if (ce && ce.source === expectedEnd)
- cePos = ce.offset + ce.source.length;
- else {
- const name = fcName[0].toUpperCase() + fcName.substring(1);
- const msg = atRoot ? `${name} must end with a ${expectedEnd}` : `${name} in block collection must be sufficiently indented and end with a ${expectedEnd}`;
- onError(offset, atRoot ? "MISSING_CHAR" : "BAD_INDENT", msg);
- if (ce && ce.source.length !== 1)
- ee.unshift(ce);
- }
- if (ee.length > 0) {
- const end = resolveEnd.resolveEnd(ee, cePos, ctx.options.strict, onError);
- if (end.comment) {
- if (coll.comment)
- coll.comment += "\n" + end.comment;
- else
- coll.comment = end.comment;
- }
- coll.range = [fc.offset, cePos, end.offset];
- } else {
- coll.range = [fc.offset, cePos, cePos];
- }
- return coll;
- }
- exports2.resolveFlowCollection = resolveFlowCollection;
- }
-});
-
-// ../../node_modules/yaml/dist/compose/compose-collection.js
-var require_compose_collection = __commonJS({
- "../../node_modules/yaml/dist/compose/compose-collection.js"(exports2) {
- "use strict";
- var identity = require_identity();
- var Scalar = require_Scalar();
- var YAMLMap = require_YAMLMap();
- var YAMLSeq = require_YAMLSeq();
- var resolveBlockMap = require_resolve_block_map();
- var resolveBlockSeq = require_resolve_block_seq();
- var resolveFlowCollection = require_resolve_flow_collection();
- function resolveCollection(CN, ctx, token, onError, tagName, tag) {
- const coll = token.type === "block-map" ? resolveBlockMap.resolveBlockMap(CN, ctx, token, onError, tag) : token.type === "block-seq" ? resolveBlockSeq.resolveBlockSeq(CN, ctx, token, onError, tag) : resolveFlowCollection.resolveFlowCollection(CN, ctx, token, onError, tag);
- const Coll = coll.constructor;
- if (tagName === "!" || tagName === Coll.tagName) {
- coll.tag = Coll.tagName;
- return coll;
- }
- if (tagName)
- coll.tag = tagName;
- return coll;
- }
- function composeCollection(CN, ctx, token, props, onError) {
- const tagToken = props.tag;
- const tagName = !tagToken ? null : ctx.directives.tagName(tagToken.source, (msg) => onError(tagToken, "TAG_RESOLVE_FAILED", msg));
- if (token.type === "block-seq") {
- const { anchor, newlineAfterProp: nl } = props;
- const lastProp = anchor && tagToken ? anchor.offset > tagToken.offset ? anchor : tagToken : anchor ?? tagToken;
- if (lastProp && (!nl || nl.offset < lastProp.offset)) {
- const message = "Missing newline after block sequence props";
- onError(lastProp, "MISSING_CHAR", message);
- }
- }
- const expType = token.type === "block-map" ? "map" : token.type === "block-seq" ? "seq" : token.start.source === "{" ? "map" : "seq";
- if (!tagToken || !tagName || tagName === "!" || tagName === YAMLMap.YAMLMap.tagName && expType === "map" || tagName === YAMLSeq.YAMLSeq.tagName && expType === "seq") {
- return resolveCollection(CN, ctx, token, onError, tagName);
- }
- let tag = ctx.schema.tags.find((t) => t.tag === tagName && t.collection === expType);
- if (!tag) {
- const kt = ctx.schema.knownTags[tagName];
- if (kt && kt.collection === expType) {
- ctx.schema.tags.push(Object.assign({}, kt, { default: false }));
- tag = kt;
- } else {
- if (kt?.collection) {
- onError(tagToken, "BAD_COLLECTION_TYPE", `${kt.tag} used for ${expType} collection, but expects ${kt.collection}`, true);
- } else {
- onError(tagToken, "TAG_RESOLVE_FAILED", `Unresolved tag: ${tagName}`, true);
- }
- return resolveCollection(CN, ctx, token, onError, tagName);
- }
- }
- const coll = resolveCollection(CN, ctx, token, onError, tagName, tag);
- const res = tag.resolve?.(coll, (msg) => onError(tagToken, "TAG_RESOLVE_FAILED", msg), ctx.options) ?? coll;
- const node = identity.isNode(res) ? res : new Scalar.Scalar(res);
- node.range = coll.range;
- node.tag = tagName;
- if (tag?.format)
- node.format = tag.format;
- return node;
- }
- exports2.composeCollection = composeCollection;
- }
-});
-
-// ../../node_modules/yaml/dist/compose/resolve-block-scalar.js
-var require_resolve_block_scalar = __commonJS({
- "../../node_modules/yaml/dist/compose/resolve-block-scalar.js"(exports2) {
- "use strict";
- var Scalar = require_Scalar();
- function resolveBlockScalar(ctx, scalar, onError) {
- const start = scalar.offset;
- const header = parseBlockScalarHeader(scalar, ctx.options.strict, onError);
- if (!header)
- return { value: "", type: null, comment: "", range: [start, start, start] };
- const type = header.mode === ">" ? Scalar.Scalar.BLOCK_FOLDED : Scalar.Scalar.BLOCK_LITERAL;
- const lines = scalar.source ? splitLines(scalar.source) : [];
- let chompStart = lines.length;
- for (let i = lines.length - 1; i >= 0; --i) {
- const content = lines[i][1];
- if (content === "" || content === "\r")
- chompStart = i;
- else
- break;
- }
- if (chompStart === 0) {
- const value2 = header.chomp === "+" && lines.length > 0 ? "\n".repeat(Math.max(1, lines.length - 1)) : "";
- let end2 = start + header.length;
- if (scalar.source)
- end2 += scalar.source.length;
- return { value: value2, type, comment: header.comment, range: [start, end2, end2] };
- }
- let trimIndent = scalar.indent + header.indent;
- let offset = scalar.offset + header.length;
- let contentStart = 0;
- for (let i = 0; i < chompStart; ++i) {
- const [indent, content] = lines[i];
- if (content === "" || content === "\r") {
- if (header.indent === 0 && indent.length > trimIndent)
- trimIndent = indent.length;
- } else {
- if (indent.length < trimIndent) {
- const message = "Block scalars with more-indented leading empty lines must use an explicit indentation indicator";
- onError(offset + indent.length, "MISSING_CHAR", message);
- }
- if (header.indent === 0)
- trimIndent = indent.length;
- contentStart = i;
- if (trimIndent === 0 && !ctx.atRoot) {
- const message = "Block scalar values in collections must be indented";
- onError(offset, "BAD_INDENT", message);
- }
- break;
- }
- offset += indent.length + content.length + 1;
- }
- for (let i = lines.length - 1; i >= chompStart; --i) {
- if (lines[i][0].length > trimIndent)
- chompStart = i + 1;
- }
- let value = "";
- let sep = "";
- let prevMoreIndented = false;
- for (let i = 0; i < contentStart; ++i)
- value += lines[i][0].slice(trimIndent) + "\n";
- for (let i = contentStart; i < chompStart; ++i) {
- let [indent, content] = lines[i];
- offset += indent.length + content.length + 1;
- const crlf = content[content.length - 1] === "\r";
- if (crlf)
- content = content.slice(0, -1);
- if (content && indent.length < trimIndent) {
- const src = header.indent ? "explicit indentation indicator" : "first line";
- const message = `Block scalar lines must not be less indented than their ${src}`;
- onError(offset - content.length - (crlf ? 2 : 1), "BAD_INDENT", message);
- indent = "";
- }
- if (type === Scalar.Scalar.BLOCK_LITERAL) {
- value += sep + indent.slice(trimIndent) + content;
- sep = "\n";
- } else if (indent.length > trimIndent || content[0] === " ") {
- if (sep === " ")
- sep = "\n";
- else if (!prevMoreIndented && sep === "\n")
- sep = "\n\n";
- value += sep + indent.slice(trimIndent) + content;
- sep = "\n";
- prevMoreIndented = true;
- } else if (content === "") {
- if (sep === "\n")
- value += "\n";
- else
- sep = "\n";
- } else {
- value += sep + content;
- sep = " ";
- prevMoreIndented = false;
- }
- }
- switch (header.chomp) {
- case "-":
- break;
- case "+":
- for (let i = chompStart; i < lines.length; ++i)
- value += "\n" + lines[i][0].slice(trimIndent);
- if (value[value.length - 1] !== "\n")
- value += "\n";
- break;
- default:
- value += "\n";
- }
- const end = start + header.length + scalar.source.length;
- return { value, type, comment: header.comment, range: [start, end, end] };
- }
- function parseBlockScalarHeader({ offset, props }, strict, onError) {
- if (props[0].type !== "block-scalar-header") {
- onError(props[0], "IMPOSSIBLE", "Block scalar header not found");
- return null;
- }
- const { source } = props[0];
- const mode = source[0];
- let indent = 0;
- let chomp = "";
- let error = -1;
- for (let i = 1; i < source.length; ++i) {
- const ch = source[i];
- if (!chomp && (ch === "-" || ch === "+"))
- chomp = ch;
- else {
- const n = Number(ch);
- if (!indent && n)
- indent = n;
- else if (error === -1)
- error = offset + i;
- }
- }
- if (error !== -1)
- onError(error, "UNEXPECTED_TOKEN", `Block scalar header includes extra characters: ${source}`);
- let hasSpace = false;
- let comment = "";
- let length = source.length;
- for (let i = 1; i < props.length; ++i) {
- const token = props[i];
- switch (token.type) {
- case "space":
- hasSpace = true;
- case "newline":
- length += token.source.length;
- break;
- case "comment":
- if (strict && !hasSpace) {
- const message = "Comments must be separated from other tokens by white space characters";
- onError(token, "MISSING_CHAR", message);
- }
- length += token.source.length;
- comment = token.source.substring(1);
- break;
- case "error":
- onError(token, "UNEXPECTED_TOKEN", token.message);
- length += token.source.length;
- break;
- default: {
- const message = `Unexpected token in block scalar header: ${token.type}`;
- onError(token, "UNEXPECTED_TOKEN", message);
- const ts = token.source;
- if (ts && typeof ts === "string")
- length += ts.length;
- }
- }
- }
- return { mode, indent, chomp, comment, length };
- }
- function splitLines(source) {
- const split = source.split(/\n( *)/);
- const first = split[0];
- const m = first.match(/^( *)/);
- const line0 = m?.[1] ? [m[1], first.slice(m[1].length)] : ["", first];
- const lines = [line0];
- for (let i = 1; i < split.length; i += 2)
- lines.push([split[i], split[i + 1]]);
- return lines;
- }
- exports2.resolveBlockScalar = resolveBlockScalar;
- }
-});
-
-// ../../node_modules/yaml/dist/compose/resolve-flow-scalar.js
-var require_resolve_flow_scalar = __commonJS({
- "../../node_modules/yaml/dist/compose/resolve-flow-scalar.js"(exports2) {
- "use strict";
- var Scalar = require_Scalar();
- var resolveEnd = require_resolve_end();
- function resolveFlowScalar(scalar, strict, onError) {
- const { offset, type, source, end } = scalar;
- let _type;
- let value;
- const _onError = (rel, code, msg) => onError(offset + rel, code, msg);
- switch (type) {
- case "scalar":
- _type = Scalar.Scalar.PLAIN;
- value = plainValue(source, _onError);
- break;
- case "single-quoted-scalar":
- _type = Scalar.Scalar.QUOTE_SINGLE;
- value = singleQuotedValue(source, _onError);
- break;
- case "double-quoted-scalar":
- _type = Scalar.Scalar.QUOTE_DOUBLE;
- value = doubleQuotedValue(source, _onError);
- break;
- default:
- onError(scalar, "UNEXPECTED_TOKEN", `Expected a flow scalar value, but found: ${type}`);
- return {
- value: "",
- type: null,
- comment: "",
- range: [offset, offset + source.length, offset + source.length]
- };
- }
- const valueEnd = offset + source.length;
- const re = resolveEnd.resolveEnd(end, valueEnd, strict, onError);
- return {
- value,
- type: _type,
- comment: re.comment,
- range: [offset, valueEnd, re.offset]
- };
- }
- function plainValue(source, onError) {
- let badChar = "";
- switch (source[0]) {
- case " ":
- badChar = "a tab character";
- break;
- case ",":
- badChar = "flow indicator character ,";
- break;
- case "%":
- badChar = "directive indicator character %";
- break;
- case "|":
- case ">": {
- badChar = `block scalar indicator ${source[0]}`;
- break;
- }
- case "@":
- case "`": {
- badChar = `reserved character ${source[0]}`;
- break;
- }
- }
- if (badChar)
- onError(0, "BAD_SCALAR_START", `Plain value cannot start with ${badChar}`);
- return foldLines(source);
- }
- function singleQuotedValue(source, onError) {
- if (source[source.length - 1] !== "'" || source.length === 1)
- onError(source.length, "MISSING_CHAR", "Missing closing 'quote");
- return foldLines(source.slice(1, -1)).replace(/''/g, "'");
- }
- function foldLines(source) {
- let first, line;
- try {
- first = new RegExp("(.*?)(? wsStart ? source.slice(wsStart, i + 1) : ch;
- } else {
- res += ch;
- }
- }
- if (source[source.length - 1] !== '"' || source.length === 1)
- onError(source.length, "MISSING_CHAR", 'Missing closing "quote');
- return res;
- }
- function foldNewline(source, offset) {
- let fold = "";
- let ch = source[offset + 1];
- while (ch === " " || ch === " " || ch === "\n" || ch === "\r") {
- if (ch === "\r" && source[offset + 2] !== "\n")
- break;
- if (ch === "\n")
- fold += "\n";
- offset += 1;
- ch = source[offset + 1];
- }
- if (!fold)
- fold = " ";
- return { fold, offset };
- }
- var escapeCodes = {
- "0": "\0",
- // null character
- a: "\x07",
- // bell character
- b: "\b",
- // backspace
- e: "\x1B",
- // escape character
- f: "\f",
- // form feed
- n: "\n",
- // line feed
- r: "\r",
- // carriage return
- t: " ",
- // horizontal tab
- v: "\v",
- // vertical tab
- N: "\x85",
- // Unicode next line
- _: "\xA0",
- // Unicode non-breaking space
- L: "\u2028",
- // Unicode line separator
- P: "\u2029",
- // Unicode paragraph separator
- " ": " ",
- '"': '"',
- "/": "/",
- "\\": "\\",
- " ": " "
- };
- function parseCharCode(source, offset, length, onError) {
- const cc = source.substr(offset, length);
- const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
- const code = ok ? parseInt(cc, 16) : NaN;
- if (isNaN(code)) {
- const raw = source.substr(offset - 2, length + 2);
- onError(offset - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${raw}`);
- return raw;
- }
- return String.fromCodePoint(code);
- }
- exports2.resolveFlowScalar = resolveFlowScalar;
- }
-});
-
-// ../../node_modules/yaml/dist/compose/compose-scalar.js
-var require_compose_scalar = __commonJS({
- "../../node_modules/yaml/dist/compose/compose-scalar.js"(exports2) {
- "use strict";
- var identity = require_identity();
- var Scalar = require_Scalar();
- var resolveBlockScalar = require_resolve_block_scalar();
- var resolveFlowScalar = require_resolve_flow_scalar();
- function composeScalar(ctx, token, tagToken, onError) {
- const { value, type, comment, range } = token.type === "block-scalar" ? resolveBlockScalar.resolveBlockScalar(ctx, token, onError) : resolveFlowScalar.resolveFlowScalar(token, ctx.options.strict, onError);
- const tagName = tagToken ? ctx.directives.tagName(tagToken.source, (msg) => onError(tagToken, "TAG_RESOLVE_FAILED", msg)) : null;
- let tag;
- if (ctx.options.stringKeys && ctx.atKey) {
- tag = ctx.schema[identity.SCALAR];
- } else if (tagName)
- tag = findScalarTagByName(ctx.schema, value, tagName, tagToken, onError);
- else if (token.type === "scalar")
- tag = findScalarTagByTest(ctx, value, token, onError);
- else
- tag = ctx.schema[identity.SCALAR];
- let scalar;
- try {
- const res = tag.resolve(value, (msg) => onError(tagToken ?? token, "TAG_RESOLVE_FAILED", msg), ctx.options);
- scalar = identity.isScalar(res) ? res : new Scalar.Scalar(res);
- } catch (error) {
- const msg = error instanceof Error ? error.message : String(error);
- onError(tagToken ?? token, "TAG_RESOLVE_FAILED", msg);
- scalar = new Scalar.Scalar(value);
- }
- scalar.range = range;
- scalar.source = value;
- if (type)
- scalar.type = type;
- if (tagName)
- scalar.tag = tagName;
- if (tag.format)
- scalar.format = tag.format;
- if (comment)
- scalar.comment = comment;
- return scalar;
- }
- function findScalarTagByName(schema, value, tagName, tagToken, onError) {
- if (tagName === "!")
- return schema[identity.SCALAR];
- const matchWithTest = [];
- for (const tag of schema.tags) {
- if (!tag.collection && tag.tag === tagName) {
- if (tag.default && tag.test)
- matchWithTest.push(tag);
- else
- return tag;
- }
- }
- for (const tag of matchWithTest)
- if (tag.test?.test(value))
- return tag;
- const kt = schema.knownTags[tagName];
- if (kt && !kt.collection) {
- schema.tags.push(Object.assign({}, kt, { default: false, test: void 0 }));
- return kt;
- }
- onError(tagToken, "TAG_RESOLVE_FAILED", `Unresolved tag: ${tagName}`, tagName !== "tag:yaml.org,2002:str");
- return schema[identity.SCALAR];
- }
- function findScalarTagByTest({ atKey, directives, schema }, value, token, onError) {
- const tag = schema.tags.find((tag2) => (tag2.default === true || atKey && tag2.default === "key") && tag2.test?.test(value)) || schema[identity.SCALAR];
- if (schema.compat) {
- const compat = schema.compat.find((tag2) => tag2.default && tag2.test?.test(value)) ?? schema[identity.SCALAR];
- if (tag.tag !== compat.tag) {
- const ts = directives.tagString(tag.tag);
- const cs = directives.tagString(compat.tag);
- const msg = `Value may be parsed as either ${ts} or ${cs}`;
- onError(token, "TAG_RESOLVE_FAILED", msg, true);
- }
- }
- return tag;
- }
- exports2.composeScalar = composeScalar;
- }
-});
-
-// ../../node_modules/yaml/dist/compose/util-empty-scalar-position.js
-var require_util_empty_scalar_position = __commonJS({
- "../../node_modules/yaml/dist/compose/util-empty-scalar-position.js"(exports2) {
- "use strict";
- function emptyScalarPosition(offset, before, pos) {
- if (before) {
- if (pos === null)
- pos = before.length;
- for (let i = pos - 1; i >= 0; --i) {
- let st = before[i];
- switch (st.type) {
- case "space":
- case "comment":
- case "newline":
- offset -= st.source.length;
- continue;
- }
- st = before[++i];
- while (st?.type === "space") {
- offset += st.source.length;
- st = before[++i];
- }
- break;
- }
- }
- return offset;
- }
- exports2.emptyScalarPosition = emptyScalarPosition;
- }
-});
-
-// ../../node_modules/yaml/dist/compose/compose-node.js
-var require_compose_node = __commonJS({
- "../../node_modules/yaml/dist/compose/compose-node.js"(exports2) {
- "use strict";
- var Alias = require_Alias();
- var identity = require_identity();
- var composeCollection = require_compose_collection();
- var composeScalar = require_compose_scalar();
- var resolveEnd = require_resolve_end();
- var utilEmptyScalarPosition = require_util_empty_scalar_position();
- var CN = { composeNode, composeEmptyNode };
- function composeNode(ctx, token, props, onError) {
- const atKey = ctx.atKey;
- const { spaceBefore, comment, anchor, tag } = props;
- let node;
- let isSrcToken = true;
- switch (token.type) {
- case "alias":
- node = composeAlias(ctx, token, onError);
- if (anchor || tag)
- onError(token, "ALIAS_PROPS", "An alias node must not specify any properties");
- break;
- case "scalar":
- case "single-quoted-scalar":
- case "double-quoted-scalar":
- case "block-scalar":
- node = composeScalar.composeScalar(ctx, token, tag, onError);
- if (anchor)
- node.anchor = anchor.source.substring(1);
- break;
- case "block-map":
- case "block-seq":
- case "flow-collection":
- node = composeCollection.composeCollection(CN, ctx, token, props, onError);
- if (anchor)
- node.anchor = anchor.source.substring(1);
- break;
- default: {
- const message = token.type === "error" ? token.message : `Unsupported token (type: ${token.type})`;
- onError(token, "UNEXPECTED_TOKEN", message);
- node = composeEmptyNode(ctx, token.offset, void 0, null, props, onError);
- isSrcToken = false;
- }
- }
- if (anchor && node.anchor === "")
- onError(anchor, "BAD_ALIAS", "Anchor cannot be an empty string");
- if (atKey && ctx.options.stringKeys && (!identity.isScalar(node) || typeof node.value !== "string" || node.tag && node.tag !== "tag:yaml.org,2002:str")) {
- const msg = "With stringKeys, all keys must be strings";
- onError(tag ?? token, "NON_STRING_KEY", msg);
- }
- if (spaceBefore)
- node.spaceBefore = true;
- if (comment) {
- if (token.type === "scalar" && token.source === "")
- node.comment = comment;
- else
- node.commentBefore = comment;
- }
- if (ctx.options.keepSourceTokens && isSrcToken)
- node.srcToken = token;
- return node;
- }
- function composeEmptyNode(ctx, offset, before, pos, { spaceBefore, comment, anchor, tag, end }, onError) {
- const token = {
- type: "scalar",
- offset: utilEmptyScalarPosition.emptyScalarPosition(offset, before, pos),
- indent: -1,
- source: ""
- };
- const node = composeScalar.composeScalar(ctx, token, tag, onError);
- if (anchor) {
- node.anchor = anchor.source.substring(1);
- if (node.anchor === "")
- onError(anchor, "BAD_ALIAS", "Anchor cannot be an empty string");
- }
- if (spaceBefore)
- node.spaceBefore = true;
- if (comment) {
- node.comment = comment;
- node.range[2] = end;
- }
- return node;
- }
- function composeAlias({ options }, { offset, source, end }, onError) {
- const alias = new Alias.Alias(source.substring(1));
- if (alias.source === "")
- onError(offset, "BAD_ALIAS", "Alias cannot be an empty string");
- if (alias.source.endsWith(":"))
- onError(offset + source.length - 1, "BAD_ALIAS", "Alias ending in : is ambiguous", true);
- const valueEnd = offset + source.length;
- const re = resolveEnd.resolveEnd(end, valueEnd, options.strict, onError);
- alias.range = [offset, valueEnd, re.offset];
- if (re.comment)
- alias.comment = re.comment;
- return alias;
- }
- exports2.composeEmptyNode = composeEmptyNode;
- exports2.composeNode = composeNode;
- }
-});
-
-// ../../node_modules/yaml/dist/compose/compose-doc.js
-var require_compose_doc = __commonJS({
- "../../node_modules/yaml/dist/compose/compose-doc.js"(exports2) {
- "use strict";
- var Document = require_Document();
- var composeNode = require_compose_node();
- var resolveEnd = require_resolve_end();
- var resolveProps = require_resolve_props();
- function composeDoc(options, directives, { offset, start, value, end }, onError) {
- const opts = Object.assign({ _directives: directives }, options);
- const doc = new Document.Document(void 0, opts);
- const ctx = {
- atKey: false,
- atRoot: true,
- directives: doc.directives,
- options: doc.options,
- schema: doc.schema
- };
- const props = resolveProps.resolveProps(start, {
- indicator: "doc-start",
- next: value ?? end?.[0],
- offset,
- onError,
- parentIndent: 0,
- startOnNewline: true
- });
- if (props.found) {
- doc.directives.docStart = true;
- if (value && (value.type === "block-map" || value.type === "block-seq") && !props.hasNewline)
- onError(props.end, "MISSING_CHAR", "Block collection cannot start on same line with directives-end marker");
- }
- doc.contents = value ? composeNode.composeNode(ctx, value, props, onError) : composeNode.composeEmptyNode(ctx, props.end, start, null, props, onError);
- const contentEnd = doc.contents.range[2];
- const re = resolveEnd.resolveEnd(end, contentEnd, false, onError);
- if (re.comment)
- doc.comment = re.comment;
- doc.range = [offset, contentEnd, re.offset];
- return doc;
- }
- exports2.composeDoc = composeDoc;
- }
-});
-
-// ../../node_modules/yaml/dist/compose/composer.js
-var require_composer = __commonJS({
- "../../node_modules/yaml/dist/compose/composer.js"(exports2) {
- "use strict";
- var node_process = require("node:process");
- var directives = require_directives();
- var Document = require_Document();
- var errors = require_errors();
- var identity = require_identity();
- var composeDoc = require_compose_doc();
- var resolveEnd = require_resolve_end();
- function getErrorPos(src) {
- if (typeof src === "number")
- return [src, src + 1];
- if (Array.isArray(src))
- return src.length === 2 ? src : [src[0], src[1]];
- const { offset, source } = src;
- return [offset, offset + (typeof source === "string" ? source.length : 1)];
- }
- function parsePrelude(prelude) {
- let comment = "";
- let atComment = false;
- let afterEmptyLine = false;
- for (let i = 0; i < prelude.length; ++i) {
- const source = prelude[i];
- switch (source[0]) {
- case "#":
- comment += (comment === "" ? "" : afterEmptyLine ? "\n\n" : "\n") + (source.substring(1) || " ");
- atComment = true;
- afterEmptyLine = false;
- break;
- case "%":
- if (prelude[i + 1]?.[0] !== "#")
- i += 1;
- atComment = false;
- break;
- default:
- if (!atComment)
- afterEmptyLine = true;
- atComment = false;
- }
- }
- return { comment, afterEmptyLine };
- }
- var Composer = class {
- constructor(options = {}) {
- this.doc = null;
- this.atDirectives = false;
- this.prelude = [];
- this.errors = [];
- this.warnings = [];
- this.onError = (source, code, message, warning) => {
- const pos = getErrorPos(source);
- if (warning)
- this.warnings.push(new errors.YAMLWarning(pos, code, message));
- else
- this.errors.push(new errors.YAMLParseError(pos, code, message));
- };
- this.directives = new directives.Directives({ version: options.version || "1.2" });
- this.options = options;
- }
- decorate(doc, afterDoc) {
- const { comment, afterEmptyLine } = parsePrelude(this.prelude);
- if (comment) {
- const dc = doc.contents;
- if (afterDoc) {
- doc.comment = doc.comment ? `${doc.comment}
-${comment}` : comment;
- } else if (afterEmptyLine || doc.directives.docStart || !dc) {
- doc.commentBefore = comment;
- } else if (identity.isCollection(dc) && !dc.flow && dc.items.length > 0) {
- let it = dc.items[0];
- if (identity.isPair(it))
- it = it.key;
- const cb = it.commentBefore;
- it.commentBefore = cb ? `${comment}
-${cb}` : comment;
- } else {
- const cb = dc.commentBefore;
- dc.commentBefore = cb ? `${comment}
-${cb}` : comment;
- }
- }
- if (afterDoc) {
- Array.prototype.push.apply(doc.errors, this.errors);
- Array.prototype.push.apply(doc.warnings, this.warnings);
- } else {
- doc.errors = this.errors;
- doc.warnings = this.warnings;
- }
- this.prelude = [];
- this.errors = [];
- this.warnings = [];
- }
- /**
- * Current stream status information.
- *
- * Mostly useful at the end of input for an empty stream.
- */
- streamInfo() {
- return {
- comment: parsePrelude(this.prelude).comment,
- directives: this.directives,
- errors: this.errors,
- warnings: this.warnings
- };
- }
- /**
- * Compose tokens into documents.
- *
- * @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.
- * @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.
- */
- *compose(tokens, forceDoc = false, endOffset = -1) {
- for (const token of tokens)
- yield* this.next(token);
- yield* this.end(forceDoc, endOffset);
- }
- /** Advance the composer by one CST token. */
- *next(token) {
- if (node_process.env.LOG_STREAM)
- console.dir(token, { depth: null });
- switch (token.type) {
- case "directive":
- this.directives.add(token.source, (offset, message, warning) => {
- const pos = getErrorPos(token);
- pos[0] += offset;
- this.onError(pos, "BAD_DIRECTIVE", message, warning);
- });
- this.prelude.push(token.source);
- this.atDirectives = true;
- break;
- case "document": {
- const doc = composeDoc.composeDoc(this.options, this.directives, token, this.onError);
- if (this.atDirectives && !doc.directives.docStart)
- this.onError(token, "MISSING_CHAR", "Missing directives-end/doc-start indicator line");
- this.decorate(doc, false);
- if (this.doc)
- yield this.doc;
- this.doc = doc;
- this.atDirectives = false;
- break;
- }
- case "byte-order-mark":
- case "space":
- break;
- case "comment":
- case "newline":
- this.prelude.push(token.source);
- break;
- case "error": {
- const msg = token.source ? `${token.message}: ${JSON.stringify(token.source)}` : token.message;
- const error = new errors.YAMLParseError(getErrorPos(token), "UNEXPECTED_TOKEN", msg);
- if (this.atDirectives || !this.doc)
- this.errors.push(error);
- else
- this.doc.errors.push(error);
- break;
- }
- case "doc-end": {
- if (!this.doc) {
- const msg = "Unexpected doc-end without preceding document";
- this.errors.push(new errors.YAMLParseError(getErrorPos(token), "UNEXPECTED_TOKEN", msg));
- break;
- }
- this.doc.directives.docEnd = true;
- const end = resolveEnd.resolveEnd(token.end, token.offset + token.source.length, this.doc.options.strict, this.onError);
- this.decorate(this.doc, true);
- if (end.comment) {
- const dc = this.doc.comment;
- this.doc.comment = dc ? `${dc}
-${end.comment}` : end.comment;
- }
- this.doc.range[2] = end.offset;
- break;
- }
- default:
- this.errors.push(new errors.YAMLParseError(getErrorPos(token), "UNEXPECTED_TOKEN", `Unsupported token ${token.type}`));
- }
- }
- /**
- * Call at end of input to yield any remaining document.
- *
- * @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.
- * @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.
- */
- *end(forceDoc = false, endOffset = -1) {
- if (this.doc) {
- this.decorate(this.doc, true);
- yield this.doc;
- this.doc = null;
- } else if (forceDoc) {
- const opts = Object.assign({ _directives: this.directives }, this.options);
- const doc = new Document.Document(void 0, opts);
- if (this.atDirectives)
- this.onError(endOffset, "MISSING_CHAR", "Missing directives-end indicator line");
- doc.range = [0, endOffset, endOffset];
- this.decorate(doc, false);
- yield doc;
- }
- }
- };
- exports2.Composer = Composer;
- }
-});
-
-// ../../node_modules/yaml/dist/parse/cst-scalar.js
-var require_cst_scalar = __commonJS({
- "../../node_modules/yaml/dist/parse/cst-scalar.js"(exports2) {
- "use strict";
- var resolveBlockScalar = require_resolve_block_scalar();
- var resolveFlowScalar = require_resolve_flow_scalar();
- var errors = require_errors();
- var stringifyString = require_stringifyString();
- function resolveAsScalar(token, strict = true, onError) {
- if (token) {
- const _onError = (pos, code, message) => {
- const offset = typeof pos === "number" ? pos : Array.isArray(pos) ? pos[0] : pos.offset;
- if (onError)
- onError(offset, code, message);
- else
- throw new errors.YAMLParseError([offset, offset + 1], code, message);
- };
- switch (token.type) {
- case "scalar":
- case "single-quoted-scalar":
- case "double-quoted-scalar":
- return resolveFlowScalar.resolveFlowScalar(token, strict, _onError);
- case "block-scalar":
- return resolveBlockScalar.resolveBlockScalar({ options: { strict } }, token, _onError);
- }
- }
- return null;
- }
- function createScalarToken(value, context) {
- const { implicitKey = false, indent, inFlow = false, offset = -1, type = "PLAIN" } = context;
- const source = stringifyString.stringifyString({ type, value }, {
- implicitKey,
- indent: indent > 0 ? " ".repeat(indent) : "",
- inFlow,
- options: { blockQuote: true, lineWidth: -1 }
- });
- const end = context.end ?? [
- { type: "newline", offset: -1, indent, source: "\n" }
- ];
- switch (source[0]) {
- case "|":
- case ">": {
- const he = source.indexOf("\n");
- const head = source.substring(0, he);
- const body = source.substring(he + 1) + "\n";
- const props = [
- { type: "block-scalar-header", offset, indent, source: head }
- ];
- if (!addEndtoBlockProps(props, end))
- props.push({ type: "newline", offset: -1, indent, source: "\n" });
- return { type: "block-scalar", offset, indent, props, source: body };
- }
- case '"':
- return { type: "double-quoted-scalar", offset, indent, source, end };
- case "'":
- return { type: "single-quoted-scalar", offset, indent, source, end };
- default:
- return { type: "scalar", offset, indent, source, end };
- }
- }
- function setScalarValue(token, value, context = {}) {
- let { afterKey = false, implicitKey = false, inFlow = false, type } = context;
- let indent = "indent" in token ? token.indent : null;
- if (afterKey && typeof indent === "number")
- indent += 2;
- if (!type)
- switch (token.type) {
- case "single-quoted-scalar":
- type = "QUOTE_SINGLE";
- break;
- case "double-quoted-scalar":
- type = "QUOTE_DOUBLE";
- break;
- case "block-scalar": {
- const header = token.props[0];
- if (header.type !== "block-scalar-header")
- throw new Error("Invalid block scalar header");
- type = header.source[0] === ">" ? "BLOCK_FOLDED" : "BLOCK_LITERAL";
- break;
- }
- default:
- type = "PLAIN";
- }
- const source = stringifyString.stringifyString({ type, value }, {
- implicitKey: implicitKey || indent === null,
- indent: indent !== null && indent > 0 ? " ".repeat(indent) : "",
- inFlow,
- options: { blockQuote: true, lineWidth: -1 }
- });
- switch (source[0]) {
- case "|":
- case ">":
- setBlockScalarValue(token, source);
- break;
- case '"':
- setFlowScalarValue(token, source, "double-quoted-scalar");
- break;
- case "'":
- setFlowScalarValue(token, source, "single-quoted-scalar");
- break;
- default:
- setFlowScalarValue(token, source, "scalar");
- }
- }
- function setBlockScalarValue(token, source) {
- const he = source.indexOf("\n");
- const head = source.substring(0, he);
- const body = source.substring(he + 1) + "\n";
- if (token.type === "block-scalar") {
- const header = token.props[0];
- if (header.type !== "block-scalar-header")
- throw new Error("Invalid block scalar header");
- header.source = head;
- token.source = body;
- } else {
- const { offset } = token;
- const indent = "indent" in token ? token.indent : -1;
- const props = [
- { type: "block-scalar-header", offset, indent, source: head }
- ];
- if (!addEndtoBlockProps(props, "end" in token ? token.end : void 0))
- props.push({ type: "newline", offset: -1, indent, source: "\n" });
- for (const key of Object.keys(token))
- if (key !== "type" && key !== "offset")
- delete token[key];
- Object.assign(token, { type: "block-scalar", indent, props, source: body });
- }
- }
- function addEndtoBlockProps(props, end) {
- if (end)
- for (const st of end)
- switch (st.type) {
- case "space":
- case "comment":
- props.push(st);
- break;
- case "newline":
- props.push(st);
- return true;
- }
- return false;
- }
- function setFlowScalarValue(token, source, type) {
- switch (token.type) {
- case "scalar":
- case "double-quoted-scalar":
- case "single-quoted-scalar":
- token.type = type;
- token.source = source;
- break;
- case "block-scalar": {
- const end = token.props.slice(1);
- let oa = source.length;
- if (token.props[0].type === "block-scalar-header")
- oa -= token.props[0].source.length;
- for (const tok of end)
- tok.offset += oa;
- delete token.props;
- Object.assign(token, { type, source, end });
- break;
- }
- case "block-map":
- case "block-seq": {
- const offset = token.offset + source.length;
- const nl = { type: "newline", offset, indent: token.indent, source: "\n" };
- delete token.items;
- Object.assign(token, { type, source, end: [nl] });
- break;
- }
- default: {
- const indent = "indent" in token ? token.indent : -1;
- const end = "end" in token && Array.isArray(token.end) ? token.end.filter((st) => st.type === "space" || st.type === "comment" || st.type === "newline") : [];
- for (const key of Object.keys(token))
- if (key !== "type" && key !== "offset")
- delete token[key];
- Object.assign(token, { type, indent, source, end });
- }
- }
- }
- exports2.createScalarToken = createScalarToken;
- exports2.resolveAsScalar = resolveAsScalar;
- exports2.setScalarValue = setScalarValue;
- }
-});
-
-// ../../node_modules/yaml/dist/parse/cst-stringify.js
-var require_cst_stringify = __commonJS({
- "../../node_modules/yaml/dist/parse/cst-stringify.js"(exports2) {
- "use strict";
- var stringify = (cst) => "type" in cst ? stringifyToken(cst) : stringifyItem(cst);
- function stringifyToken(token) {
- switch (token.type) {
- case "block-scalar": {
- let res = "";
- for (const tok of token.props)
- res += stringifyToken(tok);
- return res + token.source;
- }
- case "block-map":
- case "block-seq": {
- let res = "";
- for (const item of token.items)
- res += stringifyItem(item);
- return res;
- }
- case "flow-collection": {
- let res = token.start.source;
- for (const item of token.items)
- res += stringifyItem(item);
- for (const st of token.end)
- res += st.source;
- return res;
- }
- case "document": {
- let res = stringifyItem(token);
- if (token.end)
- for (const st of token.end)
- res += st.source;
- return res;
- }
- default: {
- let res = token.source;
- if ("end" in token && token.end)
- for (const st of token.end)
- res += st.source;
- return res;
- }
- }
- }
- function stringifyItem({ start, key, sep, value }) {
- let res = "";
- for (const st of start)
- res += st.source;
- if (key)
- res += stringifyToken(key);
- if (sep)
- for (const st of sep)
- res += st.source;
- if (value)
- res += stringifyToken(value);
- return res;
- }
- exports2.stringify = stringify;
- }
-});
-
-// ../../node_modules/yaml/dist/parse/cst-visit.js
-var require_cst_visit = __commonJS({
- "../../node_modules/yaml/dist/parse/cst-visit.js"(exports2) {
- "use strict";
- var BREAK = Symbol("break visit");
- var SKIP = Symbol("skip children");
- var REMOVE = Symbol("remove item");
- function visit(cst, visitor) {
- if ("type" in cst && cst.type === "document")
- cst = { start: cst.start, value: cst.value };
- _visit(Object.freeze([]), cst, visitor);
- }
- visit.BREAK = BREAK;
- visit.SKIP = SKIP;
- visit.REMOVE = REMOVE;
- visit.itemAtPath = (cst, path) => {
- let item = cst;
- for (const [field, index] of path) {
- const tok = item?.[field];
- if (tok && "items" in tok) {
- item = tok.items[index];
- } else
- return void 0;
- }
- return item;
- };
- visit.parentCollection = (cst, path) => {
- const parent = visit.itemAtPath(cst, path.slice(0, -1));
- const field = path[path.length - 1][0];
- const coll = parent?.[field];
- if (coll && "items" in coll)
- return coll;
- throw new Error("Parent collection not found");
- };
- function _visit(path, item, visitor) {
- let ctrl = visitor(item, path);
- if (typeof ctrl === "symbol")
- return ctrl;
- for (const field of ["key", "value"]) {
- const token = item[field];
- if (token && "items" in token) {
- for (let i = 0; i < token.items.length; ++i) {
- const ci = _visit(Object.freeze(path.concat([[field, i]])), token.items[i], visitor);
- if (typeof ci === "number")
- i = ci - 1;
- else if (ci === BREAK)
- return BREAK;
- else if (ci === REMOVE) {
- token.items.splice(i, 1);
- i -= 1;
- }
- }
- if (typeof ctrl === "function" && field === "key")
- ctrl = ctrl(item, path);
- }
- }
- return typeof ctrl === "function" ? ctrl(item, path) : ctrl;
- }
- exports2.visit = visit;
- }
-});
-
-// ../../node_modules/yaml/dist/parse/cst.js
-var require_cst = __commonJS({
- "../../node_modules/yaml/dist/parse/cst.js"(exports2) {
- "use strict";
- var cstScalar = require_cst_scalar();
- var cstStringify = require_cst_stringify();
- var cstVisit = require_cst_visit();
- var BOM = "\uFEFF";
- var DOCUMENT = "";
- var FLOW_END = "";
- var SCALAR = "";
- var isCollection = (token) => !!token && "items" in token;
- var isScalar = (token) => !!token && (token.type === "scalar" || token.type === "single-quoted-scalar" || token.type === "double-quoted-scalar" || token.type === "block-scalar");
- function prettyToken(token) {
- switch (token) {
- case BOM:
- return "";
- case DOCUMENT:
- return "";
- case FLOW_END:
- return "";
- case SCALAR:
- return "";
- default:
- return JSON.stringify(token);
- }
- }
- function tokenType(source) {
- switch (source) {
- case BOM:
- return "byte-order-mark";
- case DOCUMENT:
- return "doc-mode";
- case FLOW_END:
- return "flow-error-end";
- case SCALAR:
- return "scalar";
- case "---":
- return "doc-start";
- case "...":
- return "doc-end";
- case "":
- case "\n":
- case "\r\n":
- return "newline";
- case "-":
- return "seq-item-ind";
- case "?":
- return "explicit-key-ind";
- case ":":
- return "map-value-ind";
- case "{":
- return "flow-map-start";
- case "}":
- return "flow-map-end";
- case "[":
- return "flow-seq-start";
- case "]":
- return "flow-seq-end";
- case ",":
- return "comma";
- }
- switch (source[0]) {
- case " ":
- case " ":
- return "space";
- case "#":
- return "comment";
- case "%":
- return "directive-line";
- case "*":
- return "alias";
- case "&":
- return "anchor";
- case "!":
- return "tag";
- case "'":
- return "single-quoted-scalar";
- case '"':
- return "double-quoted-scalar";
- case "|":
- case ">":
- return "block-scalar-header";
- }
- return null;
- }
- exports2.createScalarToken = cstScalar.createScalarToken;
- exports2.resolveAsScalar = cstScalar.resolveAsScalar;
- exports2.setScalarValue = cstScalar.setScalarValue;
- exports2.stringify = cstStringify.stringify;
- exports2.visit = cstVisit.visit;
- exports2.BOM = BOM;
- exports2.DOCUMENT = DOCUMENT;
- exports2.FLOW_END = FLOW_END;
- exports2.SCALAR = SCALAR;
- exports2.isCollection = isCollection;
- exports2.isScalar = isScalar;
- exports2.prettyToken = prettyToken;
- exports2.tokenType = tokenType;
- }
-});
-
-// ../../node_modules/yaml/dist/parse/lexer.js
-var require_lexer = __commonJS({
- "../../node_modules/yaml/dist/parse/lexer.js"(exports2) {
- "use strict";
- var cst = require_cst();
- function isEmpty(ch) {
- switch (ch) {
- case void 0:
- case " ":
- case "\n":
- case "\r":
- case " ":
- return true;
- default:
- return false;
- }
- }
- var hexDigits = new Set("0123456789ABCDEFabcdef");
- var tagChars = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()");
- var flowIndicatorChars = new Set(",[]{}");
- var invalidAnchorChars = new Set(" ,[]{}\n\r ");
- var isNotAnchorChar = (ch) => !ch || invalidAnchorChars.has(ch);
- var Lexer = class {
- constructor() {
- this.atEnd = false;
- this.blockScalarIndent = -1;
- this.blockScalarKeep = false;
- this.buffer = "";
- this.flowKey = false;
- this.flowLevel = 0;
- this.indentNext = 0;
- this.indentValue = 0;
- this.lineEndPos = null;
- this.next = null;
- this.pos = 0;
- }
- /**
- * Generate YAML tokens from the `source` string. If `incomplete`,
- * a part of the last line may be left as a buffer for the next call.
- *
- * @returns A generator of lexical tokens
- */
- *lex(source, incomplete = false) {
- if (source) {
- if (typeof source !== "string")
- throw TypeError("source is not a string");
- this.buffer = this.buffer ? this.buffer + source : source;
- this.lineEndPos = null;
- }
- this.atEnd = !incomplete;
- let next = this.next ?? "stream";
- while (next && (incomplete || this.hasChars(1)))
- next = yield* this.parseNext(next);
- }
- atLineEnd() {
- let i = this.pos;
- let ch = this.buffer[i];
- while (ch === " " || ch === " ")
- ch = this.buffer[++i];
- if (!ch || ch === "#" || ch === "\n")
- return true;
- if (ch === "\r")
- return this.buffer[i + 1] === "\n";
- return false;
- }
- charAt(n) {
- return this.buffer[this.pos + n];
- }
- continueScalar(offset) {
- let ch = this.buffer[offset];
- if (this.indentNext > 0) {
- let indent = 0;
- while (ch === " ")
- ch = this.buffer[++indent + offset];
- if (ch === "\r") {
- const next = this.buffer[indent + offset + 1];
- if (next === "\n" || !next && !this.atEnd)
- return offset + indent + 1;
- }
- return ch === "\n" || indent >= this.indentNext || !ch && !this.atEnd ? offset + indent : -1;
- }
- if (ch === "-" || ch === ".") {
- const dt = this.buffer.substr(offset, 3);
- if ((dt === "---" || dt === "...") && isEmpty(this.buffer[offset + 3]))
- return -1;
- }
- return offset;
- }
- getLine() {
- let end = this.lineEndPos;
- if (typeof end !== "number" || end !== -1 && end < this.pos) {
- end = this.buffer.indexOf("\n", this.pos);
- this.lineEndPos = end;
- }
- if (end === -1)
- return this.atEnd ? this.buffer.substring(this.pos) : null;
- if (this.buffer[end - 1] === "\r")
- end -= 1;
- return this.buffer.substring(this.pos, end);
- }
- hasChars(n) {
- return this.pos + n <= this.buffer.length;
- }
- setNext(state) {
- this.buffer = this.buffer.substring(this.pos);
- this.pos = 0;
- this.lineEndPos = null;
- this.next = state;
- return null;
- }
- peek(n) {
- return this.buffer.substr(this.pos, n);
- }
- *parseNext(next) {
- switch (next) {
- case "stream":
- return yield* this.parseStream();
- case "line-start":
- return yield* this.parseLineStart();
- case "block-start":
- return yield* this.parseBlockStart();
- case "doc":
- return yield* this.parseDocument();
- case "flow":
- return yield* this.parseFlowCollection();
- case "quoted-scalar":
- return yield* this.parseQuotedScalar();
- case "block-scalar":
- return yield* this.parseBlockScalar();
- case "plain-scalar":
- return yield* this.parsePlainScalar();
- }
- }
- *parseStream() {
- let line = this.getLine();
- if (line === null)
- return this.setNext("stream");
- if (line[0] === cst.BOM) {
- yield* this.pushCount(1);
- line = line.substring(1);
- }
- if (line[0] === "%") {
- let dirEnd = line.length;
- let cs = line.indexOf("#");
- while (cs !== -1) {
- const ch = line[cs - 1];
- if (ch === " " || ch === " ") {
- dirEnd = cs - 1;
- break;
- } else {
- cs = line.indexOf("#", cs + 1);
- }
- }
- while (true) {
- const ch = line[dirEnd - 1];
- if (ch === " " || ch === " ")
- dirEnd -= 1;
- else
- break;
- }
- const n = (yield* this.pushCount(dirEnd)) + (yield* this.pushSpaces(true));
- yield* this.pushCount(line.length - n);
- this.pushNewline();
- return "stream";
- }
- if (this.atLineEnd()) {
- const sp = yield* this.pushSpaces(true);
- yield* this.pushCount(line.length - sp);
- yield* this.pushNewline();
- return "stream";
- }
- yield cst.DOCUMENT;
- return yield* this.parseLineStart();
- }
- *parseLineStart() {
- const ch = this.charAt(0);
- if (!ch && !this.atEnd)
- return this.setNext("line-start");
- if (ch === "-" || ch === ".") {
- if (!this.atEnd && !this.hasChars(4))
- return this.setNext("line-start");
- const s = this.peek(3);
- if ((s === "---" || s === "...") && isEmpty(this.charAt(3))) {
- yield* this.pushCount(3);
- this.indentValue = 0;
- this.indentNext = 0;
- return s === "---" ? "doc" : "stream";
- }
- }
- this.indentValue = yield* this.pushSpaces(false);
- if (this.indentNext > this.indentValue && !isEmpty(this.charAt(1)))
- this.indentNext = this.indentValue;
- return yield* this.parseBlockStart();
- }
- *parseBlockStart() {
- const [ch0, ch1] = this.peek(2);
- if (!ch1 && !this.atEnd)
- return this.setNext("block-start");
- if ((ch0 === "-" || ch0 === "?" || ch0 === ":") && isEmpty(ch1)) {
- const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
- this.indentNext = this.indentValue + 1;
- this.indentValue += n;
- return yield* this.parseBlockStart();
- }
- return "doc";
- }
- *parseDocument() {
- yield* this.pushSpaces(true);
- const line = this.getLine();
- if (line === null)
- return this.setNext("doc");
- let n = yield* this.pushIndicators();
- switch (line[n]) {
- case "#":
- yield* this.pushCount(line.length - n);
- case void 0:
- yield* this.pushNewline();
- return yield* this.parseLineStart();
- case "{":
- case "[":
- yield* this.pushCount(1);
- this.flowKey = false;
- this.flowLevel = 1;
- return "flow";
- case "}":
- case "]":
- yield* this.pushCount(1);
- return "doc";
- case "*":
- yield* this.pushUntil(isNotAnchorChar);
- return "doc";
- case '"':
- case "'":
- return yield* this.parseQuotedScalar();
- case "|":
- case ">":
- n += yield* this.parseBlockScalarHeader();
- n += yield* this.pushSpaces(true);
- yield* this.pushCount(line.length - n);
- yield* this.pushNewline();
- return yield* this.parseBlockScalar();
- default:
- return yield* this.parsePlainScalar();
- }
- }
- *parseFlowCollection() {
- let nl, sp;
- let indent = -1;
- do {
- nl = yield* this.pushNewline();
- if (nl > 0) {
- sp = yield* this.pushSpaces(false);
- this.indentValue = indent = sp;
- } else {
- sp = 0;
- }
- sp += yield* this.pushSpaces(true);
- } while (nl + sp > 0);
- const line = this.getLine();
- if (line === null)
- return this.setNext("flow");
- if (indent !== -1 && indent < this.indentNext && line[0] !== "#" || indent === 0 && (line.startsWith("---") || line.startsWith("...")) && isEmpty(line[3])) {
- const atFlowEndMarker = indent === this.indentNext - 1 && this.flowLevel === 1 && (line[0] === "]" || line[0] === "}");
- if (!atFlowEndMarker) {
- this.flowLevel = 0;
- yield cst.FLOW_END;
- return yield* this.parseLineStart();
- }
- }
- let n = 0;
- while (line[n] === ",") {
- n += yield* this.pushCount(1);
- n += yield* this.pushSpaces(true);
- this.flowKey = false;
- }
- n += yield* this.pushIndicators();
- switch (line[n]) {
- case void 0:
- return "flow";
- case "#":
- yield* this.pushCount(line.length - n);
- return "flow";
- case "{":
- case "[":
- yield* this.pushCount(1);
- this.flowKey = false;
- this.flowLevel += 1;
- return "flow";
- case "}":
- case "]":
- yield* this.pushCount(1);
- this.flowKey = true;
- this.flowLevel -= 1;
- return this.flowLevel ? "flow" : "doc";
- case "*":
- yield* this.pushUntil(isNotAnchorChar);
- return "flow";
- case '"':
- case "'":
- this.flowKey = true;
- return yield* this.parseQuotedScalar();
- case ":": {
- const next = this.charAt(1);
- if (this.flowKey || isEmpty(next) || next === ",") {
- this.flowKey = false;
- yield* this.pushCount(1);
- yield* this.pushSpaces(true);
- return "flow";
- }
- }
- default:
- this.flowKey = false;
- return yield* this.parsePlainScalar();
- }
- }
- *parseQuotedScalar() {
- const quote = this.charAt(0);
- let end = this.buffer.indexOf(quote, this.pos + 1);
- if (quote === "'") {
- while (end !== -1 && this.buffer[end + 1] === "'")
- end = this.buffer.indexOf("'", end + 2);
- } else {
- while (end !== -1) {
- let n = 0;
- while (this.buffer[end - 1 - n] === "\\")
- n += 1;
- if (n % 2 === 0)
- break;
- end = this.buffer.indexOf('"', end + 1);
- }
- }
- const qb = this.buffer.substring(0, end);
- let nl = qb.indexOf("\n", this.pos);
- if (nl !== -1) {
- while (nl !== -1) {
- const cs = this.continueScalar(nl + 1);
- if (cs === -1)
- break;
- nl = qb.indexOf("\n", cs);
- }
- if (nl !== -1) {
- end = nl - (qb[nl - 1] === "\r" ? 2 : 1);
- }
- }
- if (end === -1) {
- if (!this.atEnd)
- return this.setNext("quoted-scalar");
- end = this.buffer.length;
- }
- yield* this.pushToIndex(end + 1, false);
- return this.flowLevel ? "flow" : "doc";
- }
- *parseBlockScalarHeader() {
- this.blockScalarIndent = -1;
- this.blockScalarKeep = false;
- let i = this.pos;
- while (true) {
- const ch = this.buffer[++i];
- if (ch === "+")
- this.blockScalarKeep = true;
- else if (ch > "0" && ch <= "9")
- this.blockScalarIndent = Number(ch) - 1;
- else if (ch !== "-")
- break;
- }
- return yield* this.pushUntil((ch) => isEmpty(ch) || ch === "#");
- }
- *parseBlockScalar() {
- let nl = this.pos - 1;
- let indent = 0;
- let ch;
- loop: for (let i2 = this.pos; ch = this.buffer[i2]; ++i2) {
- switch (ch) {
- case " ":
- indent += 1;
- break;
- case "\n":
- nl = i2;
- indent = 0;
- break;
- case "\r": {
- const next = this.buffer[i2 + 1];
- if (!next && !this.atEnd)
- return this.setNext("block-scalar");
- if (next === "\n")
- break;
- }
- default:
- break loop;
- }
- }
- if (!ch && !this.atEnd)
- return this.setNext("block-scalar");
- if (indent >= this.indentNext) {
- if (this.blockScalarIndent === -1)
- this.indentNext = indent;
- else {
- this.indentNext = this.blockScalarIndent + (this.indentNext === 0 ? 1 : this.indentNext);
- }
- do {
- const cs = this.continueScalar(nl + 1);
- if (cs === -1)
- break;
- nl = this.buffer.indexOf("\n", cs);
- } while (nl !== -1);
- if (nl === -1) {
- if (!this.atEnd)
- return this.setNext("block-scalar");
- nl = this.buffer.length;
- }
- }
- let i = nl + 1;
- ch = this.buffer[i];
- while (ch === " ")
- ch = this.buffer[++i];
- if (ch === " ") {
- while (ch === " " || ch === " " || ch === "\r" || ch === "\n")
- ch = this.buffer[++i];
- nl = i - 1;
- } else if (!this.blockScalarKeep) {
- do {
- let i2 = nl - 1;
- let ch2 = this.buffer[i2];
- if (ch2 === "\r")
- ch2 = this.buffer[--i2];
- const lastChar = i2;
- while (ch2 === " ")
- ch2 = this.buffer[--i2];
- if (ch2 === "\n" && i2 >= this.pos && i2 + 1 + indent > lastChar)
- nl = i2;
- else
- break;
- } while (true);
- }
- yield cst.SCALAR;
- yield* this.pushToIndex(nl + 1, true);
- return yield* this.parseLineStart();
- }
- *parsePlainScalar() {
- const inFlow = this.flowLevel > 0;
- let end = this.pos - 1;
- let i = this.pos - 1;
- let ch;
- while (ch = this.buffer[++i]) {
- if (ch === ":") {
- const next = this.buffer[i + 1];
- if (isEmpty(next) || inFlow && flowIndicatorChars.has(next))
- break;
- end = i;
- } else if (isEmpty(ch)) {
- let next = this.buffer[i + 1];
- if (ch === "\r") {
- if (next === "\n") {
- i += 1;
- ch = "\n";
- next = this.buffer[i + 1];
- } else
- end = i;
- }
- if (next === "#" || inFlow && flowIndicatorChars.has(next))
- break;
- if (ch === "\n") {
- const cs = this.continueScalar(i + 1);
- if (cs === -1)
- break;
- i = Math.max(i, cs - 2);
- }
- } else {
- if (inFlow && flowIndicatorChars.has(ch))
- break;
- end = i;
- }
- }
- if (!ch && !this.atEnd)
- return this.setNext("plain-scalar");
- yield cst.SCALAR;
- yield* this.pushToIndex(end + 1, true);
- return inFlow ? "flow" : "doc";
- }
- *pushCount(n) {
- if (n > 0) {
- yield this.buffer.substr(this.pos, n);
- this.pos += n;
- return n;
- }
- return 0;
- }
- *pushToIndex(i, allowEmpty) {
- const s = this.buffer.slice(this.pos, i);
- if (s) {
- yield s;
- this.pos += s.length;
- return s.length;
- } else if (allowEmpty)
- yield "";
- return 0;
- }
- *pushIndicators() {
- switch (this.charAt(0)) {
- case "!":
- return (yield* this.pushTag()) + (yield* this.pushSpaces(true)) + (yield* this.pushIndicators());
- case "&":
- return (yield* this.pushUntil(isNotAnchorChar)) + (yield* this.pushSpaces(true)) + (yield* this.pushIndicators());
- case "-":
- case "?":
- case ":": {
- const inFlow = this.flowLevel > 0;
- const ch1 = this.charAt(1);
- if (isEmpty(ch1) || inFlow && flowIndicatorChars.has(ch1)) {
- if (!inFlow)
- this.indentNext = this.indentValue + 1;
- else if (this.flowKey)
- this.flowKey = false;
- return (yield* this.pushCount(1)) + (yield* this.pushSpaces(true)) + (yield* this.pushIndicators());
- }
- }
- }
- return 0;
- }
- *pushTag() {
- if (this.charAt(1) === "<") {
- let i = this.pos + 2;
- let ch = this.buffer[i];
- while (!isEmpty(ch) && ch !== ">")
- ch = this.buffer[++i];
- return yield* this.pushToIndex(ch === ">" ? i + 1 : i, false);
- } else {
- let i = this.pos + 1;
- let ch = this.buffer[i];
- while (ch) {
- if (tagChars.has(ch))
- ch = this.buffer[++i];
- else if (ch === "%" && hexDigits.has(this.buffer[i + 1]) && hexDigits.has(this.buffer[i + 2])) {
- ch = this.buffer[i += 3];
- } else
- break;
- }
- return yield* this.pushToIndex(i, false);
- }
- }
- *pushNewline() {
- const ch = this.buffer[this.pos];
- if (ch === "\n")
- return yield* this.pushCount(1);
- else if (ch === "\r" && this.charAt(1) === "\n")
- return yield* this.pushCount(2);
- else
- return 0;
- }
- *pushSpaces(allowTabs) {
- let i = this.pos - 1;
- let ch;
- do {
- ch = this.buffer[++i];
- } while (ch === " " || allowTabs && ch === " ");
- const n = i - this.pos;
- if (n > 0) {
- yield this.buffer.substr(this.pos, n);
- this.pos = i;
- }
- return n;
- }
- *pushUntil(test) {
- let i = this.pos;
- let ch = this.buffer[i];
- while (!test(ch))
- ch = this.buffer[++i];
- return yield* this.pushToIndex(i, false);
- }
- };
- exports2.Lexer = Lexer;
- }
-});
-
-// ../../node_modules/yaml/dist/parse/line-counter.js
-var require_line_counter = __commonJS({
- "../../node_modules/yaml/dist/parse/line-counter.js"(exports2) {
- "use strict";
- var LineCounter = class {
- constructor() {
- this.lineStarts = [];
- this.addNewLine = (offset) => this.lineStarts.push(offset);
- this.linePos = (offset) => {
- let low = 0;
- let high = this.lineStarts.length;
- while (low < high) {
- const mid = low + high >> 1;
- if (this.lineStarts[mid] < offset)
- low = mid + 1;
- else
- high = mid;
- }
- if (this.lineStarts[low] === offset)
- return { line: low + 1, col: 1 };
- if (low === 0)
- return { line: 0, col: offset };
- const start = this.lineStarts[low - 1];
- return { line: low, col: offset - start + 1 };
- };
- }
- };
- exports2.LineCounter = LineCounter;
- }
-});
-
-// ../../node_modules/yaml/dist/parse/parser.js
-var require_parser = __commonJS({
- "../../node_modules/yaml/dist/parse/parser.js"(exports2) {
- "use strict";
- var node_process = require("node:process");
- var cst = require_cst();
- var lexer = require_lexer();
- function includesToken(list, type) {
- for (let i = 0; i < list.length; ++i)
- if (list[i].type === type)
- return true;
- return false;
- }
- function findNonEmptyIndex(list) {
- for (let i = 0; i < list.length; ++i) {
- switch (list[i].type) {
- case "space":
- case "comment":
- case "newline":
- break;
- default:
- return i;
- }
- }
- return -1;
- }
- function isFlowToken(token) {
- switch (token?.type) {
- case "alias":
- case "scalar":
- case "single-quoted-scalar":
- case "double-quoted-scalar":
- case "flow-collection":
- return true;
- default:
- return false;
- }
- }
- function getPrevProps(parent) {
- switch (parent.type) {
- case "document":
- return parent.start;
- case "block-map": {
- const it = parent.items[parent.items.length - 1];
- return it.sep ?? it.start;
- }
- case "block-seq":
- return parent.items[parent.items.length - 1].start;
- default:
- return [];
- }
- }
- function getFirstKeyStartProps(prev) {
- if (prev.length === 0)
- return [];
- let i = prev.length;
- loop: while (--i >= 0) {
- switch (prev[i].type) {
- case "doc-start":
- case "explicit-key-ind":
- case "map-value-ind":
- case "seq-item-ind":
- case "newline":
- break loop;
- }
- }
- while (prev[++i]?.type === "space") {
- }
- return prev.splice(i, prev.length);
- }
- function fixFlowSeqItems(fc) {
- if (fc.start.type === "flow-seq-start") {
- for (const it of fc.items) {
- if (it.sep && !it.value && !includesToken(it.start, "explicit-key-ind") && !includesToken(it.sep, "map-value-ind")) {
- if (it.key)
- it.value = it.key;
- delete it.key;
- if (isFlowToken(it.value)) {
- if (it.value.end)
- Array.prototype.push.apply(it.value.end, it.sep);
- else
- it.value.end = it.sep;
- } else
- Array.prototype.push.apply(it.start, it.sep);
- delete it.sep;
- }
- }
- }
- }
- var Parser = class {
- /**
- * @param onNewLine - If defined, called separately with the start position of
- * each new line (in `parse()`, including the start of input).
- */
- constructor(onNewLine) {
- this.atNewLine = true;
- this.atScalar = false;
- this.indent = 0;
- this.offset = 0;
- this.onKeyLine = false;
- this.stack = [];
- this.source = "";
- this.type = "";
- this.lexer = new lexer.Lexer();
- this.onNewLine = onNewLine;
- }
- /**
- * Parse `source` as a YAML stream.
- * If `incomplete`, a part of the last line may be left as a buffer for the next call.
- *
- * Errors are not thrown, but yielded as `{ type: 'error', message }` tokens.
- *
- * @returns A generator of tokens representing each directive, document, and other structure.
- */
- *parse(source, incomplete = false) {
- if (this.onNewLine && this.offset === 0)
- this.onNewLine(0);
- for (const lexeme of this.lexer.lex(source, incomplete))
- yield* this.next(lexeme);
- if (!incomplete)
- yield* this.end();
- }
- /**
- * Advance the parser by the `source` of one lexical token.
- */
- *next(source) {
- this.source = source;
- if (node_process.env.LOG_TOKENS)
- console.log("|", cst.prettyToken(source));
- if (this.atScalar) {
- this.atScalar = false;
- yield* this.step();
- this.offset += source.length;
- return;
- }
- const type = cst.tokenType(source);
- if (!type) {
- const message = `Not a YAML token: ${source}`;
- yield* this.pop({ type: "error", offset: this.offset, message, source });
- this.offset += source.length;
- } else if (type === "scalar") {
- this.atNewLine = false;
- this.atScalar = true;
- this.type = "scalar";
- } else {
- this.type = type;
- yield* this.step();
- switch (type) {
- case "newline":
- this.atNewLine = true;
- this.indent = 0;
- if (this.onNewLine)
- this.onNewLine(this.offset + source.length);
- break;
- case "space":
- if (this.atNewLine && source[0] === " ")
- this.indent += source.length;
- break;
- case "explicit-key-ind":
- case "map-value-ind":
- case "seq-item-ind":
- if (this.atNewLine)
- this.indent += source.length;
- break;
- case "doc-mode":
- case "flow-error-end":
- return;
- default:
- this.atNewLine = false;
- }
- this.offset += source.length;
- }
- }
- /** Call at end of input to push out any remaining constructions */
- *end() {
- while (this.stack.length > 0)
- yield* this.pop();
- }
- get sourceToken() {
- const st = {
- type: this.type,
- offset: this.offset,
- indent: this.indent,
- source: this.source
- };
- return st;
- }
- *step() {
- const top = this.peek(1);
- if (this.type === "doc-end" && (!top || top.type !== "doc-end")) {
- while (this.stack.length > 0)
- yield* this.pop();
- this.stack.push({
- type: "doc-end",
- offset: this.offset,
- source: this.source
- });
- return;
- }
- if (!top)
- return yield* this.stream();
- switch (top.type) {
- case "document":
- return yield* this.document(top);
- case "alias":
- case "scalar":
- case "single-quoted-scalar":
- case "double-quoted-scalar":
- return yield* this.scalar(top);
- case "block-scalar":
- return yield* this.blockScalar(top);
- case "block-map":
- return yield* this.blockMap(top);
- case "block-seq":
- return yield* this.blockSequence(top);
- case "flow-collection":
- return yield* this.flowCollection(top);
- case "doc-end":
- return yield* this.documentEnd(top);
- }
- yield* this.pop();
- }
- peek(n) {
- return this.stack[this.stack.length - n];
- }
- *pop(error) {
- const token = error ?? this.stack.pop();
- if (!token) {
- const message = "Tried to pop an empty stack";
- yield { type: "error", offset: this.offset, source: "", message };
- } else if (this.stack.length === 0) {
- yield token;
- } else {
- const top = this.peek(1);
- if (token.type === "block-scalar") {
- token.indent = "indent" in top ? top.indent : 0;
- } else if (token.type === "flow-collection" && top.type === "document") {
- token.indent = 0;
- }
- if (token.type === "flow-collection")
- fixFlowSeqItems(token);
- switch (top.type) {
- case "document":
- top.value = token;
- break;
- case "block-scalar":
- top.props.push(token);
- break;
- case "block-map": {
- const it = top.items[top.items.length - 1];
- if (it.value) {
- top.items.push({ start: [], key: token, sep: [] });
- this.onKeyLine = true;
- return;
- } else if (it.sep) {
- it.value = token;
- } else {
- Object.assign(it, { key: token, sep: [] });
- this.onKeyLine = !it.explicitKey;
- return;
- }
- break;
- }
- case "block-seq": {
- const it = top.items[top.items.length - 1];
- if (it.value)
- top.items.push({ start: [], value: token });
- else
- it.value = token;
- break;
- }
- case "flow-collection": {
- const it = top.items[top.items.length - 1];
- if (!it || it.value)
- top.items.push({ start: [], key: token, sep: [] });
- else if (it.sep)
- it.value = token;
- else
- Object.assign(it, { key: token, sep: [] });
- return;
- }
- default:
- yield* this.pop();
- yield* this.pop(token);
- }
- if ((top.type === "document" || top.type === "block-map" || top.type === "block-seq") && (token.type === "block-map" || token.type === "block-seq")) {
- const last = token.items[token.items.length - 1];
- if (last && !last.sep && !last.value && last.start.length > 0 && findNonEmptyIndex(last.start) === -1 && (token.indent === 0 || last.start.every((st) => st.type !== "comment" || st.indent < token.indent))) {
- if (top.type === "document")
- top.end = last.start;
- else
- top.items.push({ start: last.start });
- token.items.splice(-1, 1);
- }
- }
- }
- }
- *stream() {
- switch (this.type) {
- case "directive-line":
- yield { type: "directive", offset: this.offset, source: this.source };
- return;
- case "byte-order-mark":
- case "space":
- case "comment":
- case "newline":
- yield this.sourceToken;
- return;
- case "doc-mode":
- case "doc-start": {
- const doc = {
- type: "document",
- offset: this.offset,
- start: []
- };
- if (this.type === "doc-start")
- doc.start.push(this.sourceToken);
- this.stack.push(doc);
- return;
- }
- }
- yield {
- type: "error",
- offset: this.offset,
- message: `Unexpected ${this.type} token in YAML stream`,
- source: this.source
- };
- }
- *document(doc) {
- if (doc.value)
- return yield* this.lineEnd(doc);
- switch (this.type) {
- case "doc-start": {
- if (findNonEmptyIndex(doc.start) !== -1) {
- yield* this.pop();
- yield* this.step();
- } else
- doc.start.push(this.sourceToken);
- return;
- }
- case "anchor":
- case "tag":
- case "space":
- case "comment":
- case "newline":
- doc.start.push(this.sourceToken);
- return;
- }
- const bv = this.startBlockValue(doc);
- if (bv)
- this.stack.push(bv);
- else {
- yield {
- type: "error",
- offset: this.offset,
- message: `Unexpected ${this.type} token in YAML document`,
- source: this.source
- };
- }
- }
- *scalar(scalar) {
- if (this.type === "map-value-ind") {
- const prev = getPrevProps(this.peek(2));
- const start = getFirstKeyStartProps(prev);
- let sep;
- if (scalar.end) {
- sep = scalar.end;
- sep.push(this.sourceToken);
- delete scalar.end;
- } else
- sep = [this.sourceToken];
- const map = {
- type: "block-map",
- offset: scalar.offset,
- indent: scalar.indent,
- items: [{ start, key: scalar, sep }]
- };
- this.onKeyLine = true;
- this.stack[this.stack.length - 1] = map;
- } else
- yield* this.lineEnd(scalar);
- }
- *blockScalar(scalar) {
- switch (this.type) {
- case "space":
- case "comment":
- case "newline":
- scalar.props.push(this.sourceToken);
- return;
- case "scalar":
- scalar.source = this.source;
- this.atNewLine = true;
- this.indent = 0;
- if (this.onNewLine) {
- let nl = this.source.indexOf("\n") + 1;
- while (nl !== 0) {
- this.onNewLine(this.offset + nl);
- nl = this.source.indexOf("\n", nl) + 1;
- }
- }
- yield* this.pop();
- break;
- default:
- yield* this.pop();
- yield* this.step();
- }
- }
- *blockMap(map) {
- const it = map.items[map.items.length - 1];
- switch (this.type) {
- case "newline":
- this.onKeyLine = false;
- if (it.value) {
- const end = "end" in it.value ? it.value.end : void 0;
- const last = Array.isArray(end) ? end[end.length - 1] : void 0;
- if (last?.type === "comment")
- end?.push(this.sourceToken);
- else
- map.items.push({ start: [this.sourceToken] });
- } else if (it.sep) {
- it.sep.push(this.sourceToken);
- } else {
- it.start.push(this.sourceToken);
- }
- return;
- case "space":
- case "comment":
- if (it.value) {
- map.items.push({ start: [this.sourceToken] });
- } else if (it.sep) {
- it.sep.push(this.sourceToken);
- } else {
- if (this.atIndentedComment(it.start, map.indent)) {
- const prev = map.items[map.items.length - 2];
- const end = prev?.value?.end;
- if (Array.isArray(end)) {
- Array.prototype.push.apply(end, it.start);
- end.push(this.sourceToken);
- map.items.pop();
- return;
- }
- }
- it.start.push(this.sourceToken);
- }
- return;
- }
- if (this.indent >= map.indent) {
- const atMapIndent = !this.onKeyLine && this.indent === map.indent;
- const atNextItem = atMapIndent && (it.sep || it.explicitKey) && this.type !== "seq-item-ind";
- let start = [];
- if (atNextItem && it.sep && !it.value) {
- const nl = [];
- for (let i = 0; i < it.sep.length; ++i) {
- const st = it.sep[i];
- switch (st.type) {
- case "newline":
- nl.push(i);
- break;
- case "space":
- break;
- case "comment":
- if (st.indent > map.indent)
- nl.length = 0;
- break;
- default:
- nl.length = 0;
- }
- }
- if (nl.length >= 2)
- start = it.sep.splice(nl[1]);
- }
- switch (this.type) {
- case "anchor":
- case "tag":
- if (atNextItem || it.value) {
- start.push(this.sourceToken);
- map.items.push({ start });
- this.onKeyLine = true;
- } else if (it.sep) {
- it.sep.push(this.sourceToken);
- } else {
- it.start.push(this.sourceToken);
- }
- return;
- case "explicit-key-ind":
- if (!it.sep && !it.explicitKey) {
- it.start.push(this.sourceToken);
- it.explicitKey = true;
- } else if (atNextItem || it.value) {
- start.push(this.sourceToken);
- map.items.push({ start, explicitKey: true });
- } else {
- this.stack.push({
- type: "block-map",
- offset: this.offset,
- indent: this.indent,
- items: [{ start: [this.sourceToken], explicitKey: true }]
- });
- }
- this.onKeyLine = true;
- return;
- case "map-value-ind":
- if (it.explicitKey) {
- if (!it.sep) {
- if (includesToken(it.start, "newline")) {
- Object.assign(it, { key: null, sep: [this.sourceToken] });
- } else {
- const start2 = getFirstKeyStartProps(it.start);
- this.stack.push({
- type: "block-map",
- offset: this.offset,
- indent: this.indent,
- items: [{ start: start2, key: null, sep: [this.sourceToken] }]
- });
- }
- } else if (it.value) {
- map.items.push({ start: [], key: null, sep: [this.sourceToken] });
- } else if (includesToken(it.sep, "map-value-ind")) {
- this.stack.push({
- type: "block-map",
- offset: this.offset,
- indent: this.indent,
- items: [{ start, key: null, sep: [this.sourceToken] }]
- });
- } else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
- const start2 = getFirstKeyStartProps(it.start);
- const key = it.key;
- const sep = it.sep;
- sep.push(this.sourceToken);
- delete it.key;
- delete it.sep;
- this.stack.push({
- type: "block-map",
- offset: this.offset,
- indent: this.indent,
- items: [{ start: start2, key, sep }]
- });
- } else if (start.length > 0) {
- it.sep = it.sep.concat(start, this.sourceToken);
- } else {
- it.sep.push(this.sourceToken);
- }
- } else {
- if (!it.sep) {
- Object.assign(it, { key: null, sep: [this.sourceToken] });
- } else if (it.value || atNextItem) {
- map.items.push({ start, key: null, sep: [this.sourceToken] });
- } else if (includesToken(it.sep, "map-value-ind")) {
- this.stack.push({
- type: "block-map",
- offset: this.offset,
- indent: this.indent,
- items: [{ start: [], key: null, sep: [this.sourceToken] }]
- });
- } else {
- it.sep.push(this.sourceToken);
- }
- }
- this.onKeyLine = true;
- return;
- case "alias":
- case "scalar":
- case "single-quoted-scalar":
- case "double-quoted-scalar": {
- const fs = this.flowScalar(this.type);
- if (atNextItem || it.value) {
- map.items.push({ start, key: fs, sep: [] });
- this.onKeyLine = true;
- } else if (it.sep) {
- this.stack.push(fs);
- } else {
- Object.assign(it, { key: fs, sep: [] });
- this.onKeyLine = true;
- }
- return;
- }
- default: {
- const bv = this.startBlockValue(map);
- if (bv) {
- if (atMapIndent && bv.type !== "block-seq") {
- map.items.push({ start });
- }
- this.stack.push(bv);
- return;
- }
- }
- }
- }
- yield* this.pop();
- yield* this.step();
- }
- *blockSequence(seq) {
- const it = seq.items[seq.items.length - 1];
- switch (this.type) {
- case "newline":
- if (it.value) {
- const end = "end" in it.value ? it.value.end : void 0;
- const last = Array.isArray(end) ? end[end.length - 1] : void 0;
- if (last?.type === "comment")
- end?.push(this.sourceToken);
- else
- seq.items.push({ start: [this.sourceToken] });
- } else
- it.start.push(this.sourceToken);
- return;
- case "space":
- case "comment":
- if (it.value)
- seq.items.push({ start: [this.sourceToken] });
- else {
- if (this.atIndentedComment(it.start, seq.indent)) {
- const prev = seq.items[seq.items.length - 2];
- const end = prev?.value?.end;
- if (Array.isArray(end)) {
- Array.prototype.push.apply(end, it.start);
- end.push(this.sourceToken);
- seq.items.pop();
- return;
- }
- }
- it.start.push(this.sourceToken);
- }
- return;
- case "anchor":
- case "tag":
- if (it.value || this.indent <= seq.indent)
- break;
- it.start.push(this.sourceToken);
- return;
- case "seq-item-ind":
- if (this.indent !== seq.indent)
- break;
- if (it.value || includesToken(it.start, "seq-item-ind"))
- seq.items.push({ start: [this.sourceToken] });
- else
- it.start.push(this.sourceToken);
- return;
- }
- if (this.indent > seq.indent) {
- const bv = this.startBlockValue(seq);
- if (bv) {
- this.stack.push(bv);
- return;
- }
- }
- yield* this.pop();
- yield* this.step();
- }
- *flowCollection(fc) {
- const it = fc.items[fc.items.length - 1];
- if (this.type === "flow-error-end") {
- let top;
- do {
- yield* this.pop();
- top = this.peek(1);
- } while (top && top.type === "flow-collection");
- } else if (fc.end.length === 0) {
- switch (this.type) {
- case "comma":
- case "explicit-key-ind":
- if (!it || it.sep)
- fc.items.push({ start: [this.sourceToken] });
- else
- it.start.push(this.sourceToken);
- return;
- case "map-value-ind":
- if (!it || it.value)
- fc.items.push({ start: [], key: null, sep: [this.sourceToken] });
- else if (it.sep)
- it.sep.push(this.sourceToken);
- else
- Object.assign(it, { key: null, sep: [this.sourceToken] });
- return;
- case "space":
- case "comment":
- case "newline":
- case "anchor":
- case "tag":
- if (!it || it.value)
- fc.items.push({ start: [this.sourceToken] });
- else if (it.sep)
- it.sep.push(this.sourceToken);
- else
- it.start.push(this.sourceToken);
- return;
- case "alias":
- case "scalar":
- case "single-quoted-scalar":
- case "double-quoted-scalar": {
- const fs = this.flowScalar(this.type);
- if (!it || it.value)
- fc.items.push({ start: [], key: fs, sep: [] });
- else if (it.sep)
- this.stack.push(fs);
- else
- Object.assign(it, { key: fs, sep: [] });
- return;
- }
- case "flow-map-end":
- case "flow-seq-end":
- fc.end.push(this.sourceToken);
- return;
- }
- const bv = this.startBlockValue(fc);
- if (bv)
- this.stack.push(bv);
- else {
- yield* this.pop();
- yield* this.step();
- }
- } else {
- const parent = this.peek(2);
- if (parent.type === "block-map" && (this.type === "map-value-ind" && parent.indent === fc.indent || this.type === "newline" && !parent.items[parent.items.length - 1].sep)) {
- yield* this.pop();
- yield* this.step();
- } else if (this.type === "map-value-ind" && parent.type !== "flow-collection") {
- const prev = getPrevProps(parent);
- const start = getFirstKeyStartProps(prev);
- fixFlowSeqItems(fc);
- const sep = fc.end.splice(1, fc.end.length);
- sep.push(this.sourceToken);
- const map = {
- type: "block-map",
- offset: fc.offset,
- indent: fc.indent,
- items: [{ start, key: fc, sep }]
- };
- this.onKeyLine = true;
- this.stack[this.stack.length - 1] = map;
- } else {
- yield* this.lineEnd(fc);
- }
- }
- }
- flowScalar(type) {
- if (this.onNewLine) {
- let nl = this.source.indexOf("\n") + 1;
- while (nl !== 0) {
- this.onNewLine(this.offset + nl);
- nl = this.source.indexOf("\n", nl) + 1;
- }
- }
- return {
- type,
- offset: this.offset,
- indent: this.indent,
- source: this.source
- };
- }
- startBlockValue(parent) {
- switch (this.type) {
- case "alias":
- case "scalar":
- case "single-quoted-scalar":
- case "double-quoted-scalar":
- return this.flowScalar(this.type);
- case "block-scalar-header":
- return {
- type: "block-scalar",
- offset: this.offset,
- indent: this.indent,
- props: [this.sourceToken],
- source: ""
- };
- case "flow-map-start":
- case "flow-seq-start":
- return {
- type: "flow-collection",
- offset: this.offset,
- indent: this.indent,
- start: this.sourceToken,
- items: [],
- end: []
- };
- case "seq-item-ind":
- return {
- type: "block-seq",
- offset: this.offset,
- indent: this.indent,
- items: [{ start: [this.sourceToken] }]
- };
- case "explicit-key-ind": {
- this.onKeyLine = true;
- const prev = getPrevProps(parent);
- const start = getFirstKeyStartProps(prev);
- start.push(this.sourceToken);
- return {
- type: "block-map",
- offset: this.offset,
- indent: this.indent,
- items: [{ start, explicitKey: true }]
- };
- }
- case "map-value-ind": {
- this.onKeyLine = true;
- const prev = getPrevProps(parent);
- const start = getFirstKeyStartProps(prev);
- return {
- type: "block-map",
- offset: this.offset,
- indent: this.indent,
- items: [{ start, key: null, sep: [this.sourceToken] }]
- };
- }
- }
- return null;
- }
- atIndentedComment(start, indent) {
- if (this.type !== "comment")
- return false;
- if (this.indent <= indent)
- return false;
- return start.every((st) => st.type === "newline" || st.type === "space");
- }
- *documentEnd(docEnd) {
- if (this.type !== "doc-mode") {
- if (docEnd.end)
- docEnd.end.push(this.sourceToken);
- else
- docEnd.end = [this.sourceToken];
- if (this.type === "newline")
- yield* this.pop();
- }
- }
- *lineEnd(token) {
- switch (this.type) {
- case "comma":
- case "doc-start":
- case "doc-end":
- case "flow-seq-end":
- case "flow-map-end":
- case "map-value-ind":
- yield* this.pop();
- yield* this.step();
- break;
- case "newline":
- this.onKeyLine = false;
- case "space":
- case "comment":
- default:
- if (token.end)
- token.end.push(this.sourceToken);
- else
- token.end = [this.sourceToken];
- if (this.type === "newline")
- yield* this.pop();
- }
- }
- };
- exports2.Parser = Parser;
- }
-});
-
-// ../../node_modules/yaml/dist/public-api.js
-var require_public_api = __commonJS({
- "../../node_modules/yaml/dist/public-api.js"(exports2) {
- "use strict";
- var composer = require_composer();
- var Document = require_Document();
- var errors = require_errors();
- var log = require_log();
- var identity = require_identity();
- var lineCounter = require_line_counter();
- var parser = require_parser();
- function parseOptions(options) {
- const prettyErrors = options.prettyErrors !== false;
- const lineCounter$1 = options.lineCounter || prettyErrors && new lineCounter.LineCounter() || null;
- return { lineCounter: lineCounter$1, prettyErrors };
- }
- function parseAllDocuments(source, options = {}) {
- const { lineCounter: lineCounter2, prettyErrors } = parseOptions(options);
- const parser$1 = new parser.Parser(lineCounter2?.addNewLine);
- const composer$1 = new composer.Composer(options);
- const docs = Array.from(composer$1.compose(parser$1.parse(source)));
- if (prettyErrors && lineCounter2)
- for (const doc of docs) {
- doc.errors.forEach(errors.prettifyError(source, lineCounter2));
- doc.warnings.forEach(errors.prettifyError(source, lineCounter2));
- }
- if (docs.length > 0)
- return docs;
- return Object.assign([], { empty: true }, composer$1.streamInfo());
- }
- function parseDocument(source, options = {}) {
- const { lineCounter: lineCounter2, prettyErrors } = parseOptions(options);
- const parser$1 = new parser.Parser(lineCounter2?.addNewLine);
- const composer$1 = new composer.Composer(options);
- let doc = null;
- for (const _doc of composer$1.compose(parser$1.parse(source), true, source.length)) {
- if (!doc)
- doc = _doc;
- else if (doc.options.logLevel !== "silent") {
- doc.errors.push(new errors.YAMLParseError(_doc.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
- break;
- }
- }
- if (prettyErrors && lineCounter2) {
- doc.errors.forEach(errors.prettifyError(source, lineCounter2));
- doc.warnings.forEach(errors.prettifyError(source, lineCounter2));
- }
- return doc;
- }
- function parse(src, reviver, options) {
- let _reviver = void 0;
- if (typeof reviver === "function") {
- _reviver = reviver;
- } else if (options === void 0 && reviver && typeof reviver === "object") {
- options = reviver;
- }
- const doc = parseDocument(src, options);
- if (!doc)
- return null;
- doc.warnings.forEach((warning) => log.warn(doc.options.logLevel, warning));
- if (doc.errors.length > 0) {
- if (doc.options.logLevel !== "silent")
- throw doc.errors[0];
- else
- doc.errors = [];
- }
- return doc.toJS(Object.assign({ reviver: _reviver }, options));
- }
- function stringify(value, replacer, options) {
- let _replacer = null;
- if (typeof replacer === "function" || Array.isArray(replacer)) {
- _replacer = replacer;
- } else if (options === void 0 && replacer) {
- options = replacer;
- }
- if (typeof options === "string")
- options = options.length;
- if (typeof options === "number") {
- const indent = Math.round(options);
- options = indent < 1 ? void 0 : indent > 8 ? { indent: 8 } : { indent };
- }
- if (value === void 0) {
- const { keepUndefined } = options ?? replacer ?? {};
- if (!keepUndefined)
- return void 0;
- }
- if (identity.isDocument(value) && !_replacer)
- return value.toString(options);
- return new Document.Document(value, _replacer, options).toString(options);
- }
- exports2.parse = parse;
- exports2.parseAllDocuments = parseAllDocuments;
- exports2.parseDocument = parseDocument;
- exports2.stringify = stringify;
- }
-});
-
-// ../../node_modules/yaml/dist/index.js
-var require_dist = __commonJS({
- "../../node_modules/yaml/dist/index.js"(exports2) {
- "use strict";
- var composer = require_composer();
- var Document = require_Document();
- var Schema = require_Schema();
- var errors = require_errors();
- var Alias = require_Alias();
- var identity = require_identity();
- var Pair = require_Pair();
- var Scalar = require_Scalar();
- var YAMLMap = require_YAMLMap();
- var YAMLSeq = require_YAMLSeq();
- var cst = require_cst();
- var lexer = require_lexer();
- var lineCounter = require_line_counter();
- var parser = require_parser();
- var publicApi = require_public_api();
- var visit = require_visit();
- exports2.Composer = composer.Composer;
- exports2.Document = Document.Document;
- exports2.Schema = Schema.Schema;
- exports2.YAMLError = errors.YAMLError;
- exports2.YAMLParseError = errors.YAMLParseError;
- exports2.YAMLWarning = errors.YAMLWarning;
- exports2.Alias = Alias.Alias;
- exports2.isAlias = identity.isAlias;
- exports2.isCollection = identity.isCollection;
- exports2.isDocument = identity.isDocument;
- exports2.isMap = identity.isMap;
- exports2.isNode = identity.isNode;
- exports2.isPair = identity.isPair;
- exports2.isScalar = identity.isScalar;
- exports2.isSeq = identity.isSeq;
- exports2.Pair = Pair.Pair;
- exports2.Scalar = Scalar.Scalar;
- exports2.YAMLMap = YAMLMap.YAMLMap;
- exports2.YAMLSeq = YAMLSeq.YAMLSeq;
- exports2.CST = cst;
- exports2.Lexer = lexer.Lexer;
- exports2.LineCounter = lineCounter.LineCounter;
- exports2.Parser = parser.Parser;
- exports2.parse = publicApi.parse;
- exports2.parseAllDocuments = publicApi.parseAllDocuments;
- exports2.parseDocument = publicApi.parseDocument;
- exports2.stringify = publicApi.stringify;
- exports2.visit = visit.visit;
- exports2.visitAsync = visit.visitAsync;
- }
-});
-
-// src/index.ts
-var src_exports = {};
-__export(src_exports, {
- convertInsomnia: () => convertInsomnia,
- plugin: () => plugin
-});
-module.exports = __toCommonJS(src_exports);
-var import_yaml = __toESM(require_dist());
-
-// src/common.ts
-function convertSyntax(variable) {
- if (!isJSString(variable)) return variable;
- return variable.replaceAll(/{{\s*(_\.)?([^}]+)\s*}}/g, "${[$2]}");
-}
-function isJSObject(obj) {
- return Object.prototype.toString.call(obj) === "[object Object]";
-}
-function isJSString(obj) {
- return Object.prototype.toString.call(obj) === "[object String]";
-}
-function convertId(id) {
- if (id.startsWith("GENERATE_ID::")) {
- return id;
- }
- return `GENERATE_ID::${id}`;
-}
-function deleteUndefinedAttrs(obj) {
- if (Array.isArray(obj) && obj != null) {
- return obj.map(deleteUndefinedAttrs);
- } else if (typeof obj === "object" && obj != null) {
- return Object.fromEntries(
- Object.entries(obj).filter(([, v]) => v !== void 0).map(([k, v]) => [k, deleteUndefinedAttrs(v)])
- );
- } else {
- return obj;
- }
-}
-
-// src/v4.ts
-function convertInsomniaV4(parsed) {
- if (!Array.isArray(parsed.resources)) return null;
- const resources = {
- environments: [],
- folders: [],
- grpcRequests: [],
- httpRequests: [],
- websocketRequests: [],
- workspaces: []
- };
- const workspacesToImport = parsed.resources.filter((r) => isJSObject(r) && r._type === "workspace");
- for (const w of workspacesToImport) {
- resources.workspaces.push({
- id: convertId(w._id),
- createdAt: w.created ? new Date(w.created).toISOString().replace("Z", "") : void 0,
- updatedAt: w.updated ? new Date(w.updated).toISOString().replace("Z", "") : void 0,
- model: "workspace",
- name: w.name,
- description: w.description || void 0
- });
- const environmentsToImport = parsed.resources.filter(
- (r) => isJSObject(r) && r._type === "environment"
- );
- resources.environments.push(
- ...environmentsToImport.map((r) => importEnvironment(r, w._id))
- );
- const nextFolder = (parentId) => {
- const children = parsed.resources.filter((r) => r.parentId === parentId);
- for (const child of children) {
- if (!isJSObject(child)) continue;
- if (child._type === "request_group") {
- resources.folders.push(importFolder(child, w._id));
- nextFolder(child._id);
- } else if (child._type === "request") {
- resources.httpRequests.push(
- importHttpRequest(child, w._id)
- );
- } else if (child._type === "grpc_request") {
- resources.grpcRequests.push(
- importGrpcRequest(child, w._id)
- );
- }
- }
- };
- nextFolder(w._id);
- }
- resources.httpRequests = resources.httpRequests.filter(Boolean);
- resources.grpcRequests = resources.grpcRequests.filter(Boolean);
- resources.environments = resources.environments.filter(Boolean);
- resources.workspaces = resources.workspaces.filter(Boolean);
- return { resources };
-}
-function importHttpRequest(r, workspaceId) {
- let bodyType = null;
- let body = {};
- if (r.body.mimeType === "application/octet-stream") {
- bodyType = "binary";
- body = { filePath: r.body.fileName ?? "" };
- } else if (r.body?.mimeType === "application/x-www-form-urlencoded") {
- bodyType = "application/x-www-form-urlencoded";
- body = {
- form: (r.body.params ?? []).map((p) => ({
- enabled: !p.disabled,
- name: p.name ?? "",
- value: p.value ?? ""
- }))
- };
- } else if (r.body?.mimeType === "multipart/form-data") {
- bodyType = "multipart/form-data";
- body = {
- form: (r.body.params ?? []).map((p) => ({
- enabled: !p.disabled,
- name: p.name ?? "",
- value: p.value ?? "",
- file: p.fileName ?? null
- }))
- };
- } else if (r.body?.mimeType === "application/graphql") {
- bodyType = "graphql";
- body = { text: convertSyntax(r.body.text ?? "") };
- } else if (r.body?.mimeType === "application/json") {
- bodyType = "application/json";
- body = { text: convertSyntax(r.body.text ?? "") };
- }
- let authenticationType = null;
- let authentication = {};
- if (r.authentication.type === "bearer") {
- authenticationType = "bearer";
- authentication = {
- token: convertSyntax(r.authentication.token)
- };
- } else if (r.authentication.type === "basic") {
- authenticationType = "basic";
- authentication = {
- username: convertSyntax(r.authentication.username),
- password: convertSyntax(r.authentication.password)
- };
- }
- return {
- id: convertId(r.meta?.id ?? r._id),
- createdAt: r.created ? new Date(r.created).toISOString().replace("Z", "") : void 0,
- updatedAt: r.modified ? new Date(r.modified).toISOString().replace("Z", "") : void 0,
- workspaceId: convertId(workspaceId),
- folderId: r.parentId === workspaceId ? null : convertId(r.parentId),
- model: "http_request",
- sortPriority: r.metaSortKey,
- name: r.name,
- description: r.description || void 0,
- url: convertSyntax(r.url),
- body,
- bodyType,
- authentication,
- authenticationType,
- method: r.method,
- headers: (r.headers ?? []).map((h) => ({
- enabled: !h.disabled,
- name: h.name ?? "",
- value: h.value ?? ""
- })).filter(({ name, value }) => name !== "" || value !== "")
- };
-}
-function importGrpcRequest(r, workspaceId) {
- const parts = r.protoMethodName.split("/").filter((p) => p !== "");
- const service = parts[0] ?? null;
- const method = parts[1] ?? null;
- return {
- id: convertId(r.meta?.id ?? r._id),
- createdAt: r.created ? new Date(r.created).toISOString().replace("Z", "") : void 0,
- updatedAt: r.modified ? new Date(r.modified).toISOString().replace("Z", "") : void 0,
- workspaceId: convertId(workspaceId),
- folderId: r.parentId === workspaceId ? null : convertId(r.parentId),
- model: "grpc_request",
- sortPriority: r.metaSortKey,
- name: r.name,
- description: r.description || void 0,
- url: convertSyntax(r.url),
- service,
- method,
- message: r.body?.text ?? "",
- metadata: (r.metadata ?? []).map((h) => ({
- enabled: !h.disabled,
- name: h.name ?? "",
- value: h.value ?? ""
- })).filter(({ name, value }) => name !== "" || value !== "")
- };
-}
-function importFolder(f, workspaceId) {
- return {
- id: convertId(f._id),
- createdAt: f.created ? new Date(f.created).toISOString().replace("Z", "") : void 0,
- updatedAt: f.modified ? new Date(f.modified).toISOString().replace("Z", "") : void 0,
- folderId: f.parentId === workspaceId ? null : convertId(f.parentId),
- workspaceId: convertId(workspaceId),
- description: f.description || void 0,
- model: "folder",
- name: f.name
- };
-}
-function importEnvironment(e, workspaceId, isParent) {
- return {
- id: convertId(e._id),
- createdAt: e.created ? new Date(e.created).toISOString().replace("Z", "") : void 0,
- updatedAt: e.modified ? new Date(e.modified).toISOString().replace("Z", "") : void 0,
- workspaceId: convertId(workspaceId),
- // @ts-ignore
- sortPriority: e.metaSortKey,
- // Will be added to Yaak later
- base: isParent ?? e.parentId === workspaceId,
- model: "environment",
- name: e.name,
- variables: Object.entries(e.data).map(([name, value]) => ({
- enabled: true,
- name,
- value: `${value}`
- }))
- };
-}
-
-// src/v5.ts
-function convertInsomniaV5(parsed) {
- if (!Array.isArray(parsed.collection)) return null;
- const resources = {
- environments: [],
- folders: [],
- grpcRequests: [],
- httpRequests: [],
- websocketRequests: [],
- workspaces: []
- };
- const meta = parsed.meta ?? {};
- resources.workspaces.push({
- id: convertId(meta.id ?? "collection"),
- createdAt: meta.created ? new Date(meta.created).toISOString().replace("Z", "") : void 0,
- updatedAt: meta.modified ? new Date(meta.modified).toISOString().replace("Z", "") : void 0,
- model: "workspace",
- name: parsed.name,
- description: meta.description || void 0
- });
- resources.environments.push(
- importEnvironment2(parsed.environments, meta.id, true),
- ...(parsed.environments.subEnvironments ?? []).map((r) => importEnvironment2(r, meta.id))
- );
- const nextFolder = (children, parentId) => {
- for (const child of children ?? []) {
- if (!isJSObject(child)) continue;
- if (Array.isArray(child.children)) {
- resources.folders.push(importFolder2(child, meta.id, parentId));
- nextFolder(child.children, child.meta.id);
- } else if (child.method) {
- resources.httpRequests.push(
- importHttpRequest2(child, meta.id, parentId)
- );
- } else if (child.protoFileId) {
- resources.grpcRequests.push(
- importGrpcRequest2(child, meta.id, parentId)
- );
- } else if (child.url) {
- resources.websocketRequests.push(
- importWebsocketRequest(child, meta.id, parentId)
- );
- }
- }
- };
- nextFolder(parsed.collection ?? [], meta.id);
- resources.httpRequests = resources.httpRequests.filter(Boolean);
- resources.grpcRequests = resources.grpcRequests.filter(Boolean);
- resources.environments = resources.environments.filter(Boolean);
- resources.workspaces = resources.workspaces.filter(Boolean);
- return { resources };
-}
-function importHttpRequest2(r, workspaceId, parentId) {
- const id = r.meta?.id ?? r._id;
- const created = r.meta?.created ?? r.created;
- const updated = r.meta?.modified ?? r.updated;
- const sortKey = r.meta?.sortKey ?? r.sortKey;
- let bodyType = null;
- let body = {};
- if (r.body?.mimeType === "application/octet-stream") {
- bodyType = "binary";
- body = { filePath: r.body.fileName ?? "" };
- } else if (r.body?.mimeType === "application/x-www-form-urlencoded") {
- bodyType = "application/x-www-form-urlencoded";
- body = {
- form: (r.body.params ?? []).map((p) => ({
- enabled: !p.disabled,
- name: p.name ?? "",
- value: p.value ?? ""
- }))
- };
- } else if (r.body?.mimeType === "multipart/form-data") {
- bodyType = "multipart/form-data";
- body = {
- form: (r.body.params ?? []).map((p) => ({
- enabled: !p.disabled,
- name: p.name ?? "",
- value: p.value ?? "",
- file: p.fileName ?? null
- }))
- };
- } else if (r.body?.mimeType === "application/graphql") {
- bodyType = "graphql";
- body = { text: convertSyntax(r.body.text ?? "") };
- } else if (r.body?.mimeType === "application/json") {
- bodyType = "application/json";
- body = { text: convertSyntax(r.body.text ?? "") };
- }
- return {
- id: convertId(id),
- workspaceId: convertId(workspaceId),
- createdAt: created ? new Date(created).toISOString().replace("Z", "") : void 0,
- updatedAt: updated ? new Date(updated).toISOString().replace("Z", "") : void 0,
- folderId: parentId === workspaceId ? null : convertId(parentId),
- sortPriority: sortKey,
- model: "http_request",
- name: r.name,
- description: r.meta?.description || void 0,
- url: convertSyntax(r.url),
- body,
- bodyType,
- method: r.method,
- ...importHeaders(r),
- ...importAuthentication(r)
- };
-}
-function importGrpcRequest2(r, workspaceId, parentId) {
- const id = r.meta?.id ?? r._id;
- const created = r.meta?.created ?? r.created;
- const updated = r.meta?.modified ?? r.updated;
- const sortKey = r.meta?.sortKey ?? r.sortKey;
- const parts = r.protoMethodName.split("/").filter((p) => p !== "");
- const service = parts[0] ?? null;
- const method = parts[1] ?? null;
- return {
- model: "grpc_request",
- id: convertId(id),
- workspaceId: convertId(workspaceId),
- createdAt: created ? new Date(created).toISOString().replace("Z", "") : void 0,
- updatedAt: updated ? new Date(updated).toISOString().replace("Z", "") : void 0,
- folderId: parentId === workspaceId ? null : convertId(parentId),
- sortPriority: sortKey,
- name: r.name,
- description: r.description || void 0,
- url: convertSyntax(r.url),
- service,
- method,
- message: r.body?.text ?? "",
- metadata: (r.metadata ?? []).map((h) => ({
- enabled: !h.disabled,
- name: h.name ?? "",
- value: h.value ?? ""
- })).filter(({ name, value }) => name !== "" || value !== "")
- };
-}
-function importWebsocketRequest(r, workspaceId, parentId) {
- const id = r.meta?.id ?? r._id;
- const created = r.meta?.created ?? r.created;
- const updated = r.meta?.modified ?? r.updated;
- const sortKey = r.meta?.sortKey ?? r.sortKey;
- return {
- model: "websocket_request",
- id: convertId(id),
- workspaceId: convertId(workspaceId),
- createdAt: created ? new Date(created).toISOString().replace("Z", "") : void 0,
- updatedAt: updated ? new Date(updated).toISOString().replace("Z", "") : void 0,
- folderId: parentId === workspaceId ? null : convertId(parentId),
- sortPriority: sortKey,
- name: r.name,
- description: r.description || void 0,
- url: convertSyntax(r.url),
- message: r.body?.text ?? "",
- ...importHeaders(r),
- ...importAuthentication(r)
- };
-}
-function importHeaders(r) {
- const headers = (r.headers ?? []).map((h) => ({
- enabled: !h.disabled,
- name: h.name ?? "",
- value: h.value ?? ""
- })).filter(({ name, value }) => name !== "" || value !== "");
- return { headers };
-}
-function importAuthentication(r) {
- let authenticationType = null;
- let authentication = {};
- if (r.authentication?.type === "bearer") {
- authenticationType = "bearer";
- authentication = {
- token: convertSyntax(r.authentication.token)
- };
- } else if (r.authentication?.type === "basic") {
- authenticationType = "basic";
- authentication = {
- username: convertSyntax(r.authentication.username),
- password: convertSyntax(r.authentication.password)
- };
- }
- return { authenticationType, authentication };
-}
-function importFolder2(f, workspaceId, parentId) {
- const id = f.meta?.id ?? f._id;
- const created = f.meta?.created ?? f.created;
- const updated = f.meta?.modified ?? f.updated;
- const sortKey = f.meta?.sortKey ?? f.sortKey;
- return {
- model: "folder",
- id: convertId(id),
- createdAt: created ? new Date(created).toISOString().replace("Z", "") : void 0,
- updatedAt: updated ? new Date(updated).toISOString().replace("Z", "") : void 0,
- folderId: parentId === workspaceId ? null : convertId(parentId),
- sortPriority: sortKey,
- workspaceId: convertId(workspaceId),
- description: f.description || void 0,
- name: f.name
- };
-}
-function importEnvironment2(e, workspaceId, isParent) {
- const id = e.meta?.id ?? e._id;
- const created = e.meta?.created ?? e.created;
- const updated = e.meta?.modified ?? e.updated;
- const sortKey = e.meta?.sortKey ?? e.sortKey;
- return {
- id: convertId(id),
- createdAt: created ? new Date(created).toISOString().replace("Z", "") : void 0,
- updatedAt: updated ? new Date(updated).toISOString().replace("Z", "") : void 0,
- workspaceId: convertId(workspaceId),
- public: !e.isPrivate,
- // @ts-ignore
- sortPriority: sortKey,
- // Will be added to Yaak later
- base: isParent ?? e.parentId === workspaceId,
- model: "environment",
- name: e.name,
- variables: Object.entries(e.data ?? {}).map(([name, value]) => ({
- enabled: true,
- name,
- value: `${value}`
- }))
- };
-}
-
-// src/index.ts
-var plugin = {
- importer: {
- name: "Insomnia",
- description: "Import Insomnia workspaces",
- async onImport(_ctx, args) {
- return convertInsomnia(args.text);
- }
- }
-};
-function convertInsomnia(contents) {
- let parsed;
- try {
- parsed = JSON.parse(contents);
- } catch (e) {
- }
- try {
- parsed = parsed ?? import_yaml.default.parse(contents);
- } catch (e) {
- }
- if (!isJSObject(parsed)) return null;
- const result = convertInsomniaV5(parsed) ?? convertInsomniaV4(parsed);
- return deleteUndefinedAttrs(result);
-}
-// Annotate the CommonJS export names for ESM import in node:
-0 && (module.exports = {
- convertInsomnia,
- plugin
-});
diff --git a/src-tauri/vendored/plugins/importer-openapi/build/index.js b/src-tauri/vendored/plugins/importer-openapi/build/index.js
deleted file mode 100644
index 2daeaf3b..00000000
--- a/src-tauri/vendored/plugins/importer-openapi/build/index.js
+++ /dev/null
@@ -1,146558 +0,0 @@
-"use strict";
-var __create = Object.create;
-var __defProp = Object.defineProperty;
-var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
-var __getOwnPropNames = Object.getOwnPropertyNames;
-var __getProtoOf = Object.getPrototypeOf;
-var __hasOwnProp = Object.prototype.hasOwnProperty;
-var __esm = (fn, res) => function __init() {
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
-};
-var __commonJS = (cb, mod) => function __require() {
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
-};
-var __export = (target, all) => {
- for (var name in all)
- __defProp(target, name, { get: all[name], enumerable: true });
-};
-var __copyProps = (to, from, except, desc) => {
- if (from && typeof from === "object" || typeof from === "function") {
- for (let key of __getOwnPropNames(from))
- if (!__hasOwnProp.call(to, key) && key !== except)
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
- }
- return to;
-};
-var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
- // If the importer is in node compatibility mode or this is not an ESM
- // file that has been converted to a CommonJS file using a Babel-
- // compatible transform (i.e. "__esModule" has not been set), then set
- // "default" to the CommonJS "module.exports" for node compatibility.
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
- mod
-));
-var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
-
-// ../../node_modules/lodash/lodash.js
-var require_lodash = __commonJS({
- "../../node_modules/lodash/lodash.js"(exports2, module2) {
- (function() {
- var undefined2;
- var VERSION = "4.17.21";
- var LARGE_ARRAY_SIZE = 200;
- var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", FUNC_ERROR_TEXT = "Expected a function", INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`";
- var HASH_UNDEFINED = "__lodash_hash_undefined__";
- var MAX_MEMOIZE_SIZE = 500;
- var PLACEHOLDER = "__lodash_placeholder__";
- var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
- var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
- var WRAP_BIND_FLAG = 1, WRAP_BIND_KEY_FLAG = 2, WRAP_CURRY_BOUND_FLAG = 4, WRAP_CURRY_FLAG = 8, WRAP_CURRY_RIGHT_FLAG = 16, WRAP_PARTIAL_FLAG = 32, WRAP_PARTIAL_RIGHT_FLAG = 64, WRAP_ARY_FLAG = 128, WRAP_REARG_FLAG = 256, WRAP_FLIP_FLAG = 512;
- var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "...";
- var HOT_COUNT = 800, HOT_SPAN = 16;
- var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3;
- var INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN = 0 / 0;
- var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
- var wrapFlags = [
- ["ary", WRAP_ARY_FLAG],
- ["bind", WRAP_BIND_FLAG],
- ["bindKey", WRAP_BIND_KEY_FLAG],
- ["curry", WRAP_CURRY_FLAG],
- ["curryRight", WRAP_CURRY_RIGHT_FLAG],
- ["flip", WRAP_FLIP_FLAG],
- ["partial", WRAP_PARTIAL_FLAG],
- ["partialRight", WRAP_PARTIAL_RIGHT_FLAG],
- ["rearg", WRAP_REARG_FLAG]
- ];
- var argsTag = "[object Arguments]", arrayTag = "[object Array]", asyncTag = "[object AsyncFunction]", boolTag = "[object Boolean]", dateTag = "[object Date]", domExcTag = "[object DOMException]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", nullTag = "[object Null]", objectTag = "[object Object]", promiseTag = "[object Promise]", proxyTag = "[object Proxy]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]", undefinedTag = "[object Undefined]", weakMapTag = "[object WeakMap]", weakSetTag = "[object WeakSet]";
- var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
- var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
- var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml = /[&<>"']/g, reHasEscapedHtml = RegExp(reEscapedHtml.source), reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
- var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g;
- var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source);
- var reTrimStart = /^\s+/;
- var reWhitespace = /\s/;
- var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /;
- var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
- var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
- var reEscapeChar = /\\(\\)?/g;
- var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
- var reFlags = /\w*$/;
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
- var reIsBinary = /^0b[01]+$/i;
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
- var reIsOctal = /^0o[0-7]+$/i;
- var reIsUint = /^(?:0|[1-9]\d*)$/;
- var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
- var reNoMatch = /($^)/;
- var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
- var rsAstralRange = "\\ud800-\\udfff", rsComboMarksRange = "\\u0300-\\u036f", reComboHalfMarksRange = "\\ufe20-\\ufe2f", rsComboSymbolsRange = "\\u20d0-\\u20ff", rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, rsDingbatRange = "\\u2700-\\u27bf", rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff", rsMathOpRange = "\\xac\\xb1\\xd7\\xf7", rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", rsPunctuationRange = "\\u2000-\\u206f", rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde", rsVarRange = "\\ufe0e\\ufe0f", rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
- var rsApos = "['\u2019]", rsAstral = "[" + rsAstralRange + "]", rsBreak = "[" + rsBreakRange + "]", rsCombo = "[" + rsComboRange + "]", rsDigits = "\\d+", rsDingbat = "[" + rsDingbatRange + "]", rsLower = "[" + rsLowerRange + "]", rsMisc = "[^" + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]", rsFitz = "\\ud83c[\\udffb-\\udfff]", rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")", rsNonAstral = "[^" + rsAstralRange + "]", rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}", rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]", rsUpper = "[" + rsUpperRange + "]", rsZWJ = "\\u200d";
- var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")", rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")", rsOptContrLower = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?", rsOptContrUpper = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?", reOptMod = rsModifier + "?", rsOptVar = "[" + rsVarRange + "]?", rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*", rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = "(?:" + [rsDingbat, rsRegional, rsSurrPair].join("|") + ")" + rsSeq, rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
- var reApos = RegExp(rsApos, "g");
- var reComboMark = RegExp(rsCombo, "g");
- var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
- var reUnicodeWord = RegExp([
- rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
- rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
- rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
- rsUpper + "+" + rsOptContrUpper,
- rsOrdUpper,
- rsOrdLower,
- rsDigits,
- rsEmoji
- ].join("|"), "g");
- var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
- var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
- var contextProps = [
- "Array",
- "Buffer",
- "DataView",
- "Date",
- "Error",
- "Float32Array",
- "Float64Array",
- "Function",
- "Int8Array",
- "Int16Array",
- "Int32Array",
- "Map",
- "Math",
- "Object",
- "Promise",
- "RegExp",
- "Set",
- "String",
- "Symbol",
- "TypeError",
- "Uint8Array",
- "Uint8ClampedArray",
- "Uint16Array",
- "Uint32Array",
- "WeakMap",
- "_",
- "clearTimeout",
- "isFinite",
- "parseInt",
- "setTimeout"
- ];
- var templateCounter = -1;
- var typedArrayTags = {};
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
- typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
- var cloneableTags = {};
- cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
- cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
- var deburredLetters = {
- // Latin-1 Supplement block.
- "\xC0": "A",
- "\xC1": "A",
- "\xC2": "A",
- "\xC3": "A",
- "\xC4": "A",
- "\xC5": "A",
- "\xE0": "a",
- "\xE1": "a",
- "\xE2": "a",
- "\xE3": "a",
- "\xE4": "a",
- "\xE5": "a",
- "\xC7": "C",
- "\xE7": "c",
- "\xD0": "D",
- "\xF0": "d",
- "\xC8": "E",
- "\xC9": "E",
- "\xCA": "E",
- "\xCB": "E",
- "\xE8": "e",
- "\xE9": "e",
- "\xEA": "e",
- "\xEB": "e",
- "\xCC": "I",
- "\xCD": "I",
- "\xCE": "I",
- "\xCF": "I",
- "\xEC": "i",
- "\xED": "i",
- "\xEE": "i",
- "\xEF": "i",
- "\xD1": "N",
- "\xF1": "n",
- "\xD2": "O",
- "\xD3": "O",
- "\xD4": "O",
- "\xD5": "O",
- "\xD6": "O",
- "\xD8": "O",
- "\xF2": "o",
- "\xF3": "o",
- "\xF4": "o",
- "\xF5": "o",
- "\xF6": "o",
- "\xF8": "o",
- "\xD9": "U",
- "\xDA": "U",
- "\xDB": "U",
- "\xDC": "U",
- "\xF9": "u",
- "\xFA": "u",
- "\xFB": "u",
- "\xFC": "u",
- "\xDD": "Y",
- "\xFD": "y",
- "\xFF": "y",
- "\xC6": "Ae",
- "\xE6": "ae",
- "\xDE": "Th",
- "\xFE": "th",
- "\xDF": "ss",
- // Latin Extended-A block.
- "\u0100": "A",
- "\u0102": "A",
- "\u0104": "A",
- "\u0101": "a",
- "\u0103": "a",
- "\u0105": "a",
- "\u0106": "C",
- "\u0108": "C",
- "\u010A": "C",
- "\u010C": "C",
- "\u0107": "c",
- "\u0109": "c",
- "\u010B": "c",
- "\u010D": "c",
- "\u010E": "D",
- "\u0110": "D",
- "\u010F": "d",
- "\u0111": "d",
- "\u0112": "E",
- "\u0114": "E",
- "\u0116": "E",
- "\u0118": "E",
- "\u011A": "E",
- "\u0113": "e",
- "\u0115": "e",
- "\u0117": "e",
- "\u0119": "e",
- "\u011B": "e",
- "\u011C": "G",
- "\u011E": "G",
- "\u0120": "G",
- "\u0122": "G",
- "\u011D": "g",
- "\u011F": "g",
- "\u0121": "g",
- "\u0123": "g",
- "\u0124": "H",
- "\u0126": "H",
- "\u0125": "h",
- "\u0127": "h",
- "\u0128": "I",
- "\u012A": "I",
- "\u012C": "I",
- "\u012E": "I",
- "\u0130": "I",
- "\u0129": "i",
- "\u012B": "i",
- "\u012D": "i",
- "\u012F": "i",
- "\u0131": "i",
- "\u0134": "J",
- "\u0135": "j",
- "\u0136": "K",
- "\u0137": "k",
- "\u0138": "k",
- "\u0139": "L",
- "\u013B": "L",
- "\u013D": "L",
- "\u013F": "L",
- "\u0141": "L",
- "\u013A": "l",
- "\u013C": "l",
- "\u013E": "l",
- "\u0140": "l",
- "\u0142": "l",
- "\u0143": "N",
- "\u0145": "N",
- "\u0147": "N",
- "\u014A": "N",
- "\u0144": "n",
- "\u0146": "n",
- "\u0148": "n",
- "\u014B": "n",
- "\u014C": "O",
- "\u014E": "O",
- "\u0150": "O",
- "\u014D": "o",
- "\u014F": "o",
- "\u0151": "o",
- "\u0154": "R",
- "\u0156": "R",
- "\u0158": "R",
- "\u0155": "r",
- "\u0157": "r",
- "\u0159": "r",
- "\u015A": "S",
- "\u015C": "S",
- "\u015E": "S",
- "\u0160": "S",
- "\u015B": "s",
- "\u015D": "s",
- "\u015F": "s",
- "\u0161": "s",
- "\u0162": "T",
- "\u0164": "T",
- "\u0166": "T",
- "\u0163": "t",
- "\u0165": "t",
- "\u0167": "t",
- "\u0168": "U",
- "\u016A": "U",
- "\u016C": "U",
- "\u016E": "U",
- "\u0170": "U",
- "\u0172": "U",
- "\u0169": "u",
- "\u016B": "u",
- "\u016D": "u",
- "\u016F": "u",
- "\u0171": "u",
- "\u0173": "u",
- "\u0174": "W",
- "\u0175": "w",
- "\u0176": "Y",
- "\u0177": "y",
- "\u0178": "Y",
- "\u0179": "Z",
- "\u017B": "Z",
- "\u017D": "Z",
- "\u017A": "z",
- "\u017C": "z",
- "\u017E": "z",
- "\u0132": "IJ",
- "\u0133": "ij",
- "\u0152": "Oe",
- "\u0153": "oe",
- "\u0149": "'n",
- "\u017F": "s"
- };
- var htmlEscapes = {
- "&": "&",
- "<": "<",
- ">": ">",
- '"': """,
- "'": "'"
- };
- var htmlUnescapes = {
- "&": "&",
- "<": "<",
- ">": ">",
- """: '"',
- "'": "'"
- };
- var stringEscapes = {
- "\\": "\\",
- "'": "'",
- "\n": "n",
- "\r": "r",
- "\u2028": "u2028",
- "\u2029": "u2029"
- };
- var freeParseFloat = parseFloat, freeParseInt = parseInt;
- var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
- var freeSelf = typeof self == "object" && self && self.Object === Object && self;
- var root = freeGlobal || freeSelf || Function("return this")();
- var freeExports = typeof exports2 == "object" && exports2 && !exports2.nodeType && exports2;
- var freeModule = freeExports && typeof module2 == "object" && module2 && !module2.nodeType && module2;
- var moduleExports = freeModule && freeModule.exports === freeExports;
- var freeProcess = moduleExports && freeGlobal.process;
- var nodeUtil = function() {
- try {
- var types = freeModule && freeModule.require && freeModule.require("util").types;
- if (types) {
- return types;
- }
- return freeProcess && freeProcess.binding && freeProcess.binding("util");
- } catch (e) {
- }
- }();
- var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, nodeIsDate = nodeUtil && nodeUtil.isDate, nodeIsMap = nodeUtil && nodeUtil.isMap, nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, nodeIsSet = nodeUtil && nodeUtil.isSet, nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
- function apply(func, thisArg, args) {
- switch (args.length) {
- case 0:
- return func.call(thisArg);
- case 1:
- return func.call(thisArg, args[0]);
- case 2:
- return func.call(thisArg, args[0], args[1]);
- case 3:
- return func.call(thisArg, args[0], args[1], args[2]);
- }
- return func.apply(thisArg, args);
- }
- function arrayAggregator(array, setter, iteratee, accumulator) {
- var index = -1, length = array == null ? 0 : array.length;
- while (++index < length) {
- var value = array[index];
- setter(accumulator, value, iteratee(value), array);
- }
- return accumulator;
- }
- function arrayEach(array, iteratee) {
- var index = -1, length = array == null ? 0 : array.length;
- while (++index < length) {
- if (iteratee(array[index], index, array) === false) {
- break;
- }
- }
- return array;
- }
- function arrayEachRight(array, iteratee) {
- var length = array == null ? 0 : array.length;
- while (length--) {
- if (iteratee(array[length], length, array) === false) {
- break;
- }
- }
- return array;
- }
- function arrayEvery(array, predicate) {
- var index = -1, length = array == null ? 0 : array.length;
- while (++index < length) {
- if (!predicate(array[index], index, array)) {
- return false;
- }
- }
- return true;
- }
- function arrayFilter(array, predicate) {
- var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
- while (++index < length) {
- var value = array[index];
- if (predicate(value, index, array)) {
- result[resIndex++] = value;
- }
- }
- return result;
- }
- function arrayIncludes(array, value) {
- var length = array == null ? 0 : array.length;
- return !!length && baseIndexOf(array, value, 0) > -1;
- }
- function arrayIncludesWith(array, value, comparator) {
- var index = -1, length = array == null ? 0 : array.length;
- while (++index < length) {
- if (comparator(value, array[index])) {
- return true;
- }
- }
- return false;
- }
- function arrayMap(array, iteratee) {
- var index = -1, length = array == null ? 0 : array.length, result = Array(length);
- while (++index < length) {
- result[index] = iteratee(array[index], index, array);
- }
- return result;
- }
- function arrayPush(array, values) {
- var index = -1, length = values.length, offset = array.length;
- while (++index < length) {
- array[offset + index] = values[index];
- }
- return array;
- }
- function arrayReduce(array, iteratee, accumulator, initAccum) {
- var index = -1, length = array == null ? 0 : array.length;
- if (initAccum && length) {
- accumulator = array[++index];
- }
- while (++index < length) {
- accumulator = iteratee(accumulator, array[index], index, array);
- }
- return accumulator;
- }
- function arrayReduceRight(array, iteratee, accumulator, initAccum) {
- var length = array == null ? 0 : array.length;
- if (initAccum && length) {
- accumulator = array[--length];
- }
- while (length--) {
- accumulator = iteratee(accumulator, array[length], length, array);
- }
- return accumulator;
- }
- function arraySome(array, predicate) {
- var index = -1, length = array == null ? 0 : array.length;
- while (++index < length) {
- if (predicate(array[index], index, array)) {
- return true;
- }
- }
- return false;
- }
- var asciiSize = baseProperty("length");
- function asciiToArray(string) {
- return string.split("");
- }
- function asciiWords(string) {
- return string.match(reAsciiWord) || [];
- }
- function baseFindKey(collection, predicate, eachFunc) {
- var result;
- eachFunc(collection, function(value, key, collection2) {
- if (predicate(value, key, collection2)) {
- result = key;
- return false;
- }
- });
- return result;
- }
- function baseFindIndex(array, predicate, fromIndex, fromRight) {
- var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
- while (fromRight ? index-- : ++index < length) {
- if (predicate(array[index], index, array)) {
- return index;
- }
- }
- return -1;
- }
- function baseIndexOf(array, value, fromIndex) {
- return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
- }
- function baseIndexOfWith(array, value, fromIndex, comparator) {
- var index = fromIndex - 1, length = array.length;
- while (++index < length) {
- if (comparator(array[index], value)) {
- return index;
- }
- }
- return -1;
- }
- function baseIsNaN(value) {
- return value !== value;
- }
- function baseMean(array, iteratee) {
- var length = array == null ? 0 : array.length;
- return length ? baseSum(array, iteratee) / length : NAN;
- }
- function baseProperty(key) {
- return function(object) {
- return object == null ? undefined2 : object[key];
- };
- }
- function basePropertyOf(object) {
- return function(key) {
- return object == null ? undefined2 : object[key];
- };
- }
- function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
- eachFunc(collection, function(value, index, collection2) {
- accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2);
- });
- return accumulator;
- }
- function baseSortBy(array, comparer) {
- var length = array.length;
- array.sort(comparer);
- while (length--) {
- array[length] = array[length].value;
- }
- return array;
- }
- function baseSum(array, iteratee) {
- var result, index = -1, length = array.length;
- while (++index < length) {
- var current = iteratee(array[index]);
- if (current !== undefined2) {
- result = result === undefined2 ? current : result + current;
- }
- }
- return result;
- }
- function baseTimes(n, iteratee) {
- var index = -1, result = Array(n);
- while (++index < n) {
- result[index] = iteratee(index);
- }
- return result;
- }
- function baseToPairs(object, props) {
- return arrayMap(props, function(key) {
- return [key, object[key]];
- });
- }
- function baseTrim(string) {
- return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
- }
- function baseUnary(func) {
- return function(value) {
- return func(value);
- };
- }
- function baseValues(object, props) {
- return arrayMap(props, function(key) {
- return object[key];
- });
- }
- function cacheHas(cache, key) {
- return cache.has(key);
- }
- function charsStartIndex(strSymbols, chrSymbols) {
- var index = -1, length = strSymbols.length;
- while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
- }
- return index;
- }
- function charsEndIndex(strSymbols, chrSymbols) {
- var index = strSymbols.length;
- while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
- }
- return index;
- }
- function countHolders(array, placeholder) {
- var length = array.length, result = 0;
- while (length--) {
- if (array[length] === placeholder) {
- ++result;
- }
- }
- return result;
- }
- var deburrLetter = basePropertyOf(deburredLetters);
- var escapeHtmlChar = basePropertyOf(htmlEscapes);
- function escapeStringChar(chr) {
- return "\\" + stringEscapes[chr];
- }
- function getValue(object, key) {
- return object == null ? undefined2 : object[key];
- }
- function hasUnicode(string) {
- return reHasUnicode.test(string);
- }
- function hasUnicodeWord(string) {
- return reHasUnicodeWord.test(string);
- }
- function iteratorToArray(iterator) {
- var data, result = [];
- while (!(data = iterator.next()).done) {
- result.push(data.value);
- }
- return result;
- }
- function mapToArray(map) {
- var index = -1, result = Array(map.size);
- map.forEach(function(value, key) {
- result[++index] = [key, value];
- });
- return result;
- }
- function overArg(func, transform) {
- return function(arg) {
- return func(transform(arg));
- };
- }
- function replaceHolders(array, placeholder) {
- var index = -1, length = array.length, resIndex = 0, result = [];
- while (++index < length) {
- var value = array[index];
- if (value === placeholder || value === PLACEHOLDER) {
- array[index] = PLACEHOLDER;
- result[resIndex++] = index;
- }
- }
- return result;
- }
- function setToArray(set) {
- var index = -1, result = Array(set.size);
- set.forEach(function(value) {
- result[++index] = value;
- });
- return result;
- }
- function setToPairs(set) {
- var index = -1, result = Array(set.size);
- set.forEach(function(value) {
- result[++index] = [value, value];
- });
- return result;
- }
- function strictIndexOf(array, value, fromIndex) {
- var index = fromIndex - 1, length = array.length;
- while (++index < length) {
- if (array[index] === value) {
- return index;
- }
- }
- return -1;
- }
- function strictLastIndexOf(array, value, fromIndex) {
- var index = fromIndex + 1;
- while (index--) {
- if (array[index] === value) {
- return index;
- }
- }
- return index;
- }
- function stringSize(string) {
- return hasUnicode(string) ? unicodeSize(string) : asciiSize(string);
- }
- function stringToArray(string) {
- return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
- }
- function trimmedEndIndex(string) {
- var index = string.length;
- while (index-- && reWhitespace.test(string.charAt(index))) {
- }
- return index;
- }
- var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
- function unicodeSize(string) {
- var result = reUnicode.lastIndex = 0;
- while (reUnicode.test(string)) {
- ++result;
- }
- return result;
- }
- function unicodeToArray(string) {
- return string.match(reUnicode) || [];
- }
- function unicodeWords(string) {
- return string.match(reUnicodeWord) || [];
- }
- var runInContext = function runInContext2(context) {
- context = context == null ? root : _2.defaults(root.Object(), context, _2.pick(root, contextProps));
- var Array2 = context.Array, Date2 = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError;
- var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
- var coreJsData = context["__core-js_shared__"];
- var funcToString = funcProto.toString;
- var hasOwnProperty = objectProto.hasOwnProperty;
- var idCounter = 0;
- var maskSrcKey = function() {
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
- return uid ? "Symbol(src)_1." + uid : "";
- }();
- var nativeObjectToString = objectProto.toString;
- var objectCtorString = funcToString.call(Object2);
- var oldDash = root._;
- var reIsNative = RegExp2(
- "^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
- );
- var Buffer2 = moduleExports ? context.Buffer : undefined2, Symbol2 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined2, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined2, symIterator = Symbol2 ? Symbol2.iterator : undefined2, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined2;
- var defineProperty = function() {
- try {
- var func = getNative(Object2, "defineProperty");
- func({}, "", {});
- return func;
- } catch (e) {
- }
- }();
- var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
- var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
- var DataView2 = getNative(context, "DataView"), Map2 = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set2 = getNative(context, "Set"), WeakMap2 = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
- var metaMap = WeakMap2 && new WeakMap2();
- var realNames = {};
- var dataViewCtorString = toSource(DataView2), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap2);
- var symbolProto = Symbol2 ? Symbol2.prototype : undefined2, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined2, symbolToString = symbolProto ? symbolProto.toString : undefined2;
- function lodash(value) {
- if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
- if (value instanceof LodashWrapper) {
- return value;
- }
- if (hasOwnProperty.call(value, "__wrapped__")) {
- return wrapperClone(value);
- }
- }
- return new LodashWrapper(value);
- }
- var baseCreate = /* @__PURE__ */ function() {
- function object() {
- }
- return function(proto) {
- if (!isObject(proto)) {
- return {};
- }
- if (objectCreate) {
- return objectCreate(proto);
- }
- object.prototype = proto;
- var result2 = new object();
- object.prototype = undefined2;
- return result2;
- };
- }();
- function baseLodash() {
- }
- function LodashWrapper(value, chainAll) {
- this.__wrapped__ = value;
- this.__actions__ = [];
- this.__chain__ = !!chainAll;
- this.__index__ = 0;
- this.__values__ = undefined2;
- }
- lodash.templateSettings = {
- /**
- * Used to detect `data` property values to be HTML-escaped.
- *
- * @memberOf _.templateSettings
- * @type {RegExp}
- */
- "escape": reEscape,
- /**
- * Used to detect code to be evaluated.
- *
- * @memberOf _.templateSettings
- * @type {RegExp}
- */
- "evaluate": reEvaluate,
- /**
- * Used to detect `data` property values to inject.
- *
- * @memberOf _.templateSettings
- * @type {RegExp}
- */
- "interpolate": reInterpolate,
- /**
- * Used to reference the data object in the template text.
- *
- * @memberOf _.templateSettings
- * @type {string}
- */
- "variable": "",
- /**
- * Used to import variables into the compiled template.
- *
- * @memberOf _.templateSettings
- * @type {Object}
- */
- "imports": {
- /**
- * A reference to the `lodash` function.
- *
- * @memberOf _.templateSettings.imports
- * @type {Function}
- */
- "_": lodash
- }
- };
- lodash.prototype = baseLodash.prototype;
- lodash.prototype.constructor = lodash;
- LodashWrapper.prototype = baseCreate(baseLodash.prototype);
- LodashWrapper.prototype.constructor = LodashWrapper;
- function LazyWrapper(value) {
- this.__wrapped__ = value;
- this.__actions__ = [];
- this.__dir__ = 1;
- this.__filtered__ = false;
- this.__iteratees__ = [];
- this.__takeCount__ = MAX_ARRAY_LENGTH;
- this.__views__ = [];
- }
- function lazyClone() {
- var result2 = new LazyWrapper(this.__wrapped__);
- result2.__actions__ = copyArray(this.__actions__);
- result2.__dir__ = this.__dir__;
- result2.__filtered__ = this.__filtered__;
- result2.__iteratees__ = copyArray(this.__iteratees__);
- result2.__takeCount__ = this.__takeCount__;
- result2.__views__ = copyArray(this.__views__);
- return result2;
- }
- function lazyReverse() {
- if (this.__filtered__) {
- var result2 = new LazyWrapper(this);
- result2.__dir__ = -1;
- result2.__filtered__ = true;
- } else {
- result2 = this.clone();
- result2.__dir__ *= -1;
- }
- return result2;
- }
- function lazyValue() {
- var array = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray(array), isRight = dir < 0, arrLength = isArr ? array.length : 0, view = getView(0, arrLength, this.__views__), start = view.start, end = view.end, length = end - start, index = isRight ? end : start - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin(length, this.__takeCount__);
- if (!isArr || !isRight && arrLength == length && takeCount == length) {
- return baseWrapperValue(array, this.__actions__);
- }
- var result2 = [];
- outer:
- while (length-- && resIndex < takeCount) {
- index += dir;
- var iterIndex = -1, value = array[index];
- while (++iterIndex < iterLength) {
- var data = iteratees[iterIndex], iteratee2 = data.iteratee, type = data.type, computed = iteratee2(value);
- if (type == LAZY_MAP_FLAG) {
- value = computed;
- } else if (!computed) {
- if (type == LAZY_FILTER_FLAG) {
- continue outer;
- } else {
- break outer;
- }
- }
- }
- result2[resIndex++] = value;
- }
- return result2;
- }
- LazyWrapper.prototype = baseCreate(baseLodash.prototype);
- LazyWrapper.prototype.constructor = LazyWrapper;
- function Hash(entries) {
- var index = -1, length = entries == null ? 0 : entries.length;
- this.clear();
- while (++index < length) {
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
- }
- function hashClear() {
- this.__data__ = nativeCreate ? nativeCreate(null) : {};
- this.size = 0;
- }
- function hashDelete(key) {
- var result2 = this.has(key) && delete this.__data__[key];
- this.size -= result2 ? 1 : 0;
- return result2;
- }
- function hashGet(key) {
- var data = this.__data__;
- if (nativeCreate) {
- var result2 = data[key];
- return result2 === HASH_UNDEFINED ? undefined2 : result2;
- }
- return hasOwnProperty.call(data, key) ? data[key] : undefined2;
- }
- function hashHas(key) {
- var data = this.__data__;
- return nativeCreate ? data[key] !== undefined2 : hasOwnProperty.call(data, key);
- }
- function hashSet(key, value) {
- var data = this.__data__;
- this.size += this.has(key) ? 0 : 1;
- data[key] = nativeCreate && value === undefined2 ? HASH_UNDEFINED : value;
- return this;
- }
- Hash.prototype.clear = hashClear;
- Hash.prototype["delete"] = hashDelete;
- Hash.prototype.get = hashGet;
- Hash.prototype.has = hashHas;
- Hash.prototype.set = hashSet;
- function ListCache(entries) {
- var index = -1, length = entries == null ? 0 : entries.length;
- this.clear();
- while (++index < length) {
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
- }
- function listCacheClear() {
- this.__data__ = [];
- this.size = 0;
- }
- function listCacheDelete(key) {
- var data = this.__data__, index = assocIndexOf(data, key);
- if (index < 0) {
- return false;
- }
- var lastIndex = data.length - 1;
- if (index == lastIndex) {
- data.pop();
- } else {
- splice.call(data, index, 1);
- }
- --this.size;
- return true;
- }
- function listCacheGet(key) {
- var data = this.__data__, index = assocIndexOf(data, key);
- return index < 0 ? undefined2 : data[index][1];
- }
- function listCacheHas(key) {
- return assocIndexOf(this.__data__, key) > -1;
- }
- function listCacheSet(key, value) {
- var data = this.__data__, index = assocIndexOf(data, key);
- if (index < 0) {
- ++this.size;
- data.push([key, value]);
- } else {
- data[index][1] = value;
- }
- return this;
- }
- ListCache.prototype.clear = listCacheClear;
- ListCache.prototype["delete"] = listCacheDelete;
- ListCache.prototype.get = listCacheGet;
- ListCache.prototype.has = listCacheHas;
- ListCache.prototype.set = listCacheSet;
- function MapCache(entries) {
- var index = -1, length = entries == null ? 0 : entries.length;
- this.clear();
- while (++index < length) {
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
- }
- function mapCacheClear() {
- this.size = 0;
- this.__data__ = {
- "hash": new Hash(),
- "map": new (Map2 || ListCache)(),
- "string": new Hash()
- };
- }
- function mapCacheDelete(key) {
- var result2 = getMapData(this, key)["delete"](key);
- this.size -= result2 ? 1 : 0;
- return result2;
- }
- function mapCacheGet(key) {
- return getMapData(this, key).get(key);
- }
- function mapCacheHas(key) {
- return getMapData(this, key).has(key);
- }
- function mapCacheSet(key, value) {
- var data = getMapData(this, key), size2 = data.size;
- data.set(key, value);
- this.size += data.size == size2 ? 0 : 1;
- return this;
- }
- MapCache.prototype.clear = mapCacheClear;
- MapCache.prototype["delete"] = mapCacheDelete;
- MapCache.prototype.get = mapCacheGet;
- MapCache.prototype.has = mapCacheHas;
- MapCache.prototype.set = mapCacheSet;
- function SetCache(values2) {
- var index = -1, length = values2 == null ? 0 : values2.length;
- this.__data__ = new MapCache();
- while (++index < length) {
- this.add(values2[index]);
- }
- }
- function setCacheAdd(value) {
- this.__data__.set(value, HASH_UNDEFINED);
- return this;
- }
- function setCacheHas(value) {
- return this.__data__.has(value);
- }
- SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
- SetCache.prototype.has = setCacheHas;
- function Stack(entries) {
- var data = this.__data__ = new ListCache(entries);
- this.size = data.size;
- }
- function stackClear() {
- this.__data__ = new ListCache();
- this.size = 0;
- }
- function stackDelete(key) {
- var data = this.__data__, result2 = data["delete"](key);
- this.size = data.size;
- return result2;
- }
- function stackGet(key) {
- return this.__data__.get(key);
- }
- function stackHas(key) {
- return this.__data__.has(key);
- }
- function stackSet(key, value) {
- var data = this.__data__;
- if (data instanceof ListCache) {
- var pairs = data.__data__;
- if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
- pairs.push([key, value]);
- this.size = ++data.size;
- return this;
- }
- data = this.__data__ = new MapCache(pairs);
- }
- data.set(key, value);
- this.size = data.size;
- return this;
- }
- Stack.prototype.clear = stackClear;
- Stack.prototype["delete"] = stackDelete;
- Stack.prototype.get = stackGet;
- Stack.prototype.has = stackHas;
- Stack.prototype.set = stackSet;
- function arrayLikeKeys(value, inherited) {
- var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes(value.length, String2) : [], length = result2.length;
- for (var key in value) {
- if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
- (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
- isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
- isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
- isIndex(key, length)))) {
- result2.push(key);
- }
- }
- return result2;
- }
- function arraySample(array) {
- var length = array.length;
- return length ? array[baseRandom(0, length - 1)] : undefined2;
- }
- function arraySampleSize(array, n) {
- return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
- }
- function arrayShuffle(array) {
- return shuffleSelf(copyArray(array));
- }
- function assignMergeValue(object, key, value) {
- if (value !== undefined2 && !eq(object[key], value) || value === undefined2 && !(key in object)) {
- baseAssignValue(object, key, value);
- }
- }
- function assignValue(object, key, value) {
- var objValue = object[key];
- if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || value === undefined2 && !(key in object)) {
- baseAssignValue(object, key, value);
- }
- }
- function assocIndexOf(array, key) {
- var length = array.length;
- while (length--) {
- if (eq(array[length][0], key)) {
- return length;
- }
- }
- return -1;
- }
- function baseAggregator(collection, setter, iteratee2, accumulator) {
- baseEach(collection, function(value, key, collection2) {
- setter(accumulator, value, iteratee2(value), collection2);
- });
- return accumulator;
- }
- function baseAssign(object, source) {
- return object && copyObject(source, keys(source), object);
- }
- function baseAssignIn(object, source) {
- return object && copyObject(source, keysIn(source), object);
- }
- function baseAssignValue(object, key, value) {
- if (key == "__proto__" && defineProperty) {
- defineProperty(object, key, {
- "configurable": true,
- "enumerable": true,
- "value": value,
- "writable": true
- });
- } else {
- object[key] = value;
- }
- }
- function baseAt(object, paths) {
- var index = -1, length = paths.length, result2 = Array2(length), skip = object == null;
- while (++index < length) {
- result2[index] = skip ? undefined2 : get(object, paths[index]);
- }
- return result2;
- }
- function baseClamp(number, lower, upper) {
- if (number === number) {
- if (upper !== undefined2) {
- number = number <= upper ? number : upper;
- }
- if (lower !== undefined2) {
- number = number >= lower ? number : lower;
- }
- }
- return number;
- }
- function baseClone(value, bitmask, customizer, key, object, stack) {
- var result2, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG;
- if (customizer) {
- result2 = object ? customizer(value, key, object, stack) : customizer(value);
- }
- if (result2 !== undefined2) {
- return result2;
- }
- if (!isObject(value)) {
- return value;
- }
- var isArr = isArray(value);
- if (isArr) {
- result2 = initCloneArray(value);
- if (!isDeep) {
- return copyArray(value, result2);
- }
- } else {
- var tag = getTag(value), isFunc = tag == funcTag || tag == genTag;
- if (isBuffer(value)) {
- return cloneBuffer(value, isDeep);
- }
- if (tag == objectTag || tag == argsTag || isFunc && !object) {
- result2 = isFlat || isFunc ? {} : initCloneObject(value);
- if (!isDeep) {
- return isFlat ? copySymbolsIn(value, baseAssignIn(result2, value)) : copySymbols(value, baseAssign(result2, value));
- }
- } else {
- if (!cloneableTags[tag]) {
- return object ? value : {};
- }
- result2 = initCloneByTag(value, tag, isDeep);
- }
- }
- stack || (stack = new Stack());
- var stacked = stack.get(value);
- if (stacked) {
- return stacked;
- }
- stack.set(value, result2);
- if (isSet(value)) {
- value.forEach(function(subValue) {
- result2.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
- });
- } else if (isMap(value)) {
- value.forEach(function(subValue, key2) {
- result2.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
- });
- }
- var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
- var props = isArr ? undefined2 : keysFunc(value);
- arrayEach(props || value, function(subValue, key2) {
- if (props) {
- key2 = subValue;
- subValue = value[key2];
- }
- assignValue(result2, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
- });
- return result2;
- }
- function baseConforms(source) {
- var props = keys(source);
- return function(object) {
- return baseConformsTo(object, source, props);
- };
- }
- function baseConformsTo(object, source, props) {
- var length = props.length;
- if (object == null) {
- return !length;
- }
- object = Object2(object);
- while (length--) {
- var key = props[length], predicate = source[key], value = object[key];
- if (value === undefined2 && !(key in object) || !predicate(value)) {
- return false;
- }
- }
- return true;
- }
- function baseDelay(func, wait, args) {
- if (typeof func != "function") {
- throw new TypeError2(FUNC_ERROR_TEXT);
- }
- return setTimeout2(function() {
- func.apply(undefined2, args);
- }, wait);
- }
- function baseDifference(array, values2, iteratee2, comparator) {
- var index = -1, includes2 = arrayIncludes, isCommon = true, length = array.length, result2 = [], valuesLength = values2.length;
- if (!length) {
- return result2;
- }
- if (iteratee2) {
- values2 = arrayMap(values2, baseUnary(iteratee2));
- }
- if (comparator) {
- includes2 = arrayIncludesWith;
- isCommon = false;
- } else if (values2.length >= LARGE_ARRAY_SIZE) {
- includes2 = cacheHas;
- isCommon = false;
- values2 = new SetCache(values2);
- }
- outer:
- while (++index < length) {
- var value = array[index], computed = iteratee2 == null ? value : iteratee2(value);
- value = comparator || value !== 0 ? value : 0;
- if (isCommon && computed === computed) {
- var valuesIndex = valuesLength;
- while (valuesIndex--) {
- if (values2[valuesIndex] === computed) {
- continue outer;
- }
- }
- result2.push(value);
- } else if (!includes2(values2, computed, comparator)) {
- result2.push(value);
- }
- }
- return result2;
- }
- var baseEach = createBaseEach(baseForOwn);
- var baseEachRight = createBaseEach(baseForOwnRight, true);
- function baseEvery(collection, predicate) {
- var result2 = true;
- baseEach(collection, function(value, index, collection2) {
- result2 = !!predicate(value, index, collection2);
- return result2;
- });
- return result2;
- }
- function baseExtremum(array, iteratee2, comparator) {
- var index = -1, length = array.length;
- while (++index < length) {
- var value = array[index], current = iteratee2(value);
- if (current != null && (computed === undefined2 ? current === current && !isSymbol(current) : comparator(current, computed))) {
- var computed = current, result2 = value;
- }
- }
- return result2;
- }
- function baseFill(array, value, start, end) {
- var length = array.length;
- start = toInteger(start);
- if (start < 0) {
- start = -start > length ? 0 : length + start;
- }
- end = end === undefined2 || end > length ? length : toInteger(end);
- if (end < 0) {
- end += length;
- }
- end = start > end ? 0 : toLength(end);
- while (start < end) {
- array[start++] = value;
- }
- return array;
- }
- function baseFilter(collection, predicate) {
- var result2 = [];
- baseEach(collection, function(value, index, collection2) {
- if (predicate(value, index, collection2)) {
- result2.push(value);
- }
- });
- return result2;
- }
- function baseFlatten(array, depth, predicate, isStrict, result2) {
- var index = -1, length = array.length;
- predicate || (predicate = isFlattenable);
- result2 || (result2 = []);
- while (++index < length) {
- var value = array[index];
- if (depth > 0 && predicate(value)) {
- if (depth > 1) {
- baseFlatten(value, depth - 1, predicate, isStrict, result2);
- } else {
- arrayPush(result2, value);
- }
- } else if (!isStrict) {
- result2[result2.length] = value;
- }
- }
- return result2;
- }
- var baseFor = createBaseFor();
- var baseForRight = createBaseFor(true);
- function baseForOwn(object, iteratee2) {
- return object && baseFor(object, iteratee2, keys);
- }
- function baseForOwnRight(object, iteratee2) {
- return object && baseForRight(object, iteratee2, keys);
- }
- function baseFunctions(object, props) {
- return arrayFilter(props, function(key) {
- return isFunction(object[key]);
- });
- }
- function baseGet(object, path) {
- path = castPath(path, object);
- var index = 0, length = path.length;
- while (object != null && index < length) {
- object = object[toKey(path[index++])];
- }
- return index && index == length ? object : undefined2;
- }
- function baseGetAllKeys(object, keysFunc, symbolsFunc) {
- var result2 = keysFunc(object);
- return isArray(object) ? result2 : arrayPush(result2, symbolsFunc(object));
- }
- function baseGetTag(value) {
- if (value == null) {
- return value === undefined2 ? undefinedTag : nullTag;
- }
- return symToStringTag && symToStringTag in Object2(value) ? getRawTag(value) : objectToString(value);
- }
- function baseGt(value, other) {
- return value > other;
- }
- function baseHas(object, key) {
- return object != null && hasOwnProperty.call(object, key);
- }
- function baseHasIn(object, key) {
- return object != null && key in Object2(object);
- }
- function baseInRange(number, start, end) {
- return number >= nativeMin(start, end) && number < nativeMax(start, end);
- }
- function baseIntersection(arrays, iteratee2, comparator) {
- var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array2(othLength), maxLength = Infinity, result2 = [];
- while (othIndex--) {
- var array = arrays[othIndex];
- if (othIndex && iteratee2) {
- array = arrayMap(array, baseUnary(iteratee2));
- }
- maxLength = nativeMin(array.length, maxLength);
- caches[othIndex] = !comparator && (iteratee2 || length >= 120 && array.length >= 120) ? new SetCache(othIndex && array) : undefined2;
- }
- array = arrays[0];
- var index = -1, seen = caches[0];
- outer:
- while (++index < length && result2.length < maxLength) {
- var value = array[index], computed = iteratee2 ? iteratee2(value) : value;
- value = comparator || value !== 0 ? value : 0;
- if (!(seen ? cacheHas(seen, computed) : includes2(result2, computed, comparator))) {
- othIndex = othLength;
- while (--othIndex) {
- var cache = caches[othIndex];
- if (!(cache ? cacheHas(cache, computed) : includes2(arrays[othIndex], computed, comparator))) {
- continue outer;
- }
- }
- if (seen) {
- seen.push(computed);
- }
- result2.push(value);
- }
- }
- return result2;
- }
- function baseInverter(object, setter, iteratee2, accumulator) {
- baseForOwn(object, function(value, key, object2) {
- setter(accumulator, iteratee2(value), key, object2);
- });
- return accumulator;
- }
- function baseInvoke(object, path, args) {
- path = castPath(path, object);
- object = parent(object, path);
- var func = object == null ? object : object[toKey(last(path))];
- return func == null ? undefined2 : apply(func, object, args);
- }
- function baseIsArguments(value) {
- return isObjectLike(value) && baseGetTag(value) == argsTag;
- }
- function baseIsArrayBuffer(value) {
- return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
- }
- function baseIsDate(value) {
- return isObjectLike(value) && baseGetTag(value) == dateTag;
- }
- function baseIsEqual(value, other, bitmask, customizer, stack) {
- if (value === other) {
- return true;
- }
- if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
- return value !== value && other !== other;
- }
- return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
- }
- function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
- var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other);
- objTag = objTag == argsTag ? objectTag : objTag;
- othTag = othTag == argsTag ? objectTag : othTag;
- var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
- if (isSameTag && isBuffer(object)) {
- if (!isBuffer(other)) {
- return false;
- }
- objIsArr = true;
- objIsObj = false;
- }
- if (isSameTag && !objIsObj) {
- stack || (stack = new Stack());
- return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
- }
- if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
- var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
- if (objIsWrapped || othIsWrapped) {
- var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
- stack || (stack = new Stack());
- return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
- }
- }
- if (!isSameTag) {
- return false;
- }
- stack || (stack = new Stack());
- return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
- }
- function baseIsMap(value) {
- return isObjectLike(value) && getTag(value) == mapTag;
- }
- function baseIsMatch(object, source, matchData, customizer) {
- var index = matchData.length, length = index, noCustomizer = !customizer;
- if (object == null) {
- return !length;
- }
- object = Object2(object);
- while (index--) {
- var data = matchData[index];
- if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
- return false;
- }
- }
- while (++index < length) {
- data = matchData[index];
- var key = data[0], objValue = object[key], srcValue = data[1];
- if (noCustomizer && data[2]) {
- if (objValue === undefined2 && !(key in object)) {
- return false;
- }
- } else {
- var stack = new Stack();
- if (customizer) {
- var result2 = customizer(objValue, srcValue, key, object, source, stack);
- }
- if (!(result2 === undefined2 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) : result2)) {
- return false;
- }
- }
- }
- return true;
- }
- function baseIsNative(value) {
- if (!isObject(value) || isMasked(value)) {
- return false;
- }
- var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
- return pattern.test(toSource(value));
- }
- function baseIsRegExp(value) {
- return isObjectLike(value) && baseGetTag(value) == regexpTag;
- }
- function baseIsSet(value) {
- return isObjectLike(value) && getTag(value) == setTag;
- }
- function baseIsTypedArray(value) {
- return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
- }
- function baseIteratee(value) {
- if (typeof value == "function") {
- return value;
- }
- if (value == null) {
- return identity;
- }
- if (typeof value == "object") {
- return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
- }
- return property(value);
- }
- function baseKeys(object) {
- if (!isPrototype(object)) {
- return nativeKeys(object);
- }
- var result2 = [];
- for (var key in Object2(object)) {
- if (hasOwnProperty.call(object, key) && key != "constructor") {
- result2.push(key);
- }
- }
- return result2;
- }
- function baseKeysIn(object) {
- if (!isObject(object)) {
- return nativeKeysIn(object);
- }
- var isProto = isPrototype(object), result2 = [];
- for (var key in object) {
- if (!(key == "constructor" && (isProto || !hasOwnProperty.call(object, key)))) {
- result2.push(key);
- }
- }
- return result2;
- }
- function baseLt(value, other) {
- return value < other;
- }
- function baseMap(collection, iteratee2) {
- var index = -1, result2 = isArrayLike(collection) ? Array2(collection.length) : [];
- baseEach(collection, function(value, key, collection2) {
- result2[++index] = iteratee2(value, key, collection2);
- });
- return result2;
- }
- function baseMatches(source) {
- var matchData = getMatchData(source);
- if (matchData.length == 1 && matchData[0][2]) {
- return matchesStrictComparable(matchData[0][0], matchData[0][1]);
- }
- return function(object) {
- return object === source || baseIsMatch(object, source, matchData);
- };
- }
- function baseMatchesProperty(path, srcValue) {
- if (isKey(path) && isStrictComparable(srcValue)) {
- return matchesStrictComparable(toKey(path), srcValue);
- }
- return function(object) {
- var objValue = get(object, path);
- return objValue === undefined2 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
- };
- }
- function baseMerge(object, source, srcIndex, customizer, stack) {
- if (object === source) {
- return;
- }
- baseFor(source, function(srcValue, key) {
- stack || (stack = new Stack());
- if (isObject(srcValue)) {
- baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
- } else {
- var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : undefined2;
- if (newValue === undefined2) {
- newValue = srcValue;
- }
- assignMergeValue(object, key, newValue);
- }
- }, keysIn);
- }
- function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
- var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
- if (stacked) {
- assignMergeValue(object, key, stacked);
- return;
- }
- var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : undefined2;
- var isCommon = newValue === undefined2;
- if (isCommon) {
- var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
- newValue = srcValue;
- if (isArr || isBuff || isTyped) {
- if (isArray(objValue)) {
- newValue = objValue;
- } else if (isArrayLikeObject(objValue)) {
- newValue = copyArray(objValue);
- } else if (isBuff) {
- isCommon = false;
- newValue = cloneBuffer(srcValue, true);
- } else if (isTyped) {
- isCommon = false;
- newValue = cloneTypedArray(srcValue, true);
- } else {
- newValue = [];
- }
- } else if (isPlainObject(srcValue) || isArguments(srcValue)) {
- newValue = objValue;
- if (isArguments(objValue)) {
- newValue = toPlainObject(objValue);
- } else if (!isObject(objValue) || isFunction(objValue)) {
- newValue = initCloneObject(srcValue);
- }
- } else {
- isCommon = false;
- }
- }
- if (isCommon) {
- stack.set(srcValue, newValue);
- mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
- stack["delete"](srcValue);
- }
- assignMergeValue(object, key, newValue);
- }
- function baseNth(array, n) {
- var length = array.length;
- if (!length) {
- return;
- }
- n += n < 0 ? length : 0;
- return isIndex(n, length) ? array[n] : undefined2;
- }
- function baseOrderBy(collection, iteratees, orders) {
- if (iteratees.length) {
- iteratees = arrayMap(iteratees, function(iteratee2) {
- if (isArray(iteratee2)) {
- return function(value) {
- return baseGet(value, iteratee2.length === 1 ? iteratee2[0] : iteratee2);
- };
- }
- return iteratee2;
- });
- } else {
- iteratees = [identity];
- }
- var index = -1;
- iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
- var result2 = baseMap(collection, function(value, key, collection2) {
- var criteria = arrayMap(iteratees, function(iteratee2) {
- return iteratee2(value);
- });
- return { "criteria": criteria, "index": ++index, "value": value };
- });
- return baseSortBy(result2, function(object, other) {
- return compareMultiple(object, other, orders);
- });
- }
- function basePick(object, paths) {
- return basePickBy(object, paths, function(value, path) {
- return hasIn(object, path);
- });
- }
- function basePickBy(object, paths, predicate) {
- var index = -1, length = paths.length, result2 = {};
- while (++index < length) {
- var path = paths[index], value = baseGet(object, path);
- if (predicate(value, path)) {
- baseSet(result2, castPath(path, object), value);
- }
- }
- return result2;
- }
- function basePropertyDeep(path) {
- return function(object) {
- return baseGet(object, path);
- };
- }
- function basePullAll(array, values2, iteratee2, comparator) {
- var indexOf2 = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values2.length, seen = array;
- if (array === values2) {
- values2 = copyArray(values2);
- }
- if (iteratee2) {
- seen = arrayMap(array, baseUnary(iteratee2));
- }
- while (++index < length) {
- var fromIndex = 0, value = values2[index], computed = iteratee2 ? iteratee2(value) : value;
- while ((fromIndex = indexOf2(seen, computed, fromIndex, comparator)) > -1) {
- if (seen !== array) {
- splice.call(seen, fromIndex, 1);
- }
- splice.call(array, fromIndex, 1);
- }
- }
- return array;
- }
- function basePullAt(array, indexes) {
- var length = array ? indexes.length : 0, lastIndex = length - 1;
- while (length--) {
- var index = indexes[length];
- if (length == lastIndex || index !== previous) {
- var previous = index;
- if (isIndex(index)) {
- splice.call(array, index, 1);
- } else {
- baseUnset(array, index);
- }
- }
- }
- return array;
- }
- function baseRandom(lower, upper) {
- return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
- }
- function baseRange(start, end, step, fromRight) {
- var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result2 = Array2(length);
- while (length--) {
- result2[fromRight ? length : ++index] = start;
- start += step;
- }
- return result2;
- }
- function baseRepeat(string, n) {
- var result2 = "";
- if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
- return result2;
- }
- do {
- if (n % 2) {
- result2 += string;
- }
- n = nativeFloor(n / 2);
- if (n) {
- string += string;
- }
- } while (n);
- return result2;
- }
- function baseRest(func, start) {
- return setToString(overRest(func, start, identity), func + "");
- }
- function baseSample(collection) {
- return arraySample(values(collection));
- }
- function baseSampleSize(collection, n) {
- var array = values(collection);
- return shuffleSelf(array, baseClamp(n, 0, array.length));
- }
- function baseSet(object, path, value, customizer) {
- if (!isObject(object)) {
- return object;
- }
- path = castPath(path, object);
- var index = -1, length = path.length, lastIndex = length - 1, nested = object;
- while (nested != null && ++index < length) {
- var key = toKey(path[index]), newValue = value;
- if (key === "__proto__" || key === "constructor" || key === "prototype") {
- return object;
- }
- if (index != lastIndex) {
- var objValue = nested[key];
- newValue = customizer ? customizer(objValue, key, nested) : undefined2;
- if (newValue === undefined2) {
- newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
- }
- }
- assignValue(nested, key, newValue);
- nested = nested[key];
- }
- return object;
- }
- var baseSetData = !metaMap ? identity : function(func, data) {
- metaMap.set(func, data);
- return func;
- };
- var baseSetToString = !defineProperty ? identity : function(func, string) {
- return defineProperty(func, "toString", {
- "configurable": true,
- "enumerable": false,
- "value": constant(string),
- "writable": true
- });
- };
- function baseShuffle(collection) {
- return shuffleSelf(values(collection));
- }
- function baseSlice(array, start, end) {
- var index = -1, length = array.length;
- if (start < 0) {
- start = -start > length ? 0 : length + start;
- }
- end = end > length ? length : end;
- if (end < 0) {
- end += length;
- }
- length = start > end ? 0 : end - start >>> 0;
- start >>>= 0;
- var result2 = Array2(length);
- while (++index < length) {
- result2[index] = array[index + start];
- }
- return result2;
- }
- function baseSome(collection, predicate) {
- var result2;
- baseEach(collection, function(value, index, collection2) {
- result2 = predicate(value, index, collection2);
- return !result2;
- });
- return !!result2;
- }
- function baseSortedIndex(array, value, retHighest) {
- var low = 0, high = array == null ? low : array.length;
- if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
- while (low < high) {
- var mid = low + high >>> 1, computed = array[mid];
- if (computed !== null && !isSymbol(computed) && (retHighest ? computed <= value : computed < value)) {
- low = mid + 1;
- } else {
- high = mid;
- }
- }
- return high;
- }
- return baseSortedIndexBy(array, value, identity, retHighest);
- }
- function baseSortedIndexBy(array, value, iteratee2, retHighest) {
- var low = 0, high = array == null ? 0 : array.length;
- if (high === 0) {
- return 0;
- }
- value = iteratee2(value);
- var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol(value), valIsUndefined = value === undefined2;
- while (low < high) {
- var mid = nativeFloor((low + high) / 2), computed = iteratee2(array[mid]), othIsDefined = computed !== undefined2, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol(computed);
- if (valIsNaN) {
- var setLow = retHighest || othIsReflexive;
- } else if (valIsUndefined) {
- setLow = othIsReflexive && (retHighest || othIsDefined);
- } else if (valIsNull) {
- setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
- } else if (valIsSymbol) {
- setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
- } else if (othIsNull || othIsSymbol) {
- setLow = false;
- } else {
- setLow = retHighest ? computed <= value : computed < value;
- }
- if (setLow) {
- low = mid + 1;
- } else {
- high = mid;
- }
- }
- return nativeMin(high, MAX_ARRAY_INDEX);
- }
- function baseSortedUniq(array, iteratee2) {
- var index = -1, length = array.length, resIndex = 0, result2 = [];
- while (++index < length) {
- var value = array[index], computed = iteratee2 ? iteratee2(value) : value;
- if (!index || !eq(computed, seen)) {
- var seen = computed;
- result2[resIndex++] = value === 0 ? 0 : value;
- }
- }
- return result2;
- }
- function baseToNumber(value) {
- if (typeof value == "number") {
- return value;
- }
- if (isSymbol(value)) {
- return NAN;
- }
- return +value;
- }
- function baseToString(value) {
- if (typeof value == "string") {
- return value;
- }
- if (isArray(value)) {
- return arrayMap(value, baseToString) + "";
- }
- if (isSymbol(value)) {
- return symbolToString ? symbolToString.call(value) : "";
- }
- var result2 = value + "";
- return result2 == "0" && 1 / value == -INFINITY ? "-0" : result2;
- }
- function baseUniq(array, iteratee2, comparator) {
- var index = -1, includes2 = arrayIncludes, length = array.length, isCommon = true, result2 = [], seen = result2;
- if (comparator) {
- isCommon = false;
- includes2 = arrayIncludesWith;
- } else if (length >= LARGE_ARRAY_SIZE) {
- var set2 = iteratee2 ? null : createSet(array);
- if (set2) {
- return setToArray(set2);
- }
- isCommon = false;
- includes2 = cacheHas;
- seen = new SetCache();
- } else {
- seen = iteratee2 ? [] : result2;
- }
- outer:
- while (++index < length) {
- var value = array[index], computed = iteratee2 ? iteratee2(value) : value;
- value = comparator || value !== 0 ? value : 0;
- if (isCommon && computed === computed) {
- var seenIndex = seen.length;
- while (seenIndex--) {
- if (seen[seenIndex] === computed) {
- continue outer;
- }
- }
- if (iteratee2) {
- seen.push(computed);
- }
- result2.push(value);
- } else if (!includes2(seen, computed, comparator)) {
- if (seen !== result2) {
- seen.push(computed);
- }
- result2.push(value);
- }
- }
- return result2;
- }
- function baseUnset(object, path) {
- path = castPath(path, object);
- object = parent(object, path);
- return object == null || delete object[toKey(last(path))];
- }
- function baseUpdate(object, path, updater, customizer) {
- return baseSet(object, path, updater(baseGet(object, path)), customizer);
- }
- function baseWhile(array, predicate, isDrop, fromRight) {
- var length = array.length, index = fromRight ? length : -1;
- while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {
- }
- return isDrop ? baseSlice(array, fromRight ? 0 : index, fromRight ? index + 1 : length) : baseSlice(array, fromRight ? index + 1 : 0, fromRight ? length : index);
- }
- function baseWrapperValue(value, actions) {
- var result2 = value;
- if (result2 instanceof LazyWrapper) {
- result2 = result2.value();
- }
- return arrayReduce(actions, function(result3, action) {
- return action.func.apply(action.thisArg, arrayPush([result3], action.args));
- }, result2);
- }
- function baseXor(arrays, iteratee2, comparator) {
- var length = arrays.length;
- if (length < 2) {
- return length ? baseUniq(arrays[0]) : [];
- }
- var index = -1, result2 = Array2(length);
- while (++index < length) {
- var array = arrays[index], othIndex = -1;
- while (++othIndex < length) {
- if (othIndex != index) {
- result2[index] = baseDifference(result2[index] || array, arrays[othIndex], iteratee2, comparator);
- }
- }
- }
- return baseUniq(baseFlatten(result2, 1), iteratee2, comparator);
- }
- function baseZipObject(props, values2, assignFunc) {
- var index = -1, length = props.length, valsLength = values2.length, result2 = {};
- while (++index < length) {
- var value = index < valsLength ? values2[index] : undefined2;
- assignFunc(result2, props[index], value);
- }
- return result2;
- }
- function castArrayLikeObject(value) {
- return isArrayLikeObject(value) ? value : [];
- }
- function castFunction(value) {
- return typeof value == "function" ? value : identity;
- }
- function castPath(value, object) {
- if (isArray(value)) {
- return value;
- }
- return isKey(value, object) ? [value] : stringToPath(toString(value));
- }
- var castRest = baseRest;
- function castSlice(array, start, end) {
- var length = array.length;
- end = end === undefined2 ? length : end;
- return !start && end >= length ? array : baseSlice(array, start, end);
- }
- var clearTimeout2 = ctxClearTimeout || function(id) {
- return root.clearTimeout(id);
- };
- function cloneBuffer(buffer, isDeep) {
- if (isDeep) {
- return buffer.slice();
- }
- var length = buffer.length, result2 = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
- buffer.copy(result2);
- return result2;
- }
- function cloneArrayBuffer(arrayBuffer) {
- var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength);
- new Uint8Array2(result2).set(new Uint8Array2(arrayBuffer));
- return result2;
- }
- function cloneDataView(dataView, isDeep) {
- var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
- return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
- }
- function cloneRegExp(regexp) {
- var result2 = new regexp.constructor(regexp.source, reFlags.exec(regexp));
- result2.lastIndex = regexp.lastIndex;
- return result2;
- }
- function cloneSymbol(symbol) {
- return symbolValueOf ? Object2(symbolValueOf.call(symbol)) : {};
- }
- function cloneTypedArray(typedArray, isDeep) {
- var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
- return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
- }
- function compareAscending(value, other) {
- if (value !== other) {
- var valIsDefined = value !== undefined2, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol(value);
- var othIsDefined = other !== undefined2, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol(other);
- if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
- return 1;
- }
- if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
- return -1;
- }
- }
- return 0;
- }
- function compareMultiple(object, other, orders) {
- var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length;
- while (++index < length) {
- var result2 = compareAscending(objCriteria[index], othCriteria[index]);
- if (result2) {
- if (index >= ordersLength) {
- return result2;
- }
- var order = orders[index];
- return result2 * (order == "desc" ? -1 : 1);
- }
- }
- return object.index - other.index;
- }
- function composeArgs(args, partials, holders, isCurried) {
- var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result2 = Array2(leftLength + rangeLength), isUncurried = !isCurried;
- while (++leftIndex < leftLength) {
- result2[leftIndex] = partials[leftIndex];
- }
- while (++argsIndex < holdersLength) {
- if (isUncurried || argsIndex < argsLength) {
- result2[holders[argsIndex]] = args[argsIndex];
- }
- }
- while (rangeLength--) {
- result2[leftIndex++] = args[argsIndex++];
- }
- return result2;
- }
- function composeArgsRight(args, partials, holders, isCurried) {
- var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result2 = Array2(rangeLength + rightLength), isUncurried = !isCurried;
- while (++argsIndex < rangeLength) {
- result2[argsIndex] = args[argsIndex];
- }
- var offset = argsIndex;
- while (++rightIndex < rightLength) {
- result2[offset + rightIndex] = partials[rightIndex];
- }
- while (++holdersIndex < holdersLength) {
- if (isUncurried || argsIndex < argsLength) {
- result2[offset + holders[holdersIndex]] = args[argsIndex++];
- }
- }
- return result2;
- }
- function copyArray(source, array) {
- var index = -1, length = source.length;
- array || (array = Array2(length));
- while (++index < length) {
- array[index] = source[index];
- }
- return array;
- }
- function copyObject(source, props, object, customizer) {
- var isNew = !object;
- object || (object = {});
- var index = -1, length = props.length;
- while (++index < length) {
- var key = props[index];
- var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined2;
- if (newValue === undefined2) {
- newValue = source[key];
- }
- if (isNew) {
- baseAssignValue(object, key, newValue);
- } else {
- assignValue(object, key, newValue);
- }
- }
- return object;
- }
- function copySymbols(source, object) {
- return copyObject(source, getSymbols(source), object);
- }
- function copySymbolsIn(source, object) {
- return copyObject(source, getSymbolsIn(source), object);
- }
- function createAggregator(setter, initializer) {
- return function(collection, iteratee2) {
- var func = isArray(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
- return func(collection, setter, getIteratee(iteratee2, 2), accumulator);
- };
- }
- function createAssigner(assigner) {
- return baseRest(function(object, sources) {
- var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined2, guard = length > 2 ? sources[2] : undefined2;
- customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : undefined2;
- if (guard && isIterateeCall(sources[0], sources[1], guard)) {
- customizer = length < 3 ? undefined2 : customizer;
- length = 1;
- }
- object = Object2(object);
- while (++index < length) {
- var source = sources[index];
- if (source) {
- assigner(object, source, index, customizer);
- }
- }
- return object;
- });
- }
- function createBaseEach(eachFunc, fromRight) {
- return function(collection, iteratee2) {
- if (collection == null) {
- return collection;
- }
- if (!isArrayLike(collection)) {
- return eachFunc(collection, iteratee2);
- }
- var length = collection.length, index = fromRight ? length : -1, iterable = Object2(collection);
- while (fromRight ? index-- : ++index < length) {
- if (iteratee2(iterable[index], index, iterable) === false) {
- break;
- }
- }
- return collection;
- };
- }
- function createBaseFor(fromRight) {
- return function(object, iteratee2, keysFunc) {
- var index = -1, iterable = Object2(object), props = keysFunc(object), length = props.length;
- while (length--) {
- var key = props[fromRight ? length : ++index];
- if (iteratee2(iterable[key], key, iterable) === false) {
- break;
- }
- }
- return object;
- };
- }
- function createBind(func, bitmask, thisArg) {
- var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
- function wrapper() {
- var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
- return fn.apply(isBind ? thisArg : this, arguments);
- }
- return wrapper;
- }
- function createCaseFirst(methodName) {
- return function(string) {
- string = toString(string);
- var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined2;
- var chr = strSymbols ? strSymbols[0] : string.charAt(0);
- var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1);
- return chr[methodName]() + trailing;
- };
- }
- function createCompounder(callback) {
- return function(string) {
- return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
- };
- }
- function createCtor(Ctor) {
- return function() {
- var args = arguments;
- switch (args.length) {
- case 0:
- return new Ctor();
- case 1:
- return new Ctor(args[0]);
- case 2:
- return new Ctor(args[0], args[1]);
- case 3:
- return new Ctor(args[0], args[1], args[2]);
- case 4:
- return new Ctor(args[0], args[1], args[2], args[3]);
- case 5:
- return new Ctor(args[0], args[1], args[2], args[3], args[4]);
- case 6:
- return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
- case 7:
- return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
- }
- var thisBinding = baseCreate(Ctor.prototype), result2 = Ctor.apply(thisBinding, args);
- return isObject(result2) ? result2 : thisBinding;
- };
- }
- function createCurry(func, bitmask, arity) {
- var Ctor = createCtor(func);
- function wrapper() {
- var length = arguments.length, args = Array2(length), index = length, placeholder = getHolder(wrapper);
- while (index--) {
- args[index] = arguments[index];
- }
- var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
- length -= holders.length;
- if (length < arity) {
- return createRecurry(
- func,
- bitmask,
- createHybrid,
- wrapper.placeholder,
- undefined2,
- args,
- holders,
- undefined2,
- undefined2,
- arity - length
- );
- }
- var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
- return apply(fn, this, args);
- }
- return wrapper;
- }
- function createFind(findIndexFunc) {
- return function(collection, predicate, fromIndex) {
- var iterable = Object2(collection);
- if (!isArrayLike(collection)) {
- var iteratee2 = getIteratee(predicate, 3);
- collection = keys(collection);
- predicate = function(key) {
- return iteratee2(iterable[key], key, iterable);
- };
- }
- var index = findIndexFunc(collection, predicate, fromIndex);
- return index > -1 ? iterable[iteratee2 ? collection[index] : index] : undefined2;
- };
- }
- function createFlow(fromRight) {
- return flatRest(function(funcs) {
- var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru;
- if (fromRight) {
- funcs.reverse();
- }
- while (index--) {
- var func = funcs[index];
- if (typeof func != "function") {
- throw new TypeError2(FUNC_ERROR_TEXT);
- }
- if (prereq && !wrapper && getFuncName(func) == "wrapper") {
- var wrapper = new LodashWrapper([], true);
- }
- }
- index = wrapper ? index : length;
- while (++index < length) {
- func = funcs[index];
- var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : undefined2;
- if (data && isLaziable(data[0]) && data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && !data[4].length && data[9] == 1) {
- wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
- } else {
- wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
- }
- }
- return function() {
- var args = arguments, value = args[0];
- if (wrapper && args.length == 1 && isArray(value)) {
- return wrapper.plant(value).value();
- }
- var index2 = 0, result2 = length ? funcs[index2].apply(this, args) : value;
- while (++index2 < length) {
- result2 = funcs[index2].call(this, result2);
- }
- return result2;
- };
- });
- }
- function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, arity) {
- var isAry = bitmask & WRAP_ARY_FLAG, isBind = bitmask & WRAP_BIND_FLAG, isBindKey = bitmask & WRAP_BIND_KEY_FLAG, isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), isFlip = bitmask & WRAP_FLIP_FLAG, Ctor = isBindKey ? undefined2 : createCtor(func);
- function wrapper() {
- var length = arguments.length, args = Array2(length), index = length;
- while (index--) {
- args[index] = arguments[index];
- }
- if (isCurried) {
- var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder);
- }
- if (partials) {
- args = composeArgs(args, partials, holders, isCurried);
- }
- if (partialsRight) {
- args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
- }
- length -= holdersCount;
- if (isCurried && length < arity) {
- var newHolders = replaceHolders(args, placeholder);
- return createRecurry(
- func,
- bitmask,
- createHybrid,
- wrapper.placeholder,
- thisArg,
- args,
- newHolders,
- argPos,
- ary2,
- arity - length
- );
- }
- var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
- length = args.length;
- if (argPos) {
- args = reorder(args, argPos);
- } else if (isFlip && length > 1) {
- args.reverse();
- }
- if (isAry && ary2 < length) {
- args.length = ary2;
- }
- if (this && this !== root && this instanceof wrapper) {
- fn = Ctor || createCtor(fn);
- }
- return fn.apply(thisBinding, args);
- }
- return wrapper;
- }
- function createInverter(setter, toIteratee) {
- return function(object, iteratee2) {
- return baseInverter(object, setter, toIteratee(iteratee2), {});
- };
- }
- function createMathOperation(operator, defaultValue) {
- return function(value, other) {
- var result2;
- if (value === undefined2 && other === undefined2) {
- return defaultValue;
- }
- if (value !== undefined2) {
- result2 = value;
- }
- if (other !== undefined2) {
- if (result2 === undefined2) {
- return other;
- }
- if (typeof value == "string" || typeof other == "string") {
- value = baseToString(value);
- other = baseToString(other);
- } else {
- value = baseToNumber(value);
- other = baseToNumber(other);
- }
- result2 = operator(value, other);
- }
- return result2;
- };
- }
- function createOver(arrayFunc) {
- return flatRest(function(iteratees) {
- iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
- return baseRest(function(args) {
- var thisArg = this;
- return arrayFunc(iteratees, function(iteratee2) {
- return apply(iteratee2, thisArg, args);
- });
- });
- });
- }
- function createPadding(length, chars) {
- chars = chars === undefined2 ? " " : baseToString(chars);
- var charsLength = chars.length;
- if (charsLength < 2) {
- return charsLength ? baseRepeat(chars, length) : chars;
- }
- var result2 = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
- return hasUnicode(chars) ? castSlice(stringToArray(result2), 0, length).join("") : result2.slice(0, length);
- }
- function createPartial(func, bitmask, thisArg, partials) {
- var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
- function wrapper() {
- var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn = this && this !== root && this instanceof wrapper ? Ctor : func;
- while (++leftIndex < leftLength) {
- args[leftIndex] = partials[leftIndex];
- }
- while (argsLength--) {
- args[leftIndex++] = arguments[++argsIndex];
- }
- return apply(fn, isBind ? thisArg : this, args);
- }
- return wrapper;
- }
- function createRange(fromRight) {
- return function(start, end, step) {
- if (step && typeof step != "number" && isIterateeCall(start, end, step)) {
- end = step = undefined2;
- }
- start = toFinite(start);
- if (end === undefined2) {
- end = start;
- start = 0;
- } else {
- end = toFinite(end);
- }
- step = step === undefined2 ? start < end ? 1 : -1 : toFinite(step);
- return baseRange(start, end, step, fromRight);
- };
- }
- function createRelationalOperation(operator) {
- return function(value, other) {
- if (!(typeof value == "string" && typeof other == "string")) {
- value = toNumber(value);
- other = toNumber(other);
- }
- return operator(value, other);
- };
- }
- function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary2, arity) {
- var isCurry = bitmask & WRAP_CURRY_FLAG, newHolders = isCurry ? holders : undefined2, newHoldersRight = isCurry ? undefined2 : holders, newPartials = isCurry ? partials : undefined2, newPartialsRight = isCurry ? undefined2 : partials;
- bitmask |= isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG;
- bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
- if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
- bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
- }
- var newData = [
- func,
- bitmask,
- thisArg,
- newPartials,
- newHolders,
- newPartialsRight,
- newHoldersRight,
- argPos,
- ary2,
- arity
- ];
- var result2 = wrapFunc.apply(undefined2, newData);
- if (isLaziable(func)) {
- setData(result2, newData);
- }
- result2.placeholder = placeholder;
- return setWrapToString(result2, func, bitmask);
- }
- function createRound(methodName) {
- var func = Math2[methodName];
- return function(number, precision) {
- number = toNumber(number);
- precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
- if (precision && nativeIsFinite(number)) {
- var pair = (toString(number) + "e").split("e"), value = func(pair[0] + "e" + (+pair[1] + precision));
- pair = (toString(value) + "e").split("e");
- return +(pair[0] + "e" + (+pair[1] - precision));
- }
- return func(number);
- };
- }
- var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY) ? noop : function(values2) {
- return new Set2(values2);
- };
- function createToPairs(keysFunc) {
- return function(object) {
- var tag = getTag(object);
- if (tag == mapTag) {
- return mapToArray(object);
- }
- if (tag == setTag) {
- return setToPairs(object);
- }
- return baseToPairs(object, keysFunc(object));
- };
- }
- function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary2, arity) {
- var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
- if (!isBindKey && typeof func != "function") {
- throw new TypeError2(FUNC_ERROR_TEXT);
- }
- var length = partials ? partials.length : 0;
- if (!length) {
- bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
- partials = holders = undefined2;
- }
- ary2 = ary2 === undefined2 ? ary2 : nativeMax(toInteger(ary2), 0);
- arity = arity === undefined2 ? arity : toInteger(arity);
- length -= holders ? holders.length : 0;
- if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
- var partialsRight = partials, holdersRight = holders;
- partials = holders = undefined2;
- }
- var data = isBindKey ? undefined2 : getData(func);
- var newData = [
- func,
- bitmask,
- thisArg,
- partials,
- holders,
- partialsRight,
- holdersRight,
- argPos,
- ary2,
- arity
- ];
- if (data) {
- mergeData(newData, data);
- }
- func = newData[0];
- bitmask = newData[1];
- thisArg = newData[2];
- partials = newData[3];
- holders = newData[4];
- arity = newData[9] = newData[9] === undefined2 ? isBindKey ? 0 : func.length : nativeMax(newData[9] - length, 0);
- if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
- bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
- }
- if (!bitmask || bitmask == WRAP_BIND_FLAG) {
- var result2 = createBind(func, bitmask, thisArg);
- } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
- result2 = createCurry(func, bitmask, arity);
- } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
- result2 = createPartial(func, bitmask, thisArg, partials);
- } else {
- result2 = createHybrid.apply(undefined2, newData);
- }
- var setter = data ? baseSetData : setData;
- return setWrapToString(setter(result2, newData), func, bitmask);
- }
- function customDefaultsAssignIn(objValue, srcValue, key, object) {
- if (objValue === undefined2 || eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key)) {
- return srcValue;
- }
- return objValue;
- }
- function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
- if (isObject(objValue) && isObject(srcValue)) {
- stack.set(srcValue, objValue);
- baseMerge(objValue, srcValue, undefined2, customDefaultsMerge, stack);
- stack["delete"](srcValue);
- }
- return objValue;
- }
- function customOmitClone(value) {
- return isPlainObject(value) ? undefined2 : value;
- }
- function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length;
- if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
- return false;
- }
- var arrStacked = stack.get(array);
- var othStacked = stack.get(other);
- if (arrStacked && othStacked) {
- return arrStacked == other && othStacked == array;
- }
- var index = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined2;
- stack.set(array, other);
- stack.set(other, array);
- while (++index < arrLength) {
- var arrValue = array[index], othValue = other[index];
- if (customizer) {
- var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
- }
- if (compared !== undefined2) {
- if (compared) {
- continue;
- }
- result2 = false;
- break;
- }
- if (seen) {
- if (!arraySome(other, function(othValue2, othIndex) {
- if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
- return seen.push(othIndex);
- }
- })) {
- result2 = false;
- break;
- }
- } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
- result2 = false;
- break;
- }
- }
- stack["delete"](array);
- stack["delete"](other);
- return result2;
- }
- function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
- switch (tag) {
- case dataViewTag:
- if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
- return false;
- }
- object = object.buffer;
- other = other.buffer;
- case arrayBufferTag:
- if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object), new Uint8Array2(other))) {
- return false;
- }
- return true;
- case boolTag:
- case dateTag:
- case numberTag:
- return eq(+object, +other);
- case errorTag:
- return object.name == other.name && object.message == other.message;
- case regexpTag:
- case stringTag:
- return object == other + "";
- case mapTag:
- var convert2 = mapToArray;
- case setTag:
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
- convert2 || (convert2 = setToArray);
- if (object.size != other.size && !isPartial) {
- return false;
- }
- var stacked = stack.get(object);
- if (stacked) {
- return stacked == other;
- }
- bitmask |= COMPARE_UNORDERED_FLAG;
- stack.set(object, other);
- var result2 = equalArrays(convert2(object), convert2(other), bitmask, customizer, equalFunc, stack);
- stack["delete"](object);
- return result2;
- case symbolTag:
- if (symbolValueOf) {
- return symbolValueOf.call(object) == symbolValueOf.call(other);
- }
- }
- return false;
- }
- function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
- if (objLength != othLength && !isPartial) {
- return false;
- }
- var index = objLength;
- while (index--) {
- var key = objProps[index];
- if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
- return false;
- }
- }
- var objStacked = stack.get(object);
- var othStacked = stack.get(other);
- if (objStacked && othStacked) {
- return objStacked == other && othStacked == object;
- }
- var result2 = true;
- stack.set(object, other);
- stack.set(other, object);
- var skipCtor = isPartial;
- while (++index < objLength) {
- key = objProps[index];
- var objValue = object[key], othValue = other[key];
- if (customizer) {
- var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
- }
- if (!(compared === undefined2 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
- result2 = false;
- break;
- }
- skipCtor || (skipCtor = key == "constructor");
- }
- if (result2 && !skipCtor) {
- var objCtor = object.constructor, othCtor = other.constructor;
- if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
- result2 = false;
- }
- }
- stack["delete"](object);
- stack["delete"](other);
- return result2;
- }
- function flatRest(func) {
- return setToString(overRest(func, undefined2, flatten), func + "");
- }
- function getAllKeys(object) {
- return baseGetAllKeys(object, keys, getSymbols);
- }
- function getAllKeysIn(object) {
- return baseGetAllKeys(object, keysIn, getSymbolsIn);
- }
- var getData = !metaMap ? noop : function(func) {
- return metaMap.get(func);
- };
- function getFuncName(func) {
- var result2 = func.name + "", array = realNames[result2], length = hasOwnProperty.call(realNames, result2) ? array.length : 0;
- while (length--) {
- var data = array[length], otherFunc = data.func;
- if (otherFunc == null || otherFunc == func) {
- return data.name;
- }
- }
- return result2;
- }
- function getHolder(func) {
- var object = hasOwnProperty.call(lodash, "placeholder") ? lodash : func;
- return object.placeholder;
- }
- function getIteratee() {
- var result2 = lodash.iteratee || iteratee;
- result2 = result2 === iteratee ? baseIteratee : result2;
- return arguments.length ? result2(arguments[0], arguments[1]) : result2;
- }
- function getMapData(map2, key) {
- var data = map2.__data__;
- return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
- }
- function getMatchData(object) {
- var result2 = keys(object), length = result2.length;
- while (length--) {
- var key = result2[length], value = object[key];
- result2[length] = [key, value, isStrictComparable(value)];
- }
- return result2;
- }
- function getNative(object, key) {
- var value = getValue(object, key);
- return baseIsNative(value) ? value : undefined2;
- }
- function getRawTag(value) {
- var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
- try {
- value[symToStringTag] = undefined2;
- var unmasked = true;
- } catch (e) {
- }
- var result2 = nativeObjectToString.call(value);
- if (unmasked) {
- if (isOwn) {
- value[symToStringTag] = tag;
- } else {
- delete value[symToStringTag];
- }
- }
- return result2;
- }
- var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
- if (object == null) {
- return [];
- }
- object = Object2(object);
- return arrayFilter(nativeGetSymbols(object), function(symbol) {
- return propertyIsEnumerable.call(object, symbol);
- });
- };
- var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
- var result2 = [];
- while (object) {
- arrayPush(result2, getSymbols(object));
- object = getPrototype(object);
- }
- return result2;
- };
- var getTag = baseGetTag;
- if (DataView2 && getTag(new DataView2(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap2 && getTag(new WeakMap2()) != weakMapTag) {
- getTag = function(value) {
- var result2 = baseGetTag(value), Ctor = result2 == objectTag ? value.constructor : undefined2, ctorString = Ctor ? toSource(Ctor) : "";
- if (ctorString) {
- switch (ctorString) {
- case dataViewCtorString:
- return dataViewTag;
- case mapCtorString:
- return mapTag;
- case promiseCtorString:
- return promiseTag;
- case setCtorString:
- return setTag;
- case weakMapCtorString:
- return weakMapTag;
- }
- }
- return result2;
- };
- }
- function getView(start, end, transforms) {
- var index = -1, length = transforms.length;
- while (++index < length) {
- var data = transforms[index], size2 = data.size;
- switch (data.type) {
- case "drop":
- start += size2;
- break;
- case "dropRight":
- end -= size2;
- break;
- case "take":
- end = nativeMin(end, start + size2);
- break;
- case "takeRight":
- start = nativeMax(start, end - size2);
- break;
- }
- }
- return { "start": start, "end": end };
- }
- function getWrapDetails(source) {
- var match = source.match(reWrapDetails);
- return match ? match[1].split(reSplitDetails) : [];
- }
- function hasPath(object, path, hasFunc) {
- path = castPath(path, object);
- var index = -1, length = path.length, result2 = false;
- while (++index < length) {
- var key = toKey(path[index]);
- if (!(result2 = object != null && hasFunc(object, key))) {
- break;
- }
- object = object[key];
- }
- if (result2 || ++index != length) {
- return result2;
- }
- length = object == null ? 0 : object.length;
- return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
- }
- function initCloneArray(array) {
- var length = array.length, result2 = new array.constructor(length);
- if (length && typeof array[0] == "string" && hasOwnProperty.call(array, "index")) {
- result2.index = array.index;
- result2.input = array.input;
- }
- return result2;
- }
- function initCloneObject(object) {
- return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
- }
- function initCloneByTag(object, tag, isDeep) {
- var Ctor = object.constructor;
- switch (tag) {
- case arrayBufferTag:
- return cloneArrayBuffer(object);
- case boolTag:
- case dateTag:
- return new Ctor(+object);
- case dataViewTag:
- return cloneDataView(object, isDeep);
- case float32Tag:
- case float64Tag:
- case int8Tag:
- case int16Tag:
- case int32Tag:
- case uint8Tag:
- case uint8ClampedTag:
- case uint16Tag:
- case uint32Tag:
- return cloneTypedArray(object, isDeep);
- case mapTag:
- return new Ctor();
- case numberTag:
- case stringTag:
- return new Ctor(object);
- case regexpTag:
- return cloneRegExp(object);
- case setTag:
- return new Ctor();
- case symbolTag:
- return cloneSymbol(object);
- }
- }
- function insertWrapDetails(source, details) {
- var length = details.length;
- if (!length) {
- return source;
- }
- var lastIndex = length - 1;
- details[lastIndex] = (length > 1 ? "& " : "") + details[lastIndex];
- details = details.join(length > 2 ? ", " : " ");
- return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
- }
- function isFlattenable(value) {
- return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
- }
- function isIndex(value, length) {
- var type = typeof value;
- length = length == null ? MAX_SAFE_INTEGER : length;
- return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
- }
- function isIterateeCall(value, index, object) {
- if (!isObject(object)) {
- return false;
- }
- var type = typeof index;
- if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) {
- return eq(object[index], value);
- }
- return false;
- }
- function isKey(value, object) {
- if (isArray(value)) {
- return false;
- }
- var type = typeof value;
- if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) {
- return true;
- }
- return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object2(object);
- }
- function isKeyable(value) {
- var type = typeof value;
- return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
- }
- function isLaziable(func) {
- var funcName = getFuncName(func), other = lodash[funcName];
- if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) {
- return false;
- }
- if (func === other) {
- return true;
- }
- var data = getData(other);
- return !!data && func === data[0];
- }
- function isMasked(func) {
- return !!maskSrcKey && maskSrcKey in func;
- }
- var isMaskable = coreJsData ? isFunction : stubFalse;
- function isPrototype(value) {
- var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
- return value === proto;
- }
- function isStrictComparable(value) {
- return value === value && !isObject(value);
- }
- function matchesStrictComparable(key, srcValue) {
- return function(object) {
- if (object == null) {
- return false;
- }
- return object[key] === srcValue && (srcValue !== undefined2 || key in Object2(object));
- };
- }
- function memoizeCapped(func) {
- var result2 = memoize(func, function(key) {
- if (cache.size === MAX_MEMOIZE_SIZE) {
- cache.clear();
- }
- return key;
- });
- var cache = result2.cache;
- return result2;
- }
- function mergeData(data, source) {
- var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
- var isCombo = srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_CURRY_FLAG || srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_REARG_FLAG && data[7].length <= source[8] || srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG) && source[7].length <= source[8] && bitmask == WRAP_CURRY_FLAG;
- if (!(isCommon || isCombo)) {
- return data;
- }
- if (srcBitmask & WRAP_BIND_FLAG) {
- data[2] = source[2];
- newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
- }
- var value = source[3];
- if (value) {
- var partials = data[3];
- data[3] = partials ? composeArgs(partials, value, source[4]) : value;
- data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
- }
- value = source[5];
- if (value) {
- partials = data[5];
- data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
- data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
- }
- value = source[7];
- if (value) {
- data[7] = value;
- }
- if (srcBitmask & WRAP_ARY_FLAG) {
- data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
- }
- if (data[9] == null) {
- data[9] = source[9];
- }
- data[0] = source[0];
- data[1] = newBitmask;
- return data;
- }
- function nativeKeysIn(object) {
- var result2 = [];
- if (object != null) {
- for (var key in Object2(object)) {
- result2.push(key);
- }
- }
- return result2;
- }
- function objectToString(value) {
- return nativeObjectToString.call(value);
- }
- function overRest(func, start, transform2) {
- start = nativeMax(start === undefined2 ? func.length - 1 : start, 0);
- return function() {
- var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array2(length);
- while (++index < length) {
- array[index] = args[start + index];
- }
- index = -1;
- var otherArgs = Array2(start + 1);
- while (++index < start) {
- otherArgs[index] = args[index];
- }
- otherArgs[start] = transform2(array);
- return apply(func, this, otherArgs);
- };
- }
- function parent(object, path) {
- return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
- }
- function reorder(array, indexes) {
- var arrLength = array.length, length = nativeMin(indexes.length, arrLength), oldArray = copyArray(array);
- while (length--) {
- var index = indexes[length];
- array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined2;
- }
- return array;
- }
- function safeGet(object, key) {
- if (key === "constructor" && typeof object[key] === "function") {
- return;
- }
- if (key == "__proto__") {
- return;
- }
- return object[key];
- }
- var setData = shortOut(baseSetData);
- var setTimeout2 = ctxSetTimeout || function(func, wait) {
- return root.setTimeout(func, wait);
- };
- var setToString = shortOut(baseSetToString);
- function setWrapToString(wrapper, reference, bitmask) {
- var source = reference + "";
- return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
- }
- function shortOut(func) {
- var count = 0, lastCalled = 0;
- return function() {
- var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
- lastCalled = stamp;
- if (remaining > 0) {
- if (++count >= HOT_COUNT) {
- return arguments[0];
- }
- } else {
- count = 0;
- }
- return func.apply(undefined2, arguments);
- };
- }
- function shuffleSelf(array, size2) {
- var index = -1, length = array.length, lastIndex = length - 1;
- size2 = size2 === undefined2 ? length : size2;
- while (++index < size2) {
- var rand = baseRandom(index, lastIndex), value = array[rand];
- array[rand] = array[index];
- array[index] = value;
- }
- array.length = size2;
- return array;
- }
- var stringToPath = memoizeCapped(function(string) {
- var result2 = [];
- if (string.charCodeAt(0) === 46) {
- result2.push("");
- }
- string.replace(rePropName, function(match, number, quote, subString) {
- result2.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
- });
- return result2;
- });
- function toKey(value) {
- if (typeof value == "string" || isSymbol(value)) {
- return value;
- }
- var result2 = value + "";
- return result2 == "0" && 1 / value == -INFINITY ? "-0" : result2;
- }
- function toSource(func) {
- if (func != null) {
- try {
- return funcToString.call(func);
- } catch (e) {
- }
- try {
- return func + "";
- } catch (e) {
- }
- }
- return "";
- }
- function updateWrapDetails(details, bitmask) {
- arrayEach(wrapFlags, function(pair) {
- var value = "_." + pair[0];
- if (bitmask & pair[1] && !arrayIncludes(details, value)) {
- details.push(value);
- }
- });
- return details.sort();
- }
- function wrapperClone(wrapper) {
- if (wrapper instanceof LazyWrapper) {
- return wrapper.clone();
- }
- var result2 = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
- result2.__actions__ = copyArray(wrapper.__actions__);
- result2.__index__ = wrapper.__index__;
- result2.__values__ = wrapper.__values__;
- return result2;
- }
- function chunk(array, size2, guard) {
- if (guard ? isIterateeCall(array, size2, guard) : size2 === undefined2) {
- size2 = 1;
- } else {
- size2 = nativeMax(toInteger(size2), 0);
- }
- var length = array == null ? 0 : array.length;
- if (!length || size2 < 1) {
- return [];
- }
- var index = 0, resIndex = 0, result2 = Array2(nativeCeil(length / size2));
- while (index < length) {
- result2[resIndex++] = baseSlice(array, index, index += size2);
- }
- return result2;
- }
- function compact(array) {
- var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result2 = [];
- while (++index < length) {
- var value = array[index];
- if (value) {
- result2[resIndex++] = value;
- }
- }
- return result2;
- }
- function concat() {
- var length = arguments.length;
- if (!length) {
- return [];
- }
- var args = Array2(length - 1), array = arguments[0], index = length;
- while (index--) {
- args[index - 1] = arguments[index];
- }
- return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
- }
- var difference = baseRest(function(array, values2) {
- return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true)) : [];
- });
- var differenceBy = baseRest(function(array, values2) {
- var iteratee2 = last(values2);
- if (isArrayLikeObject(iteratee2)) {
- iteratee2 = undefined2;
- }
- return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2)) : [];
- });
- var differenceWith = baseRest(function(array, values2) {
- var comparator = last(values2);
- if (isArrayLikeObject(comparator)) {
- comparator = undefined2;
- }
- return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true), undefined2, comparator) : [];
- });
- function drop(array, n, guard) {
- var length = array == null ? 0 : array.length;
- if (!length) {
- return [];
- }
- n = guard || n === undefined2 ? 1 : toInteger(n);
- return baseSlice(array, n < 0 ? 0 : n, length);
- }
- function dropRight(array, n, guard) {
- var length = array == null ? 0 : array.length;
- if (!length) {
- return [];
- }
- n = guard || n === undefined2 ? 1 : toInteger(n);
- n = length - n;
- return baseSlice(array, 0, n < 0 ? 0 : n);
- }
- function dropRightWhile(array, predicate) {
- return array && array.length ? baseWhile(array, getIteratee(predicate, 3), true, true) : [];
- }
- function dropWhile(array, predicate) {
- return array && array.length ? baseWhile(array, getIteratee(predicate, 3), true) : [];
- }
- function fill(array, value, start, end) {
- var length = array == null ? 0 : array.length;
- if (!length) {
- return [];
- }
- if (start && typeof start != "number" && isIterateeCall(array, value, start)) {
- start = 0;
- end = length;
- }
- return baseFill(array, value, start, end);
- }
- function findIndex(array, predicate, fromIndex) {
- var length = array == null ? 0 : array.length;
- if (!length) {
- return -1;
- }
- var index = fromIndex == null ? 0 : toInteger(fromIndex);
- if (index < 0) {
- index = nativeMax(length + index, 0);
- }
- return baseFindIndex(array, getIteratee(predicate, 3), index);
- }
- function findLastIndex(array, predicate, fromIndex) {
- var length = array == null ? 0 : array.length;
- if (!length) {
- return -1;
- }
- var index = length - 1;
- if (fromIndex !== undefined2) {
- index = toInteger(fromIndex);
- index = fromIndex < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
- }
- return baseFindIndex(array, getIteratee(predicate, 3), index, true);
- }
- function flatten(array) {
- var length = array == null ? 0 : array.length;
- return length ? baseFlatten(array, 1) : [];
- }
- function flattenDeep(array) {
- var length = array == null ? 0 : array.length;
- return length ? baseFlatten(array, INFINITY) : [];
- }
- function flattenDepth(array, depth) {
- var length = array == null ? 0 : array.length;
- if (!length) {
- return [];
- }
- depth = depth === undefined2 ? 1 : toInteger(depth);
- return baseFlatten(array, depth);
- }
- function fromPairs(pairs) {
- var index = -1, length = pairs == null ? 0 : pairs.length, result2 = {};
- while (++index < length) {
- var pair = pairs[index];
- result2[pair[0]] = pair[1];
- }
- return result2;
- }
- function head(array) {
- return array && array.length ? array[0] : undefined2;
- }
- function indexOf(array, value, fromIndex) {
- var length = array == null ? 0 : array.length;
- if (!length) {
- return -1;
- }
- var index = fromIndex == null ? 0 : toInteger(fromIndex);
- if (index < 0) {
- index = nativeMax(length + index, 0);
- }
- return baseIndexOf(array, value, index);
- }
- function initial(array) {
- var length = array == null ? 0 : array.length;
- return length ? baseSlice(array, 0, -1) : [];
- }
- var intersection = baseRest(function(arrays) {
- var mapped = arrayMap(arrays, castArrayLikeObject);
- return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
- });
- var intersectionBy = baseRest(function(arrays) {
- var iteratee2 = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
- if (iteratee2 === last(mapped)) {
- iteratee2 = undefined2;
- } else {
- mapped.pop();
- }
- return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, getIteratee(iteratee2, 2)) : [];
- });
- var intersectionWith = baseRest(function(arrays) {
- var comparator = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
- comparator = typeof comparator == "function" ? comparator : undefined2;
- if (comparator) {
- mapped.pop();
- }
- return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
- });
- function join(array, separator) {
- return array == null ? "" : nativeJoin.call(array, separator);
- }
- function last(array) {
- var length = array == null ? 0 : array.length;
- return length ? array[length - 1] : undefined2;
- }
- function lastIndexOf(array, value, fromIndex) {
- var length = array == null ? 0 : array.length;
- if (!length) {
- return -1;
- }
- var index = length;
- if (fromIndex !== undefined2) {
- index = toInteger(fromIndex);
- index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
- }
- return value === value ? strictLastIndexOf(array, value, index) : baseFindIndex(array, baseIsNaN, index, true);
- }
- function nth(array, n) {
- return array && array.length ? baseNth(array, toInteger(n)) : undefined2;
- }
- var pull = baseRest(pullAll);
- function pullAll(array, values2) {
- return array && array.length && values2 && values2.length ? basePullAll(array, values2) : array;
- }
- function pullAllBy(array, values2, iteratee2) {
- return array && array.length && values2 && values2.length ? basePullAll(array, values2, getIteratee(iteratee2, 2)) : array;
- }
- function pullAllWith(array, values2, comparator) {
- return array && array.length && values2 && values2.length ? basePullAll(array, values2, undefined2, comparator) : array;
- }
- var pullAt = flatRest(function(array, indexes) {
- var length = array == null ? 0 : array.length, result2 = baseAt(array, indexes);
- basePullAt(array, arrayMap(indexes, function(index) {
- return isIndex(index, length) ? +index : index;
- }).sort(compareAscending));
- return result2;
- });
- function remove(array, predicate) {
- var result2 = [];
- if (!(array && array.length)) {
- return result2;
- }
- var index = -1, indexes = [], length = array.length;
- predicate = getIteratee(predicate, 3);
- while (++index < length) {
- var value = array[index];
- if (predicate(value, index, array)) {
- result2.push(value);
- indexes.push(index);
- }
- }
- basePullAt(array, indexes);
- return result2;
- }
- function reverse(array) {
- return array == null ? array : nativeReverse.call(array);
- }
- function slice(array, start, end) {
- var length = array == null ? 0 : array.length;
- if (!length) {
- return [];
- }
- if (end && typeof end != "number" && isIterateeCall(array, start, end)) {
- start = 0;
- end = length;
- } else {
- start = start == null ? 0 : toInteger(start);
- end = end === undefined2 ? length : toInteger(end);
- }
- return baseSlice(array, start, end);
- }
- function sortedIndex(array, value) {
- return baseSortedIndex(array, value);
- }
- function sortedIndexBy(array, value, iteratee2) {
- return baseSortedIndexBy(array, value, getIteratee(iteratee2, 2));
- }
- function sortedIndexOf(array, value) {
- var length = array == null ? 0 : array.length;
- if (length) {
- var index = baseSortedIndex(array, value);
- if (index < length && eq(array[index], value)) {
- return index;
- }
- }
- return -1;
- }
- function sortedLastIndex(array, value) {
- return baseSortedIndex(array, value, true);
- }
- function sortedLastIndexBy(array, value, iteratee2) {
- return baseSortedIndexBy(array, value, getIteratee(iteratee2, 2), true);
- }
- function sortedLastIndexOf(array, value) {
- var length = array == null ? 0 : array.length;
- if (length) {
- var index = baseSortedIndex(array, value, true) - 1;
- if (eq(array[index], value)) {
- return index;
- }
- }
- return -1;
- }
- function sortedUniq(array) {
- return array && array.length ? baseSortedUniq(array) : [];
- }
- function sortedUniqBy(array, iteratee2) {
- return array && array.length ? baseSortedUniq(array, getIteratee(iteratee2, 2)) : [];
- }
- function tail(array) {
- var length = array == null ? 0 : array.length;
- return length ? baseSlice(array, 1, length) : [];
- }
- function take(array, n, guard) {
- if (!(array && array.length)) {
- return [];
- }
- n = guard || n === undefined2 ? 1 : toInteger(n);
- return baseSlice(array, 0, n < 0 ? 0 : n);
- }
- function takeRight(array, n, guard) {
- var length = array == null ? 0 : array.length;
- if (!length) {
- return [];
- }
- n = guard || n === undefined2 ? 1 : toInteger(n);
- n = length - n;
- return baseSlice(array, n < 0 ? 0 : n, length);
- }
- function takeRightWhile(array, predicate) {
- return array && array.length ? baseWhile(array, getIteratee(predicate, 3), false, true) : [];
- }
- function takeWhile(array, predicate) {
- return array && array.length ? baseWhile(array, getIteratee(predicate, 3)) : [];
- }
- var union = baseRest(function(arrays) {
- return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
- });
- var unionBy = baseRest(function(arrays) {
- var iteratee2 = last(arrays);
- if (isArrayLikeObject(iteratee2)) {
- iteratee2 = undefined2;
- }
- return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2));
- });
- var unionWith = baseRest(function(arrays) {
- var comparator = last(arrays);
- comparator = typeof comparator == "function" ? comparator : undefined2;
- return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined2, comparator);
- });
- function uniq(array) {
- return array && array.length ? baseUniq(array) : [];
- }
- function uniqBy(array, iteratee2) {
- return array && array.length ? baseUniq(array, getIteratee(iteratee2, 2)) : [];
- }
- function uniqWith(array, comparator) {
- comparator = typeof comparator == "function" ? comparator : undefined2;
- return array && array.length ? baseUniq(array, undefined2, comparator) : [];
- }
- function unzip(array) {
- if (!(array && array.length)) {
- return [];
- }
- var length = 0;
- array = arrayFilter(array, function(group) {
- if (isArrayLikeObject(group)) {
- length = nativeMax(group.length, length);
- return true;
- }
- });
- return baseTimes(length, function(index) {
- return arrayMap(array, baseProperty(index));
- });
- }
- function unzipWith(array, iteratee2) {
- if (!(array && array.length)) {
- return [];
- }
- var result2 = unzip(array);
- if (iteratee2 == null) {
- return result2;
- }
- return arrayMap(result2, function(group) {
- return apply(iteratee2, undefined2, group);
- });
- }
- var without = baseRest(function(array, values2) {
- return isArrayLikeObject(array) ? baseDifference(array, values2) : [];
- });
- var xor = baseRest(function(arrays) {
- return baseXor(arrayFilter(arrays, isArrayLikeObject));
- });
- var xorBy = baseRest(function(arrays) {
- var iteratee2 = last(arrays);
- if (isArrayLikeObject(iteratee2)) {
- iteratee2 = undefined2;
- }
- return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee2, 2));
- });
- var xorWith = baseRest(function(arrays) {
- var comparator = last(arrays);
- comparator = typeof comparator == "function" ? comparator : undefined2;
- return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined2, comparator);
- });
- var zip = baseRest(unzip);
- function zipObject(props, values2) {
- return baseZipObject(props || [], values2 || [], assignValue);
- }
- function zipObjectDeep(props, values2) {
- return baseZipObject(props || [], values2 || [], baseSet);
- }
- var zipWith = baseRest(function(arrays) {
- var length = arrays.length, iteratee2 = length > 1 ? arrays[length - 1] : undefined2;
- iteratee2 = typeof iteratee2 == "function" ? (arrays.pop(), iteratee2) : undefined2;
- return unzipWith(arrays, iteratee2);
- });
- function chain(value) {
- var result2 = lodash(value);
- result2.__chain__ = true;
- return result2;
- }
- function tap(value, interceptor) {
- interceptor(value);
- return value;
- }
- function thru(value, interceptor) {
- return interceptor(value);
- }
- var wrapperAt = flatRest(function(paths) {
- var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) {
- return baseAt(object, paths);
- };
- if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) {
- return this.thru(interceptor);
- }
- value = value.slice(start, +start + (length ? 1 : 0));
- value.__actions__.push({
- "func": thru,
- "args": [interceptor],
- "thisArg": undefined2
- });
- return new LodashWrapper(value, this.__chain__).thru(function(array) {
- if (length && !array.length) {
- array.push(undefined2);
- }
- return array;
- });
- });
- function wrapperChain() {
- return chain(this);
- }
- function wrapperCommit() {
- return new LodashWrapper(this.value(), this.__chain__);
- }
- function wrapperNext() {
- if (this.__values__ === undefined2) {
- this.__values__ = toArray2(this.value());
- }
- var done = this.__index__ >= this.__values__.length, value = done ? undefined2 : this.__values__[this.__index__++];
- return { "done": done, "value": value };
- }
- function wrapperToIterator() {
- return this;
- }
- function wrapperPlant(value) {
- var result2, parent2 = this;
- while (parent2 instanceof baseLodash) {
- var clone2 = wrapperClone(parent2);
- clone2.__index__ = 0;
- clone2.__values__ = undefined2;
- if (result2) {
- previous.__wrapped__ = clone2;
- } else {
- result2 = clone2;
- }
- var previous = clone2;
- parent2 = parent2.__wrapped__;
- }
- previous.__wrapped__ = value;
- return result2;
- }
- function wrapperReverse() {
- var value = this.__wrapped__;
- if (value instanceof LazyWrapper) {
- var wrapped = value;
- if (this.__actions__.length) {
- wrapped = new LazyWrapper(this);
- }
- wrapped = wrapped.reverse();
- wrapped.__actions__.push({
- "func": thru,
- "args": [reverse],
- "thisArg": undefined2
- });
- return new LodashWrapper(wrapped, this.__chain__);
- }
- return this.thru(reverse);
- }
- function wrapperValue() {
- return baseWrapperValue(this.__wrapped__, this.__actions__);
- }
- var countBy = createAggregator(function(result2, value, key) {
- if (hasOwnProperty.call(result2, key)) {
- ++result2[key];
- } else {
- baseAssignValue(result2, key, 1);
- }
- });
- function every(collection, predicate, guard) {
- var func = isArray(collection) ? arrayEvery : baseEvery;
- if (guard && isIterateeCall(collection, predicate, guard)) {
- predicate = undefined2;
- }
- return func(collection, getIteratee(predicate, 3));
- }
- function filter(collection, predicate) {
- var func = isArray(collection) ? arrayFilter : baseFilter;
- return func(collection, getIteratee(predicate, 3));
- }
- var find = createFind(findIndex);
- var findLast = createFind(findLastIndex);
- function flatMap(collection, iteratee2) {
- return baseFlatten(map(collection, iteratee2), 1);
- }
- function flatMapDeep(collection, iteratee2) {
- return baseFlatten(map(collection, iteratee2), INFINITY);
- }
- function flatMapDepth(collection, iteratee2, depth) {
- depth = depth === undefined2 ? 1 : toInteger(depth);
- return baseFlatten(map(collection, iteratee2), depth);
- }
- function forEach(collection, iteratee2) {
- var func = isArray(collection) ? arrayEach : baseEach;
- return func(collection, getIteratee(iteratee2, 3));
- }
- function forEachRight(collection, iteratee2) {
- var func = isArray(collection) ? arrayEachRight : baseEachRight;
- return func(collection, getIteratee(iteratee2, 3));
- }
- var groupBy = createAggregator(function(result2, value, key) {
- if (hasOwnProperty.call(result2, key)) {
- result2[key].push(value);
- } else {
- baseAssignValue(result2, key, [value]);
- }
- });
- function includes(collection, value, fromIndex, guard) {
- collection = isArrayLike(collection) ? collection : values(collection);
- fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
- var length = collection.length;
- if (fromIndex < 0) {
- fromIndex = nativeMax(length + fromIndex, 0);
- }
- return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
- }
- var invokeMap = baseRest(function(collection, path, args) {
- var index = -1, isFunc = typeof path == "function", result2 = isArrayLike(collection) ? Array2(collection.length) : [];
- baseEach(collection, function(value) {
- result2[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
- });
- return result2;
- });
- var keyBy = createAggregator(function(result2, value, key) {
- baseAssignValue(result2, key, value);
- });
- function map(collection, iteratee2) {
- var func = isArray(collection) ? arrayMap : baseMap;
- return func(collection, getIteratee(iteratee2, 3));
- }
- function orderBy(collection, iteratees, orders, guard) {
- if (collection == null) {
- return [];
- }
- if (!isArray(iteratees)) {
- iteratees = iteratees == null ? [] : [iteratees];
- }
- orders = guard ? undefined2 : orders;
- if (!isArray(orders)) {
- orders = orders == null ? [] : [orders];
- }
- return baseOrderBy(collection, iteratees, orders);
- }
- var partition = createAggregator(function(result2, value, key) {
- result2[key ? 0 : 1].push(value);
- }, function() {
- return [[], []];
- });
- function reduce(collection, iteratee2, accumulator) {
- var func = isArray(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
- return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEach);
- }
- function reduceRight(collection, iteratee2, accumulator) {
- var func = isArray(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
- return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEachRight);
- }
- function reject(collection, predicate) {
- var func = isArray(collection) ? arrayFilter : baseFilter;
- return func(collection, negate(getIteratee(predicate, 3)));
- }
- function sample(collection) {
- var func = isArray(collection) ? arraySample : baseSample;
- return func(collection);
- }
- function sampleSize(collection, n, guard) {
- if (guard ? isIterateeCall(collection, n, guard) : n === undefined2) {
- n = 1;
- } else {
- n = toInteger(n);
- }
- var func = isArray(collection) ? arraySampleSize : baseSampleSize;
- return func(collection, n);
- }
- function shuffle(collection) {
- var func = isArray(collection) ? arrayShuffle : baseShuffle;
- return func(collection);
- }
- function size(collection) {
- if (collection == null) {
- return 0;
- }
- if (isArrayLike(collection)) {
- return isString(collection) ? stringSize(collection) : collection.length;
- }
- var tag = getTag(collection);
- if (tag == mapTag || tag == setTag) {
- return collection.size;
- }
- return baseKeys(collection).length;
- }
- function some(collection, predicate, guard) {
- var func = isArray(collection) ? arraySome : baseSome;
- if (guard && isIterateeCall(collection, predicate, guard)) {
- predicate = undefined2;
- }
- return func(collection, getIteratee(predicate, 3));
- }
- var sortBy = baseRest(function(collection, iteratees) {
- if (collection == null) {
- return [];
- }
- var length = iteratees.length;
- if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
- iteratees = [];
- } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
- iteratees = [iteratees[0]];
- }
- return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
- });
- var now = ctxNow || function() {
- return root.Date.now();
- };
- function after(n, func) {
- if (typeof func != "function") {
- throw new TypeError2(FUNC_ERROR_TEXT);
- }
- n = toInteger(n);
- return function() {
- if (--n < 1) {
- return func.apply(this, arguments);
- }
- };
- }
- function ary(func, n, guard) {
- n = guard ? undefined2 : n;
- n = func && n == null ? func.length : n;
- return createWrap(func, WRAP_ARY_FLAG, undefined2, undefined2, undefined2, undefined2, n);
- }
- function before(n, func) {
- var result2;
- if (typeof func != "function") {
- throw new TypeError2(FUNC_ERROR_TEXT);
- }
- n = toInteger(n);
- return function() {
- if (--n > 0) {
- result2 = func.apply(this, arguments);
- }
- if (n <= 1) {
- func = undefined2;
- }
- return result2;
- };
- }
- var bind = baseRest(function(func, thisArg, partials) {
- var bitmask = WRAP_BIND_FLAG;
- if (partials.length) {
- var holders = replaceHolders(partials, getHolder(bind));
- bitmask |= WRAP_PARTIAL_FLAG;
- }
- return createWrap(func, bitmask, thisArg, partials, holders);
- });
- var bindKey = baseRest(function(object, key, partials) {
- var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
- if (partials.length) {
- var holders = replaceHolders(partials, getHolder(bindKey));
- bitmask |= WRAP_PARTIAL_FLAG;
- }
- return createWrap(key, bitmask, object, partials, holders);
- });
- function curry(func, arity, guard) {
- arity = guard ? undefined2 : arity;
- var result2 = createWrap(func, WRAP_CURRY_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
- result2.placeholder = curry.placeholder;
- return result2;
- }
- function curryRight(func, arity, guard) {
- arity = guard ? undefined2 : arity;
- var result2 = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
- result2.placeholder = curryRight.placeholder;
- return result2;
- }
- function debounce(func, wait, options) {
- var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
- if (typeof func != "function") {
- throw new TypeError2(FUNC_ERROR_TEXT);
- }
- wait = toNumber(wait) || 0;
- if (isObject(options)) {
- leading = !!options.leading;
- maxing = "maxWait" in options;
- maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
- trailing = "trailing" in options ? !!options.trailing : trailing;
- }
- function invokeFunc(time) {
- var args = lastArgs, thisArg = lastThis;
- lastArgs = lastThis = undefined2;
- lastInvokeTime = time;
- result2 = func.apply(thisArg, args);
- return result2;
- }
- function leadingEdge(time) {
- lastInvokeTime = time;
- timerId = setTimeout2(timerExpired, wait);
- return leading ? invokeFunc(time) : result2;
- }
- function remainingWait(time) {
- var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
- return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
- }
- function shouldInvoke(time) {
- var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
- return lastCallTime === undefined2 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
- }
- function timerExpired() {
- var time = now();
- if (shouldInvoke(time)) {
- return trailingEdge(time);
- }
- timerId = setTimeout2(timerExpired, remainingWait(time));
- }
- function trailingEdge(time) {
- timerId = undefined2;
- if (trailing && lastArgs) {
- return invokeFunc(time);
- }
- lastArgs = lastThis = undefined2;
- return result2;
- }
- function cancel() {
- if (timerId !== undefined2) {
- clearTimeout2(timerId);
- }
- lastInvokeTime = 0;
- lastArgs = lastCallTime = lastThis = timerId = undefined2;
- }
- function flush() {
- return timerId === undefined2 ? result2 : trailingEdge(now());
- }
- function debounced() {
- var time = now(), isInvoking = shouldInvoke(time);
- lastArgs = arguments;
- lastThis = this;
- lastCallTime = time;
- if (isInvoking) {
- if (timerId === undefined2) {
- return leadingEdge(lastCallTime);
- }
- if (maxing) {
- clearTimeout2(timerId);
- timerId = setTimeout2(timerExpired, wait);
- return invokeFunc(lastCallTime);
- }
- }
- if (timerId === undefined2) {
- timerId = setTimeout2(timerExpired, wait);
- }
- return result2;
- }
- debounced.cancel = cancel;
- debounced.flush = flush;
- return debounced;
- }
- var defer = baseRest(function(func, args) {
- return baseDelay(func, 1, args);
- });
- var delay = baseRest(function(func, wait, args) {
- return baseDelay(func, toNumber(wait) || 0, args);
- });
- function flip(func) {
- return createWrap(func, WRAP_FLIP_FLAG);
- }
- function memoize(func, resolver) {
- if (typeof func != "function" || resolver != null && typeof resolver != "function") {
- throw new TypeError2(FUNC_ERROR_TEXT);
- }
- var memoized = function() {
- var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
- if (cache.has(key)) {
- return cache.get(key);
- }
- var result2 = func.apply(this, args);
- memoized.cache = cache.set(key, result2) || cache;
- return result2;
- };
- memoized.cache = new (memoize.Cache || MapCache)();
- return memoized;
- }
- memoize.Cache = MapCache;
- function negate(predicate) {
- if (typeof predicate != "function") {
- throw new TypeError2(FUNC_ERROR_TEXT);
- }
- return function() {
- var args = arguments;
- switch (args.length) {
- case 0:
- return !predicate.call(this);
- case 1:
- return !predicate.call(this, args[0]);
- case 2:
- return !predicate.call(this, args[0], args[1]);
- case 3:
- return !predicate.call(this, args[0], args[1], args[2]);
- }
- return !predicate.apply(this, args);
- };
- }
- function once(func) {
- return before(2, func);
- }
- var overArgs = castRest(function(func, transforms) {
- transforms = transforms.length == 1 && isArray(transforms[0]) ? arrayMap(transforms[0], baseUnary(getIteratee())) : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
- var funcsLength = transforms.length;
- return baseRest(function(args) {
- var index = -1, length = nativeMin(args.length, funcsLength);
- while (++index < length) {
- args[index] = transforms[index].call(this, args[index]);
- }
- return apply(func, this, args);
- });
- });
- var partial = baseRest(function(func, partials) {
- var holders = replaceHolders(partials, getHolder(partial));
- return createWrap(func, WRAP_PARTIAL_FLAG, undefined2, partials, holders);
- });
- var partialRight = baseRest(function(func, partials) {
- var holders = replaceHolders(partials, getHolder(partialRight));
- return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined2, partials, holders);
- });
- var rearg = flatRest(function(func, indexes) {
- return createWrap(func, WRAP_REARG_FLAG, undefined2, undefined2, undefined2, indexes);
- });
- function rest(func, start) {
- if (typeof func != "function") {
- throw new TypeError2(FUNC_ERROR_TEXT);
- }
- start = start === undefined2 ? start : toInteger(start);
- return baseRest(func, start);
- }
- function spread(func, start) {
- if (typeof func != "function") {
- throw new TypeError2(FUNC_ERROR_TEXT);
- }
- start = start == null ? 0 : nativeMax(toInteger(start), 0);
- return baseRest(function(args) {
- var array = args[start], otherArgs = castSlice(args, 0, start);
- if (array) {
- arrayPush(otherArgs, array);
- }
- return apply(func, this, otherArgs);
- });
- }
- function throttle(func, wait, options) {
- var leading = true, trailing = true;
- if (typeof func != "function") {
- throw new TypeError2(FUNC_ERROR_TEXT);
- }
- if (isObject(options)) {
- leading = "leading" in options ? !!options.leading : leading;
- trailing = "trailing" in options ? !!options.trailing : trailing;
- }
- return debounce(func, wait, {
- "leading": leading,
- "maxWait": wait,
- "trailing": trailing
- });
- }
- function unary(func) {
- return ary(func, 1);
- }
- function wrap(value, wrapper) {
- return partial(castFunction(wrapper), value);
- }
- function castArray() {
- if (!arguments.length) {
- return [];
- }
- var value = arguments[0];
- return isArray(value) ? value : [value];
- }
- function clone(value) {
- return baseClone(value, CLONE_SYMBOLS_FLAG);
- }
- function cloneWith(value, customizer) {
- customizer = typeof customizer == "function" ? customizer : undefined2;
- return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
- }
- function cloneDeep(value) {
- return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
- }
- function cloneDeepWith(value, customizer) {
- customizer = typeof customizer == "function" ? customizer : undefined2;
- return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
- }
- function conformsTo(object, source) {
- return source == null || baseConformsTo(object, source, keys(source));
- }
- function eq(value, other) {
- return value === other || value !== value && other !== other;
- }
- var gt = createRelationalOperation(baseGt);
- var gte = createRelationalOperation(function(value, other) {
- return value >= other;
- });
- var isArguments = baseIsArguments(/* @__PURE__ */ function() {
- return arguments;
- }()) ? baseIsArguments : function(value) {
- return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
- };
- var isArray = Array2.isArray;
- var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
- function isArrayLike(value) {
- return value != null && isLength(value.length) && !isFunction(value);
- }
- function isArrayLikeObject(value) {
- return isObjectLike(value) && isArrayLike(value);
- }
- function isBoolean(value) {
- return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag;
- }
- var isBuffer = nativeIsBuffer || stubFalse;
- var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
- function isElement(value) {
- return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
- }
- function isEmpty(value) {
- if (value == null) {
- return true;
- }
- if (isArrayLike(value) && (isArray(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer(value) || isTypedArray(value) || isArguments(value))) {
- return !value.length;
- }
- var tag = getTag(value);
- if (tag == mapTag || tag == setTag) {
- return !value.size;
- }
- if (isPrototype(value)) {
- return !baseKeys(value).length;
- }
- for (var key in value) {
- if (hasOwnProperty.call(value, key)) {
- return false;
- }
- }
- return true;
- }
- function isEqual(value, other) {
- return baseIsEqual(value, other);
- }
- function isEqualWith(value, other, customizer) {
- customizer = typeof customizer == "function" ? customizer : undefined2;
- var result2 = customizer ? customizer(value, other) : undefined2;
- return result2 === undefined2 ? baseIsEqual(value, other, undefined2, customizer) : !!result2;
- }
- function isError(value) {
- if (!isObjectLike(value)) {
- return false;
- }
- var tag = baseGetTag(value);
- return tag == errorTag || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value);
- }
- function isFinite2(value) {
- return typeof value == "number" && nativeIsFinite(value);
- }
- function isFunction(value) {
- if (!isObject(value)) {
- return false;
- }
- var tag = baseGetTag(value);
- return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
- }
- function isInteger(value) {
- return typeof value == "number" && value == toInteger(value);
- }
- function isLength(value) {
- return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
- }
- function isObject(value) {
- var type = typeof value;
- return value != null && (type == "object" || type == "function");
- }
- function isObjectLike(value) {
- return value != null && typeof value == "object";
- }
- var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
- function isMatch(object, source) {
- return object === source || baseIsMatch(object, source, getMatchData(source));
- }
- function isMatchWith(object, source, customizer) {
- customizer = typeof customizer == "function" ? customizer : undefined2;
- return baseIsMatch(object, source, getMatchData(source), customizer);
- }
- function isNaN2(value) {
- return isNumber(value) && value != +value;
- }
- function isNative(value) {
- if (isMaskable(value)) {
- throw new Error2(CORE_ERROR_TEXT);
- }
- return baseIsNative(value);
- }
- function isNull(value) {
- return value === null;
- }
- function isNil(value) {
- return value == null;
- }
- function isNumber(value) {
- return typeof value == "number" || isObjectLike(value) && baseGetTag(value) == numberTag;
- }
- function isPlainObject(value) {
- if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
- return false;
- }
- var proto = getPrototype(value);
- if (proto === null) {
- return true;
- }
- var Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor;
- return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
- }
- var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
- function isSafeInteger(value) {
- return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
- }
- var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
- function isString(value) {
- return typeof value == "string" || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag;
- }
- function isSymbol(value) {
- return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
- }
- var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
- function isUndefined(value) {
- return value === undefined2;
- }
- function isWeakMap(value) {
- return isObjectLike(value) && getTag(value) == weakMapTag;
- }
- function isWeakSet(value) {
- return isObjectLike(value) && baseGetTag(value) == weakSetTag;
- }
- var lt = createRelationalOperation(baseLt);
- var lte = createRelationalOperation(function(value, other) {
- return value <= other;
- });
- function toArray2(value) {
- if (!value) {
- return [];
- }
- if (isArrayLike(value)) {
- return isString(value) ? stringToArray(value) : copyArray(value);
- }
- if (symIterator && value[symIterator]) {
- return iteratorToArray(value[symIterator]());
- }
- var tag = getTag(value), func = tag == mapTag ? mapToArray : tag == setTag ? setToArray : values;
- return func(value);
- }
- function toFinite(value) {
- if (!value) {
- return value === 0 ? value : 0;
- }
- value = toNumber(value);
- if (value === INFINITY || value === -INFINITY) {
- var sign = value < 0 ? -1 : 1;
- return sign * MAX_INTEGER;
- }
- return value === value ? value : 0;
- }
- function toInteger(value) {
- var result2 = toFinite(value), remainder = result2 % 1;
- return result2 === result2 ? remainder ? result2 - remainder : result2 : 0;
- }
- function toLength(value) {
- return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
- }
- function toNumber(value) {
- if (typeof value == "number") {
- return value;
- }
- if (isSymbol(value)) {
- return NAN;
- }
- if (isObject(value)) {
- var other = typeof value.valueOf == "function" ? value.valueOf() : value;
- value = isObject(other) ? other + "" : other;
- }
- if (typeof value != "string") {
- return value === 0 ? value : +value;
- }
- value = baseTrim(value);
- var isBinary = reIsBinary.test(value);
- return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
- }
- function toPlainObject(value) {
- return copyObject(value, keysIn(value));
- }
- function toSafeInteger(value) {
- return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : value === 0 ? value : 0;
- }
- function toString(value) {
- return value == null ? "" : baseToString(value);
- }
- var assign = createAssigner(function(object, source) {
- if (isPrototype(source) || isArrayLike(source)) {
- copyObject(source, keys(source), object);
- return;
- }
- for (var key in source) {
- if (hasOwnProperty.call(source, key)) {
- assignValue(object, key, source[key]);
- }
- }
- });
- var assignIn = createAssigner(function(object, source) {
- copyObject(source, keysIn(source), object);
- });
- var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
- copyObject(source, keysIn(source), object, customizer);
- });
- var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
- copyObject(source, keys(source), object, customizer);
- });
- var at = flatRest(baseAt);
- function create(prototype, properties) {
- var result2 = baseCreate(prototype);
- return properties == null ? result2 : baseAssign(result2, properties);
- }
- var defaults = baseRest(function(object, sources) {
- object = Object2(object);
- var index = -1;
- var length = sources.length;
- var guard = length > 2 ? sources[2] : undefined2;
- if (guard && isIterateeCall(sources[0], sources[1], guard)) {
- length = 1;
- }
- while (++index < length) {
- var source = sources[index];
- var props = keysIn(source);
- var propsIndex = -1;
- var propsLength = props.length;
- while (++propsIndex < propsLength) {
- var key = props[propsIndex];
- var value = object[key];
- if (value === undefined2 || eq(value, objectProto[key]) && !hasOwnProperty.call(object, key)) {
- object[key] = source[key];
- }
- }
- }
- return object;
- });
- var defaultsDeep = baseRest(function(args) {
- args.push(undefined2, customDefaultsMerge);
- return apply(mergeWith, undefined2, args);
- });
- function findKey(object, predicate) {
- return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
- }
- function findLastKey(object, predicate) {
- return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
- }
- function forIn(object, iteratee2) {
- return object == null ? object : baseFor(object, getIteratee(iteratee2, 3), keysIn);
- }
- function forInRight(object, iteratee2) {
- return object == null ? object : baseForRight(object, getIteratee(iteratee2, 3), keysIn);
- }
- function forOwn(object, iteratee2) {
- return object && baseForOwn(object, getIteratee(iteratee2, 3));
- }
- function forOwnRight(object, iteratee2) {
- return object && baseForOwnRight(object, getIteratee(iteratee2, 3));
- }
- function functions(object) {
- return object == null ? [] : baseFunctions(object, keys(object));
- }
- function functionsIn(object) {
- return object == null ? [] : baseFunctions(object, keysIn(object));
- }
- function get(object, path, defaultValue) {
- var result2 = object == null ? undefined2 : baseGet(object, path);
- return result2 === undefined2 ? defaultValue : result2;
- }
- function has(object, path) {
- return object != null && hasPath(object, path, baseHas);
- }
- function hasIn(object, path) {
- return object != null && hasPath(object, path, baseHasIn);
- }
- var invert = createInverter(function(result2, value, key) {
- if (value != null && typeof value.toString != "function") {
- value = nativeObjectToString.call(value);
- }
- result2[value] = key;
- }, constant(identity));
- var invertBy = createInverter(function(result2, value, key) {
- if (value != null && typeof value.toString != "function") {
- value = nativeObjectToString.call(value);
- }
- if (hasOwnProperty.call(result2, value)) {
- result2[value].push(key);
- } else {
- result2[value] = [key];
- }
- }, getIteratee);
- var invoke = baseRest(baseInvoke);
- function keys(object) {
- return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
- }
- function keysIn(object) {
- return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
- }
- function mapKeys(object, iteratee2) {
- var result2 = {};
- iteratee2 = getIteratee(iteratee2, 3);
- baseForOwn(object, function(value, key, object2) {
- baseAssignValue(result2, iteratee2(value, key, object2), value);
- });
- return result2;
- }
- function mapValues(object, iteratee2) {
- var result2 = {};
- iteratee2 = getIteratee(iteratee2, 3);
- baseForOwn(object, function(value, key, object2) {
- baseAssignValue(result2, key, iteratee2(value, key, object2));
- });
- return result2;
- }
- var merge = createAssigner(function(object, source, srcIndex) {
- baseMerge(object, source, srcIndex);
- });
- var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
- baseMerge(object, source, srcIndex, customizer);
- });
- var omit = flatRest(function(object, paths) {
- var result2 = {};
- if (object == null) {
- return result2;
- }
- var isDeep = false;
- paths = arrayMap(paths, function(path) {
- path = castPath(path, object);
- isDeep || (isDeep = path.length > 1);
- return path;
- });
- copyObject(object, getAllKeysIn(object), result2);
- if (isDeep) {
- result2 = baseClone(result2, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
- }
- var length = paths.length;
- while (length--) {
- baseUnset(result2, paths[length]);
- }
- return result2;
- });
- function omitBy(object, predicate) {
- return pickBy(object, negate(getIteratee(predicate)));
- }
- var pick = flatRest(function(object, paths) {
- return object == null ? {} : basePick(object, paths);
- });
- function pickBy(object, predicate) {
- if (object == null) {
- return {};
- }
- var props = arrayMap(getAllKeysIn(object), function(prop) {
- return [prop];
- });
- predicate = getIteratee(predicate);
- return basePickBy(object, props, function(value, path) {
- return predicate(value, path[0]);
- });
- }
- function result(object, path, defaultValue) {
- path = castPath(path, object);
- var index = -1, length = path.length;
- if (!length) {
- length = 1;
- object = undefined2;
- }
- while (++index < length) {
- var value = object == null ? undefined2 : object[toKey(path[index])];
- if (value === undefined2) {
- index = length;
- value = defaultValue;
- }
- object = isFunction(value) ? value.call(object) : value;
- }
- return object;
- }
- function set(object, path, value) {
- return object == null ? object : baseSet(object, path, value);
- }
- function setWith(object, path, value, customizer) {
- customizer = typeof customizer == "function" ? customizer : undefined2;
- return object == null ? object : baseSet(object, path, value, customizer);
- }
- var toPairs = createToPairs(keys);
- var toPairsIn = createToPairs(keysIn);
- function transform(object, iteratee2, accumulator) {
- var isArr = isArray(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object);
- iteratee2 = getIteratee(iteratee2, 4);
- if (accumulator == null) {
- var Ctor = object && object.constructor;
- if (isArrLike) {
- accumulator = isArr ? new Ctor() : [];
- } else if (isObject(object)) {
- accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
- } else {
- accumulator = {};
- }
- }
- (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) {
- return iteratee2(accumulator, value, index, object2);
- });
- return accumulator;
- }
- function unset(object, path) {
- return object == null ? true : baseUnset(object, path);
- }
- function update(object, path, updater) {
- return object == null ? object : baseUpdate(object, path, castFunction(updater));
- }
- function updateWith(object, path, updater, customizer) {
- customizer = typeof customizer == "function" ? customizer : undefined2;
- return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
- }
- function values(object) {
- return object == null ? [] : baseValues(object, keys(object));
- }
- function valuesIn(object) {
- return object == null ? [] : baseValues(object, keysIn(object));
- }
- function clamp(number, lower, upper) {
- if (upper === undefined2) {
- upper = lower;
- lower = undefined2;
- }
- if (upper !== undefined2) {
- upper = toNumber(upper);
- upper = upper === upper ? upper : 0;
- }
- if (lower !== undefined2) {
- lower = toNumber(lower);
- lower = lower === lower ? lower : 0;
- }
- return baseClamp(toNumber(number), lower, upper);
- }
- function inRange(number, start, end) {
- start = toFinite(start);
- if (end === undefined2) {
- end = start;
- start = 0;
- } else {
- end = toFinite(end);
- }
- number = toNumber(number);
- return baseInRange(number, start, end);
- }
- function random(lower, upper, floating) {
- if (floating && typeof floating != "boolean" && isIterateeCall(lower, upper, floating)) {
- upper = floating = undefined2;
- }
- if (floating === undefined2) {
- if (typeof upper == "boolean") {
- floating = upper;
- upper = undefined2;
- } else if (typeof lower == "boolean") {
- floating = lower;
- lower = undefined2;
- }
- }
- if (lower === undefined2 && upper === undefined2) {
- lower = 0;
- upper = 1;
- } else {
- lower = toFinite(lower);
- if (upper === undefined2) {
- upper = lower;
- lower = 0;
- } else {
- upper = toFinite(upper);
- }
- }
- if (lower > upper) {
- var temp = lower;
- lower = upper;
- upper = temp;
- }
- if (floating || lower % 1 || upper % 1) {
- var rand = nativeRandom();
- return nativeMin(lower + rand * (upper - lower + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
- }
- return baseRandom(lower, upper);
- }
- var camelCase = createCompounder(function(result2, word, index) {
- word = word.toLowerCase();
- return result2 + (index ? capitalize(word) : word);
- });
- function capitalize(string) {
- return upperFirst(toString(string).toLowerCase());
- }
- function deburr(string) {
- string = toString(string);
- return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
- }
- function endsWith(string, target, position) {
- string = toString(string);
- target = baseToString(target);
- var length = string.length;
- position = position === undefined2 ? length : baseClamp(toInteger(position), 0, length);
- var end = position;
- position -= target.length;
- return position >= 0 && string.slice(position, end) == target;
- }
- function escape2(string) {
- string = toString(string);
- return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string;
- }
- function escapeRegExp(string) {
- string = toString(string);
- return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string;
- }
- var kebabCase = createCompounder(function(result2, word, index) {
- return result2 + (index ? "-" : "") + word.toLowerCase();
- });
- var lowerCase = createCompounder(function(result2, word, index) {
- return result2 + (index ? " " : "") + word.toLowerCase();
- });
- var lowerFirst = createCaseFirst("toLowerCase");
- function pad(string, length, chars) {
- string = toString(string);
- length = toInteger(length);
- var strLength = length ? stringSize(string) : 0;
- if (!length || strLength >= length) {
- return string;
- }
- var mid = (length - strLength) / 2;
- return createPadding(nativeFloor(mid), chars) + string + createPadding(nativeCeil(mid), chars);
- }
- function padEnd(string, length, chars) {
- string = toString(string);
- length = toInteger(length);
- var strLength = length ? stringSize(string) : 0;
- return length && strLength < length ? string + createPadding(length - strLength, chars) : string;
- }
- function padStart(string, length, chars) {
- string = toString(string);
- length = toInteger(length);
- var strLength = length ? stringSize(string) : 0;
- return length && strLength < length ? createPadding(length - strLength, chars) + string : string;
- }
- function parseInt2(string, radix, guard) {
- if (guard || radix == null) {
- radix = 0;
- } else if (radix) {
- radix = +radix;
- }
- return nativeParseInt(toString(string).replace(reTrimStart, ""), radix || 0);
- }
- function repeat(string, n, guard) {
- if (guard ? isIterateeCall(string, n, guard) : n === undefined2) {
- n = 1;
- } else {
- n = toInteger(n);
- }
- return baseRepeat(toString(string), n);
- }
- function replace() {
- var args = arguments, string = toString(args[0]);
- return args.length < 3 ? string : string.replace(args[1], args[2]);
- }
- var snakeCase = createCompounder(function(result2, word, index) {
- return result2 + (index ? "_" : "") + word.toLowerCase();
- });
- function split(string, separator, limit) {
- if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) {
- separator = limit = undefined2;
- }
- limit = limit === undefined2 ? MAX_ARRAY_LENGTH : limit >>> 0;
- if (!limit) {
- return [];
- }
- string = toString(string);
- if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) {
- separator = baseToString(separator);
- if (!separator && hasUnicode(string)) {
- return castSlice(stringToArray(string), 0, limit);
- }
- }
- return string.split(separator, limit);
- }
- var startCase = createCompounder(function(result2, word, index) {
- return result2 + (index ? " " : "") + upperFirst(word);
- });
- function startsWith(string, target, position) {
- string = toString(string);
- position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length);
- target = baseToString(target);
- return string.slice(position, position + target.length) == target;
- }
- function template(string, options, guard) {
- var settings = lodash.templateSettings;
- if (guard && isIterateeCall(string, options, guard)) {
- options = undefined2;
- }
- string = toString(string);
- options = assignInWith({}, options, settings, customDefaultsAssignIn);
- var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys);
- var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '";
- var reDelimiters = RegExp2(
- (options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$",
- "g"
- );
- var sourceURL = "//# sourceURL=" + (hasOwnProperty.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
- string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
- interpolateValue || (interpolateValue = esTemplateValue);
- source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
- if (escapeValue) {
- isEscaping = true;
- source += "' +\n__e(" + escapeValue + ") +\n'";
- }
- if (evaluateValue) {
- isEvaluating = true;
- source += "';\n" + evaluateValue + ";\n__p += '";
- }
- if (interpolateValue) {
- source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
- }
- index = offset + match.length;
- return match;
- });
- source += "';\n";
- var variable = hasOwnProperty.call(options, "variable") && options.variable;
- if (!variable) {
- source = "with (obj) {\n" + source + "\n}\n";
- } else if (reForbiddenIdentifierChars.test(variable)) {
- throw new Error2(INVALID_TEMPL_VAR_ERROR_TEXT);
- }
- source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
- source = "function(" + (variable || "obj") + ") {\n" + (variable ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (isEscaping ? ", __e = _.escape" : "") + (isEvaluating ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + source + "return __p\n}";
- var result2 = attempt(function() {
- return Function2(importsKeys, sourceURL + "return " + source).apply(undefined2, importsValues);
- });
- result2.source = source;
- if (isError(result2)) {
- throw result2;
- }
- return result2;
- }
- function toLower(value) {
- return toString(value).toLowerCase();
- }
- function toUpper(value) {
- return toString(value).toUpperCase();
- }
- function trim(string, chars, guard) {
- string = toString(string);
- if (string && (guard || chars === undefined2)) {
- return baseTrim(string);
- }
- if (!string || !(chars = baseToString(chars))) {
- return string;
- }
- var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1;
- return castSlice(strSymbols, start, end).join("");
- }
- function trimEnd(string, chars, guard) {
- string = toString(string);
- if (string && (guard || chars === undefined2)) {
- return string.slice(0, trimmedEndIndex(string) + 1);
- }
- if (!string || !(chars = baseToString(chars))) {
- return string;
- }
- var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
- return castSlice(strSymbols, 0, end).join("");
- }
- function trimStart(string, chars, guard) {
- string = toString(string);
- if (string && (guard || chars === undefined2)) {
- return string.replace(reTrimStart, "");
- }
- if (!string || !(chars = baseToString(chars))) {
- return string;
- }
- var strSymbols = stringToArray(string), start = charsStartIndex(strSymbols, stringToArray(chars));
- return castSlice(strSymbols, start).join("");
- }
- function truncate(string, options) {
- var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
- if (isObject(options)) {
- var separator = "separator" in options ? options.separator : separator;
- length = "length" in options ? toInteger(options.length) : length;
- omission = "omission" in options ? baseToString(options.omission) : omission;
- }
- string = toString(string);
- var strLength = string.length;
- if (hasUnicode(string)) {
- var strSymbols = stringToArray(string);
- strLength = strSymbols.length;
- }
- if (length >= strLength) {
- return string;
- }
- var end = length - stringSize(omission);
- if (end < 1) {
- return omission;
- }
- var result2 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end);
- if (separator === undefined2) {
- return result2 + omission;
- }
- if (strSymbols) {
- end += result2.length - end;
- }
- if (isRegExp(separator)) {
- if (string.slice(end).search(separator)) {
- var match, substring = result2;
- if (!separator.global) {
- separator = RegExp2(separator.source, toString(reFlags.exec(separator)) + "g");
- }
- separator.lastIndex = 0;
- while (match = separator.exec(substring)) {
- var newEnd = match.index;
- }
- result2 = result2.slice(0, newEnd === undefined2 ? end : newEnd);
- }
- } else if (string.indexOf(baseToString(separator), end) != end) {
- var index = result2.lastIndexOf(separator);
- if (index > -1) {
- result2 = result2.slice(0, index);
- }
- }
- return result2 + omission;
- }
- function unescape2(string) {
- string = toString(string);
- return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string;
- }
- var upperCase = createCompounder(function(result2, word, index) {
- return result2 + (index ? " " : "") + word.toUpperCase();
- });
- var upperFirst = createCaseFirst("toUpperCase");
- function words(string, pattern, guard) {
- string = toString(string);
- pattern = guard ? undefined2 : pattern;
- if (pattern === undefined2) {
- return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
- }
- return string.match(pattern) || [];
- }
- var attempt = baseRest(function(func, args) {
- try {
- return apply(func, undefined2, args);
- } catch (e) {
- return isError(e) ? e : new Error2(e);
- }
- });
- var bindAll = flatRest(function(object, methodNames) {
- arrayEach(methodNames, function(key) {
- key = toKey(key);
- baseAssignValue(object, key, bind(object[key], object));
- });
- return object;
- });
- function cond(pairs) {
- var length = pairs == null ? 0 : pairs.length, toIteratee = getIteratee();
- pairs = !length ? [] : arrayMap(pairs, function(pair) {
- if (typeof pair[1] != "function") {
- throw new TypeError2(FUNC_ERROR_TEXT);
- }
- return [toIteratee(pair[0]), pair[1]];
- });
- return baseRest(function(args) {
- var index = -1;
- while (++index < length) {
- var pair = pairs[index];
- if (apply(pair[0], this, args)) {
- return apply(pair[1], this, args);
- }
- }
- });
- }
- function conforms(source) {
- return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
- }
- function constant(value) {
- return function() {
- return value;
- };
- }
- function defaultTo(value, defaultValue) {
- return value == null || value !== value ? defaultValue : value;
- }
- var flow = createFlow();
- var flowRight = createFlow(true);
- function identity(value) {
- return value;
- }
- function iteratee(func) {
- return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG));
- }
- function matches(source) {
- return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
- }
- function matchesProperty(path, srcValue) {
- return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
- }
- var method = baseRest(function(path, args) {
- return function(object) {
- return baseInvoke(object, path, args);
- };
- });
- var methodOf = baseRest(function(object, args) {
- return function(path) {
- return baseInvoke(object, path, args);
- };
- });
- function mixin(object, source, options) {
- var props = keys(source), methodNames = baseFunctions(source, props);
- if (options == null && !(isObject(source) && (methodNames.length || !props.length))) {
- options = source;
- source = object;
- object = this;
- methodNames = baseFunctions(source, keys(source));
- }
- var chain2 = !(isObject(options) && "chain" in options) || !!options.chain, isFunc = isFunction(object);
- arrayEach(methodNames, function(methodName) {
- var func = source[methodName];
- object[methodName] = func;
- if (isFunc) {
- object.prototype[methodName] = function() {
- var chainAll = this.__chain__;
- if (chain2 || chainAll) {
- var result2 = object(this.__wrapped__), actions = result2.__actions__ = copyArray(this.__actions__);
- actions.push({ "func": func, "args": arguments, "thisArg": object });
- result2.__chain__ = chainAll;
- return result2;
- }
- return func.apply(object, arrayPush([this.value()], arguments));
- };
- }
- });
- return object;
- }
- function noConflict() {
- if (root._ === this) {
- root._ = oldDash;
- }
- return this;
- }
- function noop() {
- }
- function nthArg(n) {
- n = toInteger(n);
- return baseRest(function(args) {
- return baseNth(args, n);
- });
- }
- var over = createOver(arrayMap);
- var overEvery = createOver(arrayEvery);
- var overSome = createOver(arraySome);
- function property(path) {
- return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
- }
- function propertyOf(object) {
- return function(path) {
- return object == null ? undefined2 : baseGet(object, path);
- };
- }
- var range = createRange();
- var rangeRight = createRange(true);
- function stubArray() {
- return [];
- }
- function stubFalse() {
- return false;
- }
- function stubObject() {
- return {};
- }
- function stubString() {
- return "";
- }
- function stubTrue() {
- return true;
- }
- function times(n, iteratee2) {
- n = toInteger(n);
- if (n < 1 || n > MAX_SAFE_INTEGER) {
- return [];
- }
- var index = MAX_ARRAY_LENGTH, length = nativeMin(n, MAX_ARRAY_LENGTH);
- iteratee2 = getIteratee(iteratee2);
- n -= MAX_ARRAY_LENGTH;
- var result2 = baseTimes(length, iteratee2);
- while (++index < n) {
- iteratee2(index);
- }
- return result2;
- }
- function toPath(value) {
- if (isArray(value)) {
- return arrayMap(value, toKey);
- }
- return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
- }
- function uniqueId(prefix) {
- var id = ++idCounter;
- return toString(prefix) + id;
- }
- var add = createMathOperation(function(augend, addend) {
- return augend + addend;
- }, 0);
- var ceil = createRound("ceil");
- var divide = createMathOperation(function(dividend, divisor) {
- return dividend / divisor;
- }, 1);
- var floor = createRound("floor");
- function max(array) {
- return array && array.length ? baseExtremum(array, identity, baseGt) : undefined2;
- }
- function maxBy(array, iteratee2) {
- return array && array.length ? baseExtremum(array, getIteratee(iteratee2, 2), baseGt) : undefined2;
- }
- function mean(array) {
- return baseMean(array, identity);
- }
- function meanBy(array, iteratee2) {
- return baseMean(array, getIteratee(iteratee2, 2));
- }
- function min(array) {
- return array && array.length ? baseExtremum(array, identity, baseLt) : undefined2;
- }
- function minBy(array, iteratee2) {
- return array && array.length ? baseExtremum(array, getIteratee(iteratee2, 2), baseLt) : undefined2;
- }
- var multiply = createMathOperation(function(multiplier, multiplicand) {
- return multiplier * multiplicand;
- }, 1);
- var round = createRound("round");
- var subtract = createMathOperation(function(minuend, subtrahend) {
- return minuend - subtrahend;
- }, 0);
- function sum(array) {
- return array && array.length ? baseSum(array, identity) : 0;
- }
- function sumBy(array, iteratee2) {
- return array && array.length ? baseSum(array, getIteratee(iteratee2, 2)) : 0;
- }
- lodash.after = after;
- lodash.ary = ary;
- lodash.assign = assign;
- lodash.assignIn = assignIn;
- lodash.assignInWith = assignInWith;
- lodash.assignWith = assignWith;
- lodash.at = at;
- lodash.before = before;
- lodash.bind = bind;
- lodash.bindAll = bindAll;
- lodash.bindKey = bindKey;
- lodash.castArray = castArray;
- lodash.chain = chain;
- lodash.chunk = chunk;
- lodash.compact = compact;
- lodash.concat = concat;
- lodash.cond = cond;
- lodash.conforms = conforms;
- lodash.constant = constant;
- lodash.countBy = countBy;
- lodash.create = create;
- lodash.curry = curry;
- lodash.curryRight = curryRight;
- lodash.debounce = debounce;
- lodash.defaults = defaults;
- lodash.defaultsDeep = defaultsDeep;
- lodash.defer = defer;
- lodash.delay = delay;
- lodash.difference = difference;
- lodash.differenceBy = differenceBy;
- lodash.differenceWith = differenceWith;
- lodash.drop = drop;
- lodash.dropRight = dropRight;
- lodash.dropRightWhile = dropRightWhile;
- lodash.dropWhile = dropWhile;
- lodash.fill = fill;
- lodash.filter = filter;
- lodash.flatMap = flatMap;
- lodash.flatMapDeep = flatMapDeep;
- lodash.flatMapDepth = flatMapDepth;
- lodash.flatten = flatten;
- lodash.flattenDeep = flattenDeep;
- lodash.flattenDepth = flattenDepth;
- lodash.flip = flip;
- lodash.flow = flow;
- lodash.flowRight = flowRight;
- lodash.fromPairs = fromPairs;
- lodash.functions = functions;
- lodash.functionsIn = functionsIn;
- lodash.groupBy = groupBy;
- lodash.initial = initial;
- lodash.intersection = intersection;
- lodash.intersectionBy = intersectionBy;
- lodash.intersectionWith = intersectionWith;
- lodash.invert = invert;
- lodash.invertBy = invertBy;
- lodash.invokeMap = invokeMap;
- lodash.iteratee = iteratee;
- lodash.keyBy = keyBy;
- lodash.keys = keys;
- lodash.keysIn = keysIn;
- lodash.map = map;
- lodash.mapKeys = mapKeys;
- lodash.mapValues = mapValues;
- lodash.matches = matches;
- lodash.matchesProperty = matchesProperty;
- lodash.memoize = memoize;
- lodash.merge = merge;
- lodash.mergeWith = mergeWith;
- lodash.method = method;
- lodash.methodOf = methodOf;
- lodash.mixin = mixin;
- lodash.negate = negate;
- lodash.nthArg = nthArg;
- lodash.omit = omit;
- lodash.omitBy = omitBy;
- lodash.once = once;
- lodash.orderBy = orderBy;
- lodash.over = over;
- lodash.overArgs = overArgs;
- lodash.overEvery = overEvery;
- lodash.overSome = overSome;
- lodash.partial = partial;
- lodash.partialRight = partialRight;
- lodash.partition = partition;
- lodash.pick = pick;
- lodash.pickBy = pickBy;
- lodash.property = property;
- lodash.propertyOf = propertyOf;
- lodash.pull = pull;
- lodash.pullAll = pullAll;
- lodash.pullAllBy = pullAllBy;
- lodash.pullAllWith = pullAllWith;
- lodash.pullAt = pullAt;
- lodash.range = range;
- lodash.rangeRight = rangeRight;
- lodash.rearg = rearg;
- lodash.reject = reject;
- lodash.remove = remove;
- lodash.rest = rest;
- lodash.reverse = reverse;
- lodash.sampleSize = sampleSize;
- lodash.set = set;
- lodash.setWith = setWith;
- lodash.shuffle = shuffle;
- lodash.slice = slice;
- lodash.sortBy = sortBy;
- lodash.sortedUniq = sortedUniq;
- lodash.sortedUniqBy = sortedUniqBy;
- lodash.split = split;
- lodash.spread = spread;
- lodash.tail = tail;
- lodash.take = take;
- lodash.takeRight = takeRight;
- lodash.takeRightWhile = takeRightWhile;
- lodash.takeWhile = takeWhile;
- lodash.tap = tap;
- lodash.throttle = throttle;
- lodash.thru = thru;
- lodash.toArray = toArray2;
- lodash.toPairs = toPairs;
- lodash.toPairsIn = toPairsIn;
- lodash.toPath = toPath;
- lodash.toPlainObject = toPlainObject;
- lodash.transform = transform;
- lodash.unary = unary;
- lodash.union = union;
- lodash.unionBy = unionBy;
- lodash.unionWith = unionWith;
- lodash.uniq = uniq;
- lodash.uniqBy = uniqBy;
- lodash.uniqWith = uniqWith;
- lodash.unset = unset;
- lodash.unzip = unzip;
- lodash.unzipWith = unzipWith;
- lodash.update = update;
- lodash.updateWith = updateWith;
- lodash.values = values;
- lodash.valuesIn = valuesIn;
- lodash.without = without;
- lodash.words = words;
- lodash.wrap = wrap;
- lodash.xor = xor;
- lodash.xorBy = xorBy;
- lodash.xorWith = xorWith;
- lodash.zip = zip;
- lodash.zipObject = zipObject;
- lodash.zipObjectDeep = zipObjectDeep;
- lodash.zipWith = zipWith;
- lodash.entries = toPairs;
- lodash.entriesIn = toPairsIn;
- lodash.extend = assignIn;
- lodash.extendWith = assignInWith;
- mixin(lodash, lodash);
- lodash.add = add;
- lodash.attempt = attempt;
- lodash.camelCase = camelCase;
- lodash.capitalize = capitalize;
- lodash.ceil = ceil;
- lodash.clamp = clamp;
- lodash.clone = clone;
- lodash.cloneDeep = cloneDeep;
- lodash.cloneDeepWith = cloneDeepWith;
- lodash.cloneWith = cloneWith;
- lodash.conformsTo = conformsTo;
- lodash.deburr = deburr;
- lodash.defaultTo = defaultTo;
- lodash.divide = divide;
- lodash.endsWith = endsWith;
- lodash.eq = eq;
- lodash.escape = escape2;
- lodash.escapeRegExp = escapeRegExp;
- lodash.every = every;
- lodash.find = find;
- lodash.findIndex = findIndex;
- lodash.findKey = findKey;
- lodash.findLast = findLast;
- lodash.findLastIndex = findLastIndex;
- lodash.findLastKey = findLastKey;
- lodash.floor = floor;
- lodash.forEach = forEach;
- lodash.forEachRight = forEachRight;
- lodash.forIn = forIn;
- lodash.forInRight = forInRight;
- lodash.forOwn = forOwn;
- lodash.forOwnRight = forOwnRight;
- lodash.get = get;
- lodash.gt = gt;
- lodash.gte = gte;
- lodash.has = has;
- lodash.hasIn = hasIn;
- lodash.head = head;
- lodash.identity = identity;
- lodash.includes = includes;
- lodash.indexOf = indexOf;
- lodash.inRange = inRange;
- lodash.invoke = invoke;
- lodash.isArguments = isArguments;
- lodash.isArray = isArray;
- lodash.isArrayBuffer = isArrayBuffer;
- lodash.isArrayLike = isArrayLike;
- lodash.isArrayLikeObject = isArrayLikeObject;
- lodash.isBoolean = isBoolean;
- lodash.isBuffer = isBuffer;
- lodash.isDate = isDate;
- lodash.isElement = isElement;
- lodash.isEmpty = isEmpty;
- lodash.isEqual = isEqual;
- lodash.isEqualWith = isEqualWith;
- lodash.isError = isError;
- lodash.isFinite = isFinite2;
- lodash.isFunction = isFunction;
- lodash.isInteger = isInteger;
- lodash.isLength = isLength;
- lodash.isMap = isMap;
- lodash.isMatch = isMatch;
- lodash.isMatchWith = isMatchWith;
- lodash.isNaN = isNaN2;
- lodash.isNative = isNative;
- lodash.isNil = isNil;
- lodash.isNull = isNull;
- lodash.isNumber = isNumber;
- lodash.isObject = isObject;
- lodash.isObjectLike = isObjectLike;
- lodash.isPlainObject = isPlainObject;
- lodash.isRegExp = isRegExp;
- lodash.isSafeInteger = isSafeInteger;
- lodash.isSet = isSet;
- lodash.isString = isString;
- lodash.isSymbol = isSymbol;
- lodash.isTypedArray = isTypedArray;
- lodash.isUndefined = isUndefined;
- lodash.isWeakMap = isWeakMap;
- lodash.isWeakSet = isWeakSet;
- lodash.join = join;
- lodash.kebabCase = kebabCase;
- lodash.last = last;
- lodash.lastIndexOf = lastIndexOf;
- lodash.lowerCase = lowerCase;
- lodash.lowerFirst = lowerFirst;
- lodash.lt = lt;
- lodash.lte = lte;
- lodash.max = max;
- lodash.maxBy = maxBy;
- lodash.mean = mean;
- lodash.meanBy = meanBy;
- lodash.min = min;
- lodash.minBy = minBy;
- lodash.stubArray = stubArray;
- lodash.stubFalse = stubFalse;
- lodash.stubObject = stubObject;
- lodash.stubString = stubString;
- lodash.stubTrue = stubTrue;
- lodash.multiply = multiply;
- lodash.nth = nth;
- lodash.noConflict = noConflict;
- lodash.noop = noop;
- lodash.now = now;
- lodash.pad = pad;
- lodash.padEnd = padEnd;
- lodash.padStart = padStart;
- lodash.parseInt = parseInt2;
- lodash.random = random;
- lodash.reduce = reduce;
- lodash.reduceRight = reduceRight;
- lodash.repeat = repeat;
- lodash.replace = replace;
- lodash.result = result;
- lodash.round = round;
- lodash.runInContext = runInContext2;
- lodash.sample = sample;
- lodash.size = size;
- lodash.snakeCase = snakeCase;
- lodash.some = some;
- lodash.sortedIndex = sortedIndex;
- lodash.sortedIndexBy = sortedIndexBy;
- lodash.sortedIndexOf = sortedIndexOf;
- lodash.sortedLastIndex = sortedLastIndex;
- lodash.sortedLastIndexBy = sortedLastIndexBy;
- lodash.sortedLastIndexOf = sortedLastIndexOf;
- lodash.startCase = startCase;
- lodash.startsWith = startsWith;
- lodash.subtract = subtract;
- lodash.sum = sum;
- lodash.sumBy = sumBy;
- lodash.template = template;
- lodash.times = times;
- lodash.toFinite = toFinite;
- lodash.toInteger = toInteger;
- lodash.toLength = toLength;
- lodash.toLower = toLower;
- lodash.toNumber = toNumber;
- lodash.toSafeInteger = toSafeInteger;
- lodash.toString = toString;
- lodash.toUpper = toUpper;
- lodash.trim = trim;
- lodash.trimEnd = trimEnd;
- lodash.trimStart = trimStart;
- lodash.truncate = truncate;
- lodash.unescape = unescape2;
- lodash.uniqueId = uniqueId;
- lodash.upperCase = upperCase;
- lodash.upperFirst = upperFirst;
- lodash.each = forEach;
- lodash.eachRight = forEachRight;
- lodash.first = head;
- mixin(lodash, function() {
- var source = {};
- baseForOwn(lodash, function(func, methodName) {
- if (!hasOwnProperty.call(lodash.prototype, methodName)) {
- source[methodName] = func;
- }
- });
- return source;
- }(), { "chain": false });
- lodash.VERSION = VERSION;
- arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
- lodash[methodName].placeholder = lodash;
- });
- arrayEach(["drop", "take"], function(methodName, index) {
- LazyWrapper.prototype[methodName] = function(n) {
- n = n === undefined2 ? 1 : nativeMax(toInteger(n), 0);
- var result2 = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone();
- if (result2.__filtered__) {
- result2.__takeCount__ = nativeMin(n, result2.__takeCount__);
- } else {
- result2.__views__.push({
- "size": nativeMin(n, MAX_ARRAY_LENGTH),
- "type": methodName + (result2.__dir__ < 0 ? "Right" : "")
- });
- }
- return result2;
- };
- LazyWrapper.prototype[methodName + "Right"] = function(n) {
- return this.reverse()[methodName](n).reverse();
- };
- });
- arrayEach(["filter", "map", "takeWhile"], function(methodName, index) {
- var type = index + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
- LazyWrapper.prototype[methodName] = function(iteratee2) {
- var result2 = this.clone();
- result2.__iteratees__.push({
- "iteratee": getIteratee(iteratee2, 3),
- "type": type
- });
- result2.__filtered__ = result2.__filtered__ || isFilter;
- return result2;
- };
- });
- arrayEach(["head", "last"], function(methodName, index) {
- var takeName = "take" + (index ? "Right" : "");
- LazyWrapper.prototype[methodName] = function() {
- return this[takeName](1).value()[0];
- };
- });
- arrayEach(["initial", "tail"], function(methodName, index) {
- var dropName = "drop" + (index ? "" : "Right");
- LazyWrapper.prototype[methodName] = function() {
- return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
- };
- });
- LazyWrapper.prototype.compact = function() {
- return this.filter(identity);
- };
- LazyWrapper.prototype.find = function(predicate) {
- return this.filter(predicate).head();
- };
- LazyWrapper.prototype.findLast = function(predicate) {
- return this.reverse().find(predicate);
- };
- LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
- if (typeof path == "function") {
- return new LazyWrapper(this);
- }
- return this.map(function(value) {
- return baseInvoke(value, path, args);
- });
- });
- LazyWrapper.prototype.reject = function(predicate) {
- return this.filter(negate(getIteratee(predicate)));
- };
- LazyWrapper.prototype.slice = function(start, end) {
- start = toInteger(start);
- var result2 = this;
- if (result2.__filtered__ && (start > 0 || end < 0)) {
- return new LazyWrapper(result2);
- }
- if (start < 0) {
- result2 = result2.takeRight(-start);
- } else if (start) {
- result2 = result2.drop(start);
- }
- if (end !== undefined2) {
- end = toInteger(end);
- result2 = end < 0 ? result2.dropRight(-end) : result2.take(end - start);
- }
- return result2;
- };
- LazyWrapper.prototype.takeRightWhile = function(predicate) {
- return this.reverse().takeWhile(predicate).reverse();
- };
- LazyWrapper.prototype.toArray = function() {
- return this.take(MAX_ARRAY_LENGTH);
- };
- baseForOwn(LazyWrapper.prototype, function(func, methodName) {
- var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash[isTaker ? "take" + (methodName == "last" ? "Right" : "") : methodName], retUnwrapped = isTaker || /^find/.test(methodName);
- if (!lodashFunc) {
- return;
- }
- lodash.prototype[methodName] = function() {
- var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray(value);
- var interceptor = function(value2) {
- var result3 = lodashFunc.apply(lodash, arrayPush([value2], args));
- return isTaker && chainAll ? result3[0] : result3;
- };
- if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) {
- isLazy = useLazy = false;
- }
- var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
- if (!retUnwrapped && useLazy) {
- value = onlyLazy ? value : new LazyWrapper(this);
- var result2 = func.apply(value, args);
- result2.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": undefined2 });
- return new LodashWrapper(result2, chainAll);
- }
- if (isUnwrapped && onlyLazy) {
- return func.apply(this, args);
- }
- result2 = this.thru(interceptor);
- return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2;
- };
- });
- arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
- var func = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
- lodash.prototype[methodName] = function() {
- var args = arguments;
- if (retUnwrapped && !this.__chain__) {
- var value = this.value();
- return func.apply(isArray(value) ? value : [], args);
- }
- return this[chainName](function(value2) {
- return func.apply(isArray(value2) ? value2 : [], args);
- });
- };
- });
- baseForOwn(LazyWrapper.prototype, function(func, methodName) {
- var lodashFunc = lodash[methodName];
- if (lodashFunc) {
- var key = lodashFunc.name + "";
- if (!hasOwnProperty.call(realNames, key)) {
- realNames[key] = [];
- }
- realNames[key].push({ "name": methodName, "func": lodashFunc });
- }
- });
- realNames[createHybrid(undefined2, WRAP_BIND_KEY_FLAG).name] = [{
- "name": "wrapper",
- "func": undefined2
- }];
- LazyWrapper.prototype.clone = lazyClone;
- LazyWrapper.prototype.reverse = lazyReverse;
- LazyWrapper.prototype.value = lazyValue;
- lodash.prototype.at = wrapperAt;
- lodash.prototype.chain = wrapperChain;
- lodash.prototype.commit = wrapperCommit;
- lodash.prototype.next = wrapperNext;
- lodash.prototype.plant = wrapperPlant;
- lodash.prototype.reverse = wrapperReverse;
- lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
- lodash.prototype.first = lodash.prototype.head;
- if (symIterator) {
- lodash.prototype[symIterator] = wrapperToIterator;
- }
- return lodash;
- };
- var _2 = runInContext();
- if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
- root._ = _2;
- define(function() {
- return _2;
- });
- } else if (freeModule) {
- (freeModule.exports = _2)._ = _2;
- freeExports._ = _2;
- } else {
- root._ = _2;
- }
- }).call(exports2);
- }
-});
-
-// ../../node_modules/openapi-to-postmanv2/lib/bundleRules/spec30.js
-var require_spec30 = __commonJS({
- "../../node_modules/openapi-to-postmanv2/lib/bundleRules/spec30.js"(exports2, module2) {
- var SCHEMA_CONTAINERS = [
- "allOf",
- "oneOf",
- "anyOf",
- "not",
- "additionalProperties",
- "items",
- "schema"
- ];
- var EXAMPLE_CONTAINERS = [];
- var REQUEST_BODY_CONTAINER = [
- "requestBody"
- ];
- var CONTAINERS = {
- schemas: SCHEMA_CONTAINERS,
- examples: EXAMPLE_CONTAINERS,
- requestBodies: REQUEST_BODY_CONTAINER
- };
- var DEFINITIONS = {
- headers: "headers",
- responses: "responses",
- callbacks: "callbacks",
- properties: "schemas",
- links: "links",
- examples: "examples"
- };
- var INLINE = [
- "properties",
- "value",
- "example"
- ];
- var ROOT_CONTAINERS_KEYS = [
- "components"
- ];
- var COMPONENTS_KEYS = [
- "schemas",
- "responses",
- "parameters",
- "examples",
- "requestBodies",
- "headers",
- "securitySchemes",
- "links",
- "callbacks"
- ];
- module2.exports = {
- RULES_30: {
- CONTAINERS,
- DEFINITIONS,
- COMPONENTS_KEYS,
- INLINE,
- ROOT_CONTAINERS_KEYS
- }
- };
- }
-});
-
-// ../../node_modules/openapi-to-postmanv2/lib/bundleRules/spec31.js
-var require_spec31 = __commonJS({
- "../../node_modules/openapi-to-postmanv2/lib/bundleRules/spec31.js"(exports2, module2) {
- var SCHEMA_CONTAINERS = [
- "allOf",
- "oneOf",
- "anyOf",
- "not",
- "additionalProperties",
- "items",
- "schema"
- ];
- var EXAMPLE_CONTAINERS = [];
- var REQUEST_BODY_CONTAINER = [
- "requestBody"
- ];
- var CONTAINERS = {
- schemas: SCHEMA_CONTAINERS,
- examples: EXAMPLE_CONTAINERS,
- requestBodies: REQUEST_BODY_CONTAINER
- };
- var DEFINITIONS = {
- headers: "headers",
- responses: "responses",
- callbacks: "callbacks",
- properties: "schemas",
- links: "links",
- paths: "pathItems",
- examples: "examples"
- };
- var INLINE = [
- "properties",
- "value",
- "example"
- ];
- var ROOT_CONTAINERS_KEYS = [
- "components"
- ];
- var COMPONENTS_KEYS = [
- "schemas",
- "responses",
- "parameters",
- "examples",
- "requestBodies",
- "headers",
- "securitySchemes",
- "links",
- "callbacks",
- "pathItems"
- ];
- module2.exports = {
- RULES_31: {
- CONTAINERS,
- DEFINITIONS,
- COMPONENTS_KEYS,
- INLINE,
- ROOT_CONTAINERS_KEYS
- }
- };
- }
-});
-
-// ../../node_modules/openapi-to-postmanv2/lib/bundleRules/spec20.js
-var require_spec20 = __commonJS({
- "../../node_modules/openapi-to-postmanv2/lib/bundleRules/spec20.js"(exports2, module2) {
- var SCHEMA_CONTAINERS = [
- "schema",
- "items",
- "allOf",
- "additionalProperties"
- ];
- var CONTAINERS = {
- definitions: SCHEMA_CONTAINERS
- };
- var DEFINITIONS = {
- properties: "definitions",
- responses: "responses"
- };
- var INLINE = [
- "examples",
- "value",
- "example"
- ];
- var COMPONENTS_KEYS = [
- "definitions",
- "parameters",
- "responses",
- "securityDefinitions"
- ];
- var ROOT_CONTAINERS_KEYS = COMPONENTS_KEYS;
- module2.exports = {
- RULES_20: {
- CONTAINERS,
- DEFINITIONS,
- COMPONENTS_KEYS,
- INLINE,
- ROOT_CONTAINERS_KEYS
- }
- };
- }
-});
-
-// ../../node_modules/openapi-to-postmanv2/lib/30XUtils/inputValidation.js
-var require_inputValidation = __commonJS({
- "../../node_modules/openapi-to-postmanv2/lib/30XUtils/inputValidation.js"(exports2, module2) {
- var _2 = require_lodash();
- module2.exports = {
- /**
- * Validate Spec to check if some of the required fields are present.
- *
- * @param {Object} spec OpenAPI spec
- * @return {Object} Validation result
- */
- validateSpec: function(spec) {
- if (_2.isNil(spec)) {
- return {
- result: false,
- reason: "The Specification is null or undefined"
- };
- }
- if (_2.isNil(spec.openapi)) {
- return {
- result: false,
- reason: "Specification must contain a semantic version number of the OAS specification"
- };
- }
- if (_2.isNil(spec.paths)) {
- return {
- result: false,
- reason: "Specification must contain Paths Object for the available operational paths"
- };
- }
- if (_2.isNil(spec.info)) {
- return {
- result: false,
- reason: "Specification must contain an Info Object for the meta-data of the API"
- };
- }
- if (!_2.has(spec.info, "$ref")) {
- if (_2.isNil(_2.get(spec, "info.title"))) {
- return {
- result: false,
- reason: "Specification must contain a title in order to generate a collection"
- };
- }
- if (_2.isNil(_2.get(spec, "info.version"))) {
- return {
- result: false,
- reason: "Specification must contain a semantic version number of the API in the Info Object"
- };
- }
- }
- return {
- result: true,
- openapi: spec
- };
- }
- };
- }
-});
-
-// ../../node_modules/js-yaml/lib/common.js
-var require_common = __commonJS({
- "../../node_modules/js-yaml/lib/common.js"(exports2, module2) {
- "use strict";
- function isNothing(subject) {
- return typeof subject === "undefined" || subject === null;
- }
- function isObject(subject) {
- return typeof subject === "object" && subject !== null;
- }
- function toArray2(sequence) {
- if (Array.isArray(sequence)) return sequence;
- else if (isNothing(sequence)) return [];
- return [sequence];
- }
- function extend(target, source) {
- var index, length, key, sourceKeys;
- if (source) {
- sourceKeys = Object.keys(source);
- for (index = 0, length = sourceKeys.length; index < length; index += 1) {
- key = sourceKeys[index];
- target[key] = source[key];
- }
- }
- return target;
- }
- function repeat(string, count) {
- var result = "", cycle;
- for (cycle = 0; cycle < count; cycle += 1) {
- result += string;
- }
- return result;
- }
- function isNegativeZero(number) {
- return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
- }
- module2.exports.isNothing = isNothing;
- module2.exports.isObject = isObject;
- module2.exports.toArray = toArray2;
- module2.exports.repeat = repeat;
- module2.exports.isNegativeZero = isNegativeZero;
- module2.exports.extend = extend;
- }
-});
-
-// ../../node_modules/js-yaml/lib/exception.js
-var require_exception = __commonJS({
- "../../node_modules/js-yaml/lib/exception.js"(exports2, module2) {
- "use strict";
- function formatError(exception, compact) {
- var where = "", message = exception.reason || "(unknown reason)";
- if (!exception.mark) return message;
- if (exception.mark.name) {
- where += 'in "' + exception.mark.name + '" ';
- }
- where += "(" + (exception.mark.line + 1) + ":" + (exception.mark.column + 1) + ")";
- if (!compact && exception.mark.snippet) {
- where += "\n\n" + exception.mark.snippet;
- }
- return message + " " + where;
- }
- function YAMLException(reason, mark) {
- Error.call(this);
- this.name = "YAMLException";
- this.reason = reason;
- this.mark = mark;
- this.message = formatError(this, false);
- if (Error.captureStackTrace) {
- Error.captureStackTrace(this, this.constructor);
- } else {
- this.stack = new Error().stack || "";
- }
- }
- YAMLException.prototype = Object.create(Error.prototype);
- YAMLException.prototype.constructor = YAMLException;
- YAMLException.prototype.toString = function toString(compact) {
- return this.name + ": " + formatError(this, compact);
- };
- module2.exports = YAMLException;
- }
-});
-
-// ../../node_modules/js-yaml/lib/snippet.js
-var require_snippet = __commonJS({
- "../../node_modules/js-yaml/lib/snippet.js"(exports2, module2) {
- "use strict";
- var common = require_common();
- function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
- var head = "";
- var tail = "";
- var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
- if (position - lineStart > maxHalfLength) {
- head = " ... ";
- lineStart = position - maxHalfLength + head.length;
- }
- if (lineEnd - position > maxHalfLength) {
- tail = " ...";
- lineEnd = position + maxHalfLength - tail.length;
- }
- return {
- str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "\u2192") + tail,
- pos: position - lineStart + head.length
- // relative position
- };
- }
- function padStart(string, max) {
- return common.repeat(" ", max - string.length) + string;
- }
- function makeSnippet(mark, options) {
- options = Object.create(options || null);
- if (!mark.buffer) return null;
- if (!options.maxLength) options.maxLength = 79;
- if (typeof options.indent !== "number") options.indent = 1;
- if (typeof options.linesBefore !== "number") options.linesBefore = 3;
- if (typeof options.linesAfter !== "number") options.linesAfter = 2;
- var re = /\r?\n|\r|\0/g;
- var lineStarts = [0];
- var lineEnds = [];
- var match;
- var foundLineNo = -1;
- while (match = re.exec(mark.buffer)) {
- lineEnds.push(match.index);
- lineStarts.push(match.index + match[0].length);
- if (mark.position <= match.index && foundLineNo < 0) {
- foundLineNo = lineStarts.length - 2;
- }
- }
- if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
- var result = "", i, line;
- var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
- var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
- for (i = 1; i <= options.linesBefore; i++) {
- if (foundLineNo - i < 0) break;
- line = getLine(
- mark.buffer,
- lineStarts[foundLineNo - i],
- lineEnds[foundLineNo - i],
- mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),
- maxLineLength
- );
- result = common.repeat(" ", options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line.str + "\n" + result;
- }
- line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
- result += common.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + "\n";
- result += common.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^\n";
- for (i = 1; i <= options.linesAfter; i++) {
- if (foundLineNo + i >= lineEnds.length) break;
- line = getLine(
- mark.buffer,
- lineStarts[foundLineNo + i],
- lineEnds[foundLineNo + i],
- mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),
- maxLineLength
- );
- result += common.repeat(" ", options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line.str + "\n";
- }
- return result.replace(/\n$/, "");
- }
- module2.exports = makeSnippet;
- }
-});
-
-// ../../node_modules/js-yaml/lib/type.js
-var require_type = __commonJS({
- "../../node_modules/js-yaml/lib/type.js"(exports2, module2) {
- "use strict";
- var YAMLException = require_exception();
- var TYPE_CONSTRUCTOR_OPTIONS = [
- "kind",
- "multi",
- "resolve",
- "construct",
- "instanceOf",
- "predicate",
- "represent",
- "representName",
- "defaultStyle",
- "styleAliases"
- ];
- var YAML_NODE_KINDS = [
- "scalar",
- "sequence",
- "mapping"
- ];
- function compileStyleAliases(map) {
- var result = {};
- if (map !== null) {
- Object.keys(map).forEach(function(style) {
- map[style].forEach(function(alias) {
- result[String(alias)] = style;
- });
- });
- }
- return result;
- }
- function Type(tag, options) {
- options = options || {};
- Object.keys(options).forEach(function(name) {
- if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
- throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
- }
- });
- this.options = options;
- this.tag = tag;
- this.kind = options["kind"] || null;
- this.resolve = options["resolve"] || function() {
- return true;
- };
- this.construct = options["construct"] || function(data) {
- return data;
- };
- this.instanceOf = options["instanceOf"] || null;
- this.predicate = options["predicate"] || null;
- this.represent = options["represent"] || null;
- this.representName = options["representName"] || null;
- this.defaultStyle = options["defaultStyle"] || null;
- this.multi = options["multi"] || false;
- this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
- if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
- throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
- }
- }
- module2.exports = Type;
- }
-});
-
-// ../../node_modules/js-yaml/lib/schema.js
-var require_schema = __commonJS({
- "../../node_modules/js-yaml/lib/schema.js"(exports2, module2) {
- "use strict";
- var YAMLException = require_exception();
- var Type = require_type();
- function compileList(schema2, name) {
- var result = [];
- schema2[name].forEach(function(currentType) {
- var newIndex = result.length;
- result.forEach(function(previousType, previousIndex) {
- if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
- newIndex = previousIndex;
- }
- });
- result[newIndex] = currentType;
- });
- return result;
- }
- function compileMap() {
- var result = {
- scalar: {},
- sequence: {},
- mapping: {},
- fallback: {},
- multi: {
- scalar: [],
- sequence: [],
- mapping: [],
- fallback: []
- }
- }, index, length;
- function collectType(type) {
- if (type.multi) {
- result.multi[type.kind].push(type);
- result.multi["fallback"].push(type);
- } else {
- result[type.kind][type.tag] = result["fallback"][type.tag] = type;
- }
- }
- for (index = 0, length = arguments.length; index < length; index += 1) {
- arguments[index].forEach(collectType);
- }
- return result;
- }
- function Schema(definition) {
- return this.extend(definition);
- }
- Schema.prototype.extend = function extend(definition) {
- var implicit = [];
- var explicit = [];
- if (definition instanceof Type) {
- explicit.push(definition);
- } else if (Array.isArray(definition)) {
- explicit = explicit.concat(definition);
- } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
- if (definition.implicit) implicit = implicit.concat(definition.implicit);
- if (definition.explicit) explicit = explicit.concat(definition.explicit);
- } else {
- throw new YAMLException("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
- }
- implicit.forEach(function(type) {
- if (!(type instanceof Type)) {
- throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
- }
- if (type.loadKind && type.loadKind !== "scalar") {
- throw new YAMLException("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
- }
- if (type.multi) {
- throw new YAMLException("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
- }
- });
- explicit.forEach(function(type) {
- if (!(type instanceof Type)) {
- throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
- }
- });
- var result = Object.create(Schema.prototype);
- result.implicit = (this.implicit || []).concat(implicit);
- result.explicit = (this.explicit || []).concat(explicit);
- result.compiledImplicit = compileList(result, "implicit");
- result.compiledExplicit = compileList(result, "explicit");
- result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
- return result;
- };
- module2.exports = Schema;
- }
-});
-
-// ../../node_modules/js-yaml/lib/type/str.js
-var require_str = __commonJS({
- "../../node_modules/js-yaml/lib/type/str.js"(exports2, module2) {
- "use strict";
- var Type = require_type();
- module2.exports = new Type("tag:yaml.org,2002:str", {
- kind: "scalar",
- construct: function(data) {
- return data !== null ? data : "";
- }
- });
- }
-});
-
-// ../../node_modules/js-yaml/lib/type/seq.js
-var require_seq = __commonJS({
- "../../node_modules/js-yaml/lib/type/seq.js"(exports2, module2) {
- "use strict";
- var Type = require_type();
- module2.exports = new Type("tag:yaml.org,2002:seq", {
- kind: "sequence",
- construct: function(data) {
- return data !== null ? data : [];
- }
- });
- }
-});
-
-// ../../node_modules/js-yaml/lib/type/map.js
-var require_map = __commonJS({
- "../../node_modules/js-yaml/lib/type/map.js"(exports2, module2) {
- "use strict";
- var Type = require_type();
- module2.exports = new Type("tag:yaml.org,2002:map", {
- kind: "mapping",
- construct: function(data) {
- return data !== null ? data : {};
- }
- });
- }
-});
-
-// ../../node_modules/js-yaml/lib/schema/failsafe.js
-var require_failsafe = __commonJS({
- "../../node_modules/js-yaml/lib/schema/failsafe.js"(exports2, module2) {
- "use strict";
- var Schema = require_schema();
- module2.exports = new Schema({
- explicit: [
- require_str(),
- require_seq(),
- require_map()
- ]
- });
- }
-});
-
-// ../../node_modules/js-yaml/lib/type/null.js
-var require_null = __commonJS({
- "../../node_modules/js-yaml/lib/type/null.js"(exports2, module2) {
- "use strict";
- var Type = require_type();
- function resolveYamlNull(data) {
- if (data === null) return true;
- var max = data.length;
- return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
- }
- function constructYamlNull() {
- return null;
- }
- function isNull(object) {
- return object === null;
- }
- module2.exports = new Type("tag:yaml.org,2002:null", {
- kind: "scalar",
- resolve: resolveYamlNull,
- construct: constructYamlNull,
- predicate: isNull,
- represent: {
- canonical: function() {
- return "~";
- },
- lowercase: function() {
- return "null";
- },
- uppercase: function() {
- return "NULL";
- },
- camelcase: function() {
- return "Null";
- },
- empty: function() {
- return "";
- }
- },
- defaultStyle: "lowercase"
- });
- }
-});
-
-// ../../node_modules/js-yaml/lib/type/bool.js
-var require_bool = __commonJS({
- "../../node_modules/js-yaml/lib/type/bool.js"(exports2, module2) {
- "use strict";
- var Type = require_type();
- function resolveYamlBoolean(data) {
- if (data === null) return false;
- var max = data.length;
- return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
- }
- function constructYamlBoolean(data) {
- return data === "true" || data === "True" || data === "TRUE";
- }
- function isBoolean(object) {
- return Object.prototype.toString.call(object) === "[object Boolean]";
- }
- module2.exports = new Type("tag:yaml.org,2002:bool", {
- kind: "scalar",
- resolve: resolveYamlBoolean,
- construct: constructYamlBoolean,
- predicate: isBoolean,
- represent: {
- lowercase: function(object) {
- return object ? "true" : "false";
- },
- uppercase: function(object) {
- return object ? "TRUE" : "FALSE";
- },
- camelcase: function(object) {
- return object ? "True" : "False";
- }
- },
- defaultStyle: "lowercase"
- });
- }
-});
-
-// ../../node_modules/js-yaml/lib/type/int.js
-var require_int = __commonJS({
- "../../node_modules/js-yaml/lib/type/int.js"(exports2, module2) {
- "use strict";
- var common = require_common();
- var Type = require_type();
- function isHexCode(c) {
- return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
- }
- function isOctCode(c) {
- return 48 <= c && c <= 55;
- }
- function isDecCode(c) {
- return 48 <= c && c <= 57;
- }
- function resolveYamlInteger(data) {
- if (data === null) return false;
- var max = data.length, index = 0, hasDigits = false, ch;
- if (!max) return false;
- ch = data[index];
- if (ch === "-" || ch === "+") {
- ch = data[++index];
- }
- if (ch === "0") {
- if (index + 1 === max) return true;
- ch = data[++index];
- if (ch === "b") {
- index++;
- for (; index < max; index++) {
- ch = data[index];
- if (ch === "_") continue;
- if (ch !== "0" && ch !== "1") return false;
- hasDigits = true;
- }
- return hasDigits && ch !== "_";
- }
- if (ch === "x") {
- index++;
- for (; index < max; index++) {
- ch = data[index];
- if (ch === "_") continue;
- if (!isHexCode(data.charCodeAt(index))) return false;
- hasDigits = true;
- }
- return hasDigits && ch !== "_";
- }
- if (ch === "o") {
- index++;
- for (; index < max; index++) {
- ch = data[index];
- if (ch === "_") continue;
- if (!isOctCode(data.charCodeAt(index))) return false;
- hasDigits = true;
- }
- return hasDigits && ch !== "_";
- }
- }
- if (ch === "_") return false;
- for (; index < max; index++) {
- ch = data[index];
- if (ch === "_") continue;
- if (!isDecCode(data.charCodeAt(index))) {
- return false;
- }
- hasDigits = true;
- }
- if (!hasDigits || ch === "_") return false;
- return true;
- }
- function constructYamlInteger(data) {
- var value = data, sign = 1, ch;
- if (value.indexOf("_") !== -1) {
- value = value.replace(/_/g, "");
- }
- ch = value[0];
- if (ch === "-" || ch === "+") {
- if (ch === "-") sign = -1;
- value = value.slice(1);
- ch = value[0];
- }
- if (value === "0") return 0;
- if (ch === "0") {
- if (value[1] === "b") return sign * parseInt(value.slice(2), 2);
- if (value[1] === "x") return sign * parseInt(value.slice(2), 16);
- if (value[1] === "o") return sign * parseInt(value.slice(2), 8);
- }
- return sign * parseInt(value, 10);
- }
- function isInteger(object) {
- return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
- }
- module2.exports = new Type("tag:yaml.org,2002:int", {
- kind: "scalar",
- resolve: resolveYamlInteger,
- construct: constructYamlInteger,
- predicate: isInteger,
- represent: {
- binary: function(obj) {
- return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
- },
- octal: function(obj) {
- return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
- },
- decimal: function(obj) {
- return obj.toString(10);
- },
- /* eslint-disable max-len */
- hexadecimal: function(obj) {
- return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
- }
- },
- defaultStyle: "decimal",
- styleAliases: {
- binary: [2, "bin"],
- octal: [8, "oct"],
- decimal: [10, "dec"],
- hexadecimal: [16, "hex"]
- }
- });
- }
-});
-
-// ../../node_modules/js-yaml/lib/type/float.js
-var require_float = __commonJS({
- "../../node_modules/js-yaml/lib/type/float.js"(exports2, module2) {
- "use strict";
- var common = require_common();
- var Type = require_type();
- var YAML_FLOAT_PATTERN = new RegExp(
- // 2.5e4, 2.5 and integers
- "^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
- );
- function resolveYamlFloat(data) {
- if (data === null) return false;
- if (!YAML_FLOAT_PATTERN.test(data) || // Quick hack to not allow integers end with `_`
- // Probably should update regexp & check speed
- data[data.length - 1] === "_") {
- return false;
- }
- return true;
- }
- function constructYamlFloat(data) {
- var value, sign;
- value = data.replace(/_/g, "").toLowerCase();
- sign = value[0] === "-" ? -1 : 1;
- if ("+-".indexOf(value[0]) >= 0) {
- value = value.slice(1);
- }
- if (value === ".inf") {
- return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
- } else if (value === ".nan") {
- return NaN;
- }
- return sign * parseFloat(value, 10);
- }
- var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
- function representYamlFloat(object, style) {
- var res;
- if (isNaN(object)) {
- switch (style) {
- case "lowercase":
- return ".nan";
- case "uppercase":
- return ".NAN";
- case "camelcase":
- return ".NaN";
- }
- } else if (Number.POSITIVE_INFINITY === object) {
- switch (style) {
- case "lowercase":
- return ".inf";
- case "uppercase":
- return ".INF";
- case "camelcase":
- return ".Inf";
- }
- } else if (Number.NEGATIVE_INFINITY === object) {
- switch (style) {
- case "lowercase":
- return "-.inf";
- case "uppercase":
- return "-.INF";
- case "camelcase":
- return "-.Inf";
- }
- } else if (common.isNegativeZero(object)) {
- return "-0.0";
- }
- res = object.toString(10);
- return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
- }
- function isFloat(object) {
- return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
- }
- module2.exports = new Type("tag:yaml.org,2002:float", {
- kind: "scalar",
- resolve: resolveYamlFloat,
- construct: constructYamlFloat,
- predicate: isFloat,
- represent: representYamlFloat,
- defaultStyle: "lowercase"
- });
- }
-});
-
-// ../../node_modules/js-yaml/lib/schema/json.js
-var require_json = __commonJS({
- "../../node_modules/js-yaml/lib/schema/json.js"(exports2, module2) {
- "use strict";
- module2.exports = require_failsafe().extend({
- implicit: [
- require_null(),
- require_bool(),
- require_int(),
- require_float()
- ]
- });
- }
-});
-
-// ../../node_modules/js-yaml/lib/schema/core.js
-var require_core = __commonJS({
- "../../node_modules/js-yaml/lib/schema/core.js"(exports2, module2) {
- "use strict";
- module2.exports = require_json();
- }
-});
-
-// ../../node_modules/js-yaml/lib/type/timestamp.js
-var require_timestamp = __commonJS({
- "../../node_modules/js-yaml/lib/type/timestamp.js"(exports2, module2) {
- "use strict";
- var Type = require_type();
- var YAML_DATE_REGEXP = new RegExp(
- "^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
- );
- var YAML_TIMESTAMP_REGEXP = new RegExp(
- "^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"
- );
- function resolveYamlTimestamp(data) {
- if (data === null) return false;
- if (YAML_DATE_REGEXP.exec(data) !== null) return true;
- if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
- return false;
- }
- function constructYamlTimestamp(data) {
- var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
- match = YAML_DATE_REGEXP.exec(data);
- if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
- if (match === null) throw new Error("Date resolve error");
- year = +match[1];
- month = +match[2] - 1;
- day = +match[3];
- if (!match[4]) {
- return new Date(Date.UTC(year, month, day));
- }
- hour = +match[4];
- minute = +match[5];
- second = +match[6];
- if (match[7]) {
- fraction = match[7].slice(0, 3);
- while (fraction.length < 3) {
- fraction += "0";
- }
- fraction = +fraction;
- }
- if (match[9]) {
- tz_hour = +match[10];
- tz_minute = +(match[11] || 0);
- delta = (tz_hour * 60 + tz_minute) * 6e4;
- if (match[9] === "-") delta = -delta;
- }
- date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
- if (delta) date.setTime(date.getTime() - delta);
- return date;
- }
- function representYamlTimestamp(object) {
- return object.toISOString();
- }
- module2.exports = new Type("tag:yaml.org,2002:timestamp", {
- kind: "scalar",
- resolve: resolveYamlTimestamp,
- construct: constructYamlTimestamp,
- instanceOf: Date,
- represent: representYamlTimestamp
- });
- }
-});
-
-// ../../node_modules/js-yaml/lib/type/merge.js
-var require_merge = __commonJS({
- "../../node_modules/js-yaml/lib/type/merge.js"(exports2, module2) {
- "use strict";
- var Type = require_type();
- function resolveYamlMerge(data) {
- return data === "<<" || data === null;
- }
- module2.exports = new Type("tag:yaml.org,2002:merge", {
- kind: "scalar",
- resolve: resolveYamlMerge
- });
- }
-});
-
-// ../../node_modules/js-yaml/lib/type/binary.js
-var require_binary = __commonJS({
- "../../node_modules/js-yaml/lib/type/binary.js"(exports2, module2) {
- "use strict";
- var Type = require_type();
- var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
- function resolveYamlBinary(data) {
- if (data === null) return false;
- var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;
- for (idx = 0; idx < max; idx++) {
- code = map.indexOf(data.charAt(idx));
- if (code > 64) continue;
- if (code < 0) return false;
- bitlen += 6;
- }
- return bitlen % 8 === 0;
- }
- function constructYamlBinary(data) {
- var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map = BASE64_MAP, bits = 0, result = [];
- for (idx = 0; idx < max; idx++) {
- if (idx % 4 === 0 && idx) {
- result.push(bits >> 16 & 255);
- result.push(bits >> 8 & 255);
- result.push(bits & 255);
- }
- bits = bits << 6 | map.indexOf(input.charAt(idx));
- }
- tailbits = max % 4 * 6;
- if (tailbits === 0) {
- result.push(bits >> 16 & 255);
- result.push(bits >> 8 & 255);
- result.push(bits & 255);
- } else if (tailbits === 18) {
- result.push(bits >> 10 & 255);
- result.push(bits >> 2 & 255);
- } else if (tailbits === 12) {
- result.push(bits >> 4 & 255);
- }
- return new Uint8Array(result);
- }
- function representYamlBinary(object) {
- var result = "", bits = 0, idx, tail, max = object.length, map = BASE64_MAP;
- for (idx = 0; idx < max; idx++) {
- if (idx % 3 === 0 && idx) {
- result += map[bits >> 18 & 63];
- result += map[bits >> 12 & 63];
- result += map[bits >> 6 & 63];
- result += map[bits & 63];
- }
- bits = (bits << 8) + object[idx];
- }
- tail = max % 3;
- if (tail === 0) {
- result += map[bits >> 18 & 63];
- result += map[bits >> 12 & 63];
- result += map[bits >> 6 & 63];
- result += map[bits & 63];
- } else if (tail === 2) {
- result += map[bits >> 10 & 63];
- result += map[bits >> 4 & 63];
- result += map[bits << 2 & 63];
- result += map[64];
- } else if (tail === 1) {
- result += map[bits >> 2 & 63];
- result += map[bits << 4 & 63];
- result += map[64];
- result += map[64];
- }
- return result;
- }
- function isBinary(obj) {
- return Object.prototype.toString.call(obj) === "[object Uint8Array]";
- }
- module2.exports = new Type("tag:yaml.org,2002:binary", {
- kind: "scalar",
- resolve: resolveYamlBinary,
- construct: constructYamlBinary,
- predicate: isBinary,
- represent: representYamlBinary
- });
- }
-});
-
-// ../../node_modules/js-yaml/lib/type/omap.js
-var require_omap = __commonJS({
- "../../node_modules/js-yaml/lib/type/omap.js"(exports2, module2) {
- "use strict";
- var Type = require_type();
- var _hasOwnProperty = Object.prototype.hasOwnProperty;
- var _toString = Object.prototype.toString;
- function resolveYamlOmap(data) {
- if (data === null) return true;
- var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data;
- for (index = 0, length = object.length; index < length; index += 1) {
- pair = object[index];
- pairHasKey = false;
- if (_toString.call(pair) !== "[object Object]") return false;
- for (pairKey in pair) {
- if (_hasOwnProperty.call(pair, pairKey)) {
- if (!pairHasKey) pairHasKey = true;
- else return false;
- }
- }
- if (!pairHasKey) return false;
- if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
- else return false;
- }
- return true;
- }
- function constructYamlOmap(data) {
- return data !== null ? data : [];
- }
- module2.exports = new Type("tag:yaml.org,2002:omap", {
- kind: "sequence",
- resolve: resolveYamlOmap,
- construct: constructYamlOmap
- });
- }
-});
-
-// ../../node_modules/js-yaml/lib/type/pairs.js
-var require_pairs = __commonJS({
- "../../node_modules/js-yaml/lib/type/pairs.js"(exports2, module2) {
- "use strict";
- var Type = require_type();
- var _toString = Object.prototype.toString;
- function resolveYamlPairs(data) {
- if (data === null) return true;
- var index, length, pair, keys, result, object = data;
- result = new Array(object.length);
- for (index = 0, length = object.length; index < length; index += 1) {
- pair = object[index];
- if (_toString.call(pair) !== "[object Object]") return false;
- keys = Object.keys(pair);
- if (keys.length !== 1) return false;
- result[index] = [keys[0], pair[keys[0]]];
- }
- return true;
- }
- function constructYamlPairs(data) {
- if (data === null) return [];
- var index, length, pair, keys, result, object = data;
- result = new Array(object.length);
- for (index = 0, length = object.length; index < length; index += 1) {
- pair = object[index];
- keys = Object.keys(pair);
- result[index] = [keys[0], pair[keys[0]]];
- }
- return result;
- }
- module2.exports = new Type("tag:yaml.org,2002:pairs", {
- kind: "sequence",
- resolve: resolveYamlPairs,
- construct: constructYamlPairs
- });
- }
-});
-
-// ../../node_modules/js-yaml/lib/type/set.js
-var require_set = __commonJS({
- "../../node_modules/js-yaml/lib/type/set.js"(exports2, module2) {
- "use strict";
- var Type = require_type();
- var _hasOwnProperty = Object.prototype.hasOwnProperty;
- function resolveYamlSet(data) {
- if (data === null) return true;
- var key, object = data;
- for (key in object) {
- if (_hasOwnProperty.call(object, key)) {
- if (object[key] !== null) return false;
- }
- }
- return true;
- }
- function constructYamlSet(data) {
- return data !== null ? data : {};
- }
- module2.exports = new Type("tag:yaml.org,2002:set", {
- kind: "mapping",
- resolve: resolveYamlSet,
- construct: constructYamlSet
- });
- }
-});
-
-// ../../node_modules/js-yaml/lib/schema/default.js
-var require_default = __commonJS({
- "../../node_modules/js-yaml/lib/schema/default.js"(exports2, module2) {
- "use strict";
- module2.exports = require_core().extend({
- implicit: [
- require_timestamp(),
- require_merge()
- ],
- explicit: [
- require_binary(),
- require_omap(),
- require_pairs(),
- require_set()
- ]
- });
- }
-});
-
-// ../../node_modules/js-yaml/lib/loader.js
-var require_loader = __commonJS({
- "../../node_modules/js-yaml/lib/loader.js"(exports2, module2) {
- "use strict";
- var common = require_common();
- var YAMLException = require_exception();
- var makeSnippet = require_snippet();
- var DEFAULT_SCHEMA = require_default();
- var _hasOwnProperty = Object.prototype.hasOwnProperty;
- var CONTEXT_FLOW_IN = 1;
- var CONTEXT_FLOW_OUT = 2;
- var CONTEXT_BLOCK_IN = 3;
- var CONTEXT_BLOCK_OUT = 4;
- var CHOMPING_CLIP = 1;
- var CHOMPING_STRIP = 2;
- var CHOMPING_KEEP = 3;
- var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
- var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
- var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
- var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
- var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
- function _class(obj) {
- return Object.prototype.toString.call(obj);
- }
- function is_EOL(c) {
- return c === 10 || c === 13;
- }
- function is_WHITE_SPACE(c) {
- return c === 9 || c === 32;
- }
- function is_WS_OR_EOL(c) {
- return c === 9 || c === 32 || c === 10 || c === 13;
- }
- function is_FLOW_INDICATOR(c) {
- return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
- }
- function fromHexCode(c) {
- var lc;
- if (48 <= c && c <= 57) {
- return c - 48;
- }
- lc = c | 32;
- if (97 <= lc && lc <= 102) {
- return lc - 97 + 10;
- }
- return -1;
- }
- function escapedHexLen(c) {
- if (c === 120) {
- return 2;
- }
- if (c === 117) {
- return 4;
- }
- if (c === 85) {
- return 8;
- }
- return 0;
- }
- function fromDecimalCode(c) {
- if (48 <= c && c <= 57) {
- return c - 48;
- }
- return -1;
- }
- function simpleEscapeSequence(c) {
- return c === 48 ? "\0" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? " " : c === 9 ? " " : c === 110 ? "\n" : c === 118 ? "\v" : c === 102 ? "\f" : c === 114 ? "\r" : c === 101 ? "\x1B" : c === 32 ? " " : c === 34 ? '"' : c === 47 ? "/" : c === 92 ? "\\" : c === 78 ? "\x85" : c === 95 ? "\xA0" : c === 76 ? "\u2028" : c === 80 ? "\u2029" : "";
- }
- function charFromCodepoint(c) {
- if (c <= 65535) {
- return String.fromCharCode(c);
- }
- return String.fromCharCode(
- (c - 65536 >> 10) + 55296,
- (c - 65536 & 1023) + 56320
- );
- }
- var simpleEscapeCheck = new Array(256);
- var simpleEscapeMap = new Array(256);
- for (i = 0; i < 256; i++) {
- simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
- simpleEscapeMap[i] = simpleEscapeSequence(i);
- }
- var i;
- function State(input, options) {
- this.input = input;
- this.filename = options["filename"] || null;
- this.schema = options["schema"] || DEFAULT_SCHEMA;
- this.onWarning = options["onWarning"] || null;
- this.legacy = options["legacy"] || false;
- this.json = options["json"] || false;
- this.listener = options["listener"] || null;
- this.implicitTypes = this.schema.compiledImplicit;
- this.typeMap = this.schema.compiledTypeMap;
- this.length = input.length;
- this.position = 0;
- this.line = 0;
- this.lineStart = 0;
- this.lineIndent = 0;
- this.firstTabInLine = -1;
- this.documents = [];
- }
- function generateError(state, message) {
- var mark = {
- name: state.filename,
- buffer: state.input.slice(0, -1),
- // omit trailing \0
- position: state.position,
- line: state.line,
- column: state.position - state.lineStart
- };
- mark.snippet = makeSnippet(mark);
- return new YAMLException(message, mark);
- }
- function throwError(state, message) {
- throw generateError(state, message);
- }
- function throwWarning(state, message) {
- if (state.onWarning) {
- state.onWarning.call(null, generateError(state, message));
- }
- }
- var directiveHandlers = {
- YAML: function handleYamlDirective(state, name, args) {
- var match, major, minor;
- if (state.version !== null) {
- throwError(state, "duplication of %YAML directive");
- }
- if (args.length !== 1) {
- throwError(state, "YAML directive accepts exactly one argument");
- }
- match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
- if (match === null) {
- throwError(state, "ill-formed argument of the YAML directive");
- }
- major = parseInt(match[1], 10);
- minor = parseInt(match[2], 10);
- if (major !== 1) {
- throwError(state, "unacceptable YAML version of the document");
- }
- state.version = args[0];
- state.checkLineBreaks = minor < 2;
- if (minor !== 1 && minor !== 2) {
- throwWarning(state, "unsupported YAML version of the document");
- }
- },
- TAG: function handleTagDirective(state, name, args) {
- var handle, prefix;
- if (args.length !== 2) {
- throwError(state, "TAG directive accepts exactly two arguments");
- }
- handle = args[0];
- prefix = args[1];
- if (!PATTERN_TAG_HANDLE.test(handle)) {
- throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
- }
- if (_hasOwnProperty.call(state.tagMap, handle)) {
- throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
- }
- if (!PATTERN_TAG_URI.test(prefix)) {
- throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
- }
- try {
- prefix = decodeURIComponent(prefix);
- } catch (err) {
- throwError(state, "tag prefix is malformed: " + prefix);
- }
- state.tagMap[handle] = prefix;
- }
- };
- function captureSegment(state, start, end, checkJson) {
- var _position, _length, _character, _result;
- if (start < end) {
- _result = state.input.slice(start, end);
- if (checkJson) {
- for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
- _character = _result.charCodeAt(_position);
- if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
- throwError(state, "expected valid JSON character");
- }
- }
- } else if (PATTERN_NON_PRINTABLE.test(_result)) {
- throwError(state, "the stream contains non-printable characters");
- }
- state.result += _result;
- }
- }
- function mergeMappings(state, destination, source, overridableKeys) {
- var sourceKeys, key, index, quantity;
- if (!common.isObject(source)) {
- throwError(state, "cannot merge mappings; the provided source object is unacceptable");
- }
- sourceKeys = Object.keys(source);
- for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
- key = sourceKeys[index];
- if (!_hasOwnProperty.call(destination, key)) {
- destination[key] = source[key];
- overridableKeys[key] = true;
- }
- }
- }
- function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
- var index, quantity;
- if (Array.isArray(keyNode)) {
- keyNode = Array.prototype.slice.call(keyNode);
- for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
- if (Array.isArray(keyNode[index])) {
- throwError(state, "nested arrays are not supported inside keys");
- }
- if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
- keyNode[index] = "[object Object]";
- }
- }
- }
- if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
- keyNode = "[object Object]";
- }
- keyNode = String(keyNode);
- if (_result === null) {
- _result = {};
- }
- if (keyTag === "tag:yaml.org,2002:merge") {
- if (Array.isArray(valueNode)) {
- for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
- mergeMappings(state, _result, valueNode[index], overridableKeys);
- }
- } else {
- mergeMappings(state, _result, valueNode, overridableKeys);
- }
- } else {
- if (!state.json && !_hasOwnProperty.call(overridableKeys, keyNode) && _hasOwnProperty.call(_result, keyNode)) {
- state.line = startLine || state.line;
- state.lineStart = startLineStart || state.lineStart;
- state.position = startPos || state.position;
- throwError(state, "duplicated mapping key");
- }
- if (keyNode === "__proto__") {
- Object.defineProperty(_result, keyNode, {
- configurable: true,
- enumerable: true,
- writable: true,
- value: valueNode
- });
- } else {
- _result[keyNode] = valueNode;
- }
- delete overridableKeys[keyNode];
- }
- return _result;
- }
- function readLineBreak(state) {
- var ch;
- ch = state.input.charCodeAt(state.position);
- if (ch === 10) {
- state.position++;
- } else if (ch === 13) {
- state.position++;
- if (state.input.charCodeAt(state.position) === 10) {
- state.position++;
- }
- } else {
- throwError(state, "a line break is expected");
- }
- state.line += 1;
- state.lineStart = state.position;
- state.firstTabInLine = -1;
- }
- function skipSeparationSpace(state, allowComments, checkIndent) {
- var lineBreaks = 0, ch = state.input.charCodeAt(state.position);
- while (ch !== 0) {
- while (is_WHITE_SPACE(ch)) {
- if (ch === 9 && state.firstTabInLine === -1) {
- state.firstTabInLine = state.position;
- }
- ch = state.input.charCodeAt(++state.position);
- }
- if (allowComments && ch === 35) {
- do {
- ch = state.input.charCodeAt(++state.position);
- } while (ch !== 10 && ch !== 13 && ch !== 0);
- }
- if (is_EOL(ch)) {
- readLineBreak(state);
- ch = state.input.charCodeAt(state.position);
- lineBreaks++;
- state.lineIndent = 0;
- while (ch === 32) {
- state.lineIndent++;
- ch = state.input.charCodeAt(++state.position);
- }
- } else {
- break;
- }
- }
- if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
- throwWarning(state, "deficient indentation");
- }
- return lineBreaks;
- }
- function testDocumentSeparator(state) {
- var _position = state.position, ch;
- ch = state.input.charCodeAt(_position);
- if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
- _position += 3;
- ch = state.input.charCodeAt(_position);
- if (ch === 0 || is_WS_OR_EOL(ch)) {
- return true;
- }
- }
- return false;
- }
- function writeFoldedLines(state, count) {
- if (count === 1) {
- state.result += " ";
- } else if (count > 1) {
- state.result += common.repeat("\n", count - 1);
- }
- }
- function readPlainScalar(state, nodeIndent, withinFlowCollection) {
- var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch;
- ch = state.input.charCodeAt(state.position);
- if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) {
- return false;
- }
- if (ch === 63 || ch === 45) {
- following = state.input.charCodeAt(state.position + 1);
- if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
- return false;
- }
- }
- state.kind = "scalar";
- state.result = "";
- captureStart = captureEnd = state.position;
- hasPendingContent = false;
- while (ch !== 0) {
- if (ch === 58) {
- following = state.input.charCodeAt(state.position + 1);
- if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
- break;
- }
- } else if (ch === 35) {
- preceding = state.input.charCodeAt(state.position - 1);
- if (is_WS_OR_EOL(preceding)) {
- break;
- }
- } else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
- break;
- } else if (is_EOL(ch)) {
- _line = state.line;
- _lineStart = state.lineStart;
- _lineIndent = state.lineIndent;
- skipSeparationSpace(state, false, -1);
- if (state.lineIndent >= nodeIndent) {
- hasPendingContent = true;
- ch = state.input.charCodeAt(state.position);
- continue;
- } else {
- state.position = captureEnd;
- state.line = _line;
- state.lineStart = _lineStart;
- state.lineIndent = _lineIndent;
- break;
- }
- }
- if (hasPendingContent) {
- captureSegment(state, captureStart, captureEnd, false);
- writeFoldedLines(state, state.line - _line);
- captureStart = captureEnd = state.position;
- hasPendingContent = false;
- }
- if (!is_WHITE_SPACE(ch)) {
- captureEnd = state.position + 1;
- }
- ch = state.input.charCodeAt(++state.position);
- }
- captureSegment(state, captureStart, captureEnd, false);
- if (state.result) {
- return true;
- }
- state.kind = _kind;
- state.result = _result;
- return false;
- }
- function readSingleQuotedScalar(state, nodeIndent) {
- var ch, captureStart, captureEnd;
- ch = state.input.charCodeAt(state.position);
- if (ch !== 39) {
- return false;
- }
- state.kind = "scalar";
- state.result = "";
- state.position++;
- captureStart = captureEnd = state.position;
- while ((ch = state.input.charCodeAt(state.position)) !== 0) {
- if (ch === 39) {
- captureSegment(state, captureStart, state.position, true);
- ch = state.input.charCodeAt(++state.position);
- if (ch === 39) {
- captureStart = state.position;
- state.position++;
- captureEnd = state.position;
- } else {
- return true;
- }
- } else if (is_EOL(ch)) {
- captureSegment(state, captureStart, captureEnd, true);
- writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
- captureStart = captureEnd = state.position;
- } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
- throwError(state, "unexpected end of the document within a single quoted scalar");
- } else {
- state.position++;
- captureEnd = state.position;
- }
- }
- throwError(state, "unexpected end of the stream within a single quoted scalar");
- }
- function readDoubleQuotedScalar(state, nodeIndent) {
- var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
- ch = state.input.charCodeAt(state.position);
- if (ch !== 34) {
- return false;
- }
- state.kind = "scalar";
- state.result = "";
- state.position++;
- captureStart = captureEnd = state.position;
- while ((ch = state.input.charCodeAt(state.position)) !== 0) {
- if (ch === 34) {
- captureSegment(state, captureStart, state.position, true);
- state.position++;
- return true;
- } else if (ch === 92) {
- captureSegment(state, captureStart, state.position, true);
- ch = state.input.charCodeAt(++state.position);
- if (is_EOL(ch)) {
- skipSeparationSpace(state, false, nodeIndent);
- } else if (ch < 256 && simpleEscapeCheck[ch]) {
- state.result += simpleEscapeMap[ch];
- state.position++;
- } else if ((tmp = escapedHexLen(ch)) > 0) {
- hexLength = tmp;
- hexResult = 0;
- for (; hexLength > 0; hexLength--) {
- ch = state.input.charCodeAt(++state.position);
- if ((tmp = fromHexCode(ch)) >= 0) {
- hexResult = (hexResult << 4) + tmp;
- } else {
- throwError(state, "expected hexadecimal character");
- }
- }
- state.result += charFromCodepoint(hexResult);
- state.position++;
- } else {
- throwError(state, "unknown escape sequence");
- }
- captureStart = captureEnd = state.position;
- } else if (is_EOL(ch)) {
- captureSegment(state, captureStart, captureEnd, true);
- writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
- captureStart = captureEnd = state.position;
- } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
- throwError(state, "unexpected end of the document within a double quoted scalar");
- } else {
- state.position++;
- captureEnd = state.position;
- }
- }
- throwError(state, "unexpected end of the stream within a double quoted scalar");
- }
- function readFlowCollection(state, nodeIndent) {
- var readNext = true, _line, _lineStart, _pos, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = /* @__PURE__ */ Object.create(null), keyNode, keyTag, valueNode, ch;
- ch = state.input.charCodeAt(state.position);
- if (ch === 91) {
- terminator = 93;
- isMapping = false;
- _result = [];
- } else if (ch === 123) {
- terminator = 125;
- isMapping = true;
- _result = {};
- } else {
- return false;
- }
- if (state.anchor !== null) {
- state.anchorMap[state.anchor] = _result;
- }
- ch = state.input.charCodeAt(++state.position);
- while (ch !== 0) {
- skipSeparationSpace(state, true, nodeIndent);
- ch = state.input.charCodeAt(state.position);
- if (ch === terminator) {
- state.position++;
- state.tag = _tag;
- state.anchor = _anchor;
- state.kind = isMapping ? "mapping" : "sequence";
- state.result = _result;
- return true;
- } else if (!readNext) {
- throwError(state, "missed comma between flow collection entries");
- } else if (ch === 44) {
- throwError(state, "expected the node content, but found ','");
- }
- keyTag = keyNode = valueNode = null;
- isPair = isExplicitPair = false;
- if (ch === 63) {
- following = state.input.charCodeAt(state.position + 1);
- if (is_WS_OR_EOL(following)) {
- isPair = isExplicitPair = true;
- state.position++;
- skipSeparationSpace(state, true, nodeIndent);
- }
- }
- _line = state.line;
- _lineStart = state.lineStart;
- _pos = state.position;
- composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
- keyTag = state.tag;
- keyNode = state.result;
- skipSeparationSpace(state, true, nodeIndent);
- ch = state.input.charCodeAt(state.position);
- if ((isExplicitPair || state.line === _line) && ch === 58) {
- isPair = true;
- ch = state.input.charCodeAt(++state.position);
- skipSeparationSpace(state, true, nodeIndent);
- composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
- valueNode = state.result;
- }
- if (isMapping) {
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
- } else if (isPair) {
- _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
- } else {
- _result.push(keyNode);
- }
- skipSeparationSpace(state, true, nodeIndent);
- ch = state.input.charCodeAt(state.position);
- if (ch === 44) {
- readNext = true;
- ch = state.input.charCodeAt(++state.position);
- } else {
- readNext = false;
- }
- }
- throwError(state, "unexpected end of the stream within a flow collection");
- }
- function readBlockScalar(state, nodeIndent) {
- var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
- ch = state.input.charCodeAt(state.position);
- if (ch === 124) {
- folding = false;
- } else if (ch === 62) {
- folding = true;
- } else {
- return false;
- }
- state.kind = "scalar";
- state.result = "";
- while (ch !== 0) {
- ch = state.input.charCodeAt(++state.position);
- if (ch === 43 || ch === 45) {
- if (CHOMPING_CLIP === chomping) {
- chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
- } else {
- throwError(state, "repeat of a chomping mode identifier");
- }
- } else if ((tmp = fromDecimalCode(ch)) >= 0) {
- if (tmp === 0) {
- throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
- } else if (!detectedIndent) {
- textIndent = nodeIndent + tmp - 1;
- detectedIndent = true;
- } else {
- throwError(state, "repeat of an indentation width identifier");
- }
- } else {
- break;
- }
- }
- if (is_WHITE_SPACE(ch)) {
- do {
- ch = state.input.charCodeAt(++state.position);
- } while (is_WHITE_SPACE(ch));
- if (ch === 35) {
- do {
- ch = state.input.charCodeAt(++state.position);
- } while (!is_EOL(ch) && ch !== 0);
- }
- }
- while (ch !== 0) {
- readLineBreak(state);
- state.lineIndent = 0;
- ch = state.input.charCodeAt(state.position);
- while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) {
- state.lineIndent++;
- ch = state.input.charCodeAt(++state.position);
- }
- if (!detectedIndent && state.lineIndent > textIndent) {
- textIndent = state.lineIndent;
- }
- if (is_EOL(ch)) {
- emptyLines++;
- continue;
- }
- if (state.lineIndent < textIndent) {
- if (chomping === CHOMPING_KEEP) {
- state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
- } else if (chomping === CHOMPING_CLIP) {
- if (didReadContent) {
- state.result += "\n";
- }
- }
- break;
- }
- if (folding) {
- if (is_WHITE_SPACE(ch)) {
- atMoreIndented = true;
- state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
- } else if (atMoreIndented) {
- atMoreIndented = false;
- state.result += common.repeat("\n", emptyLines + 1);
- } else if (emptyLines === 0) {
- if (didReadContent) {
- state.result += " ";
- }
- } else {
- state.result += common.repeat("\n", emptyLines);
- }
- } else {
- state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
- }
- didReadContent = true;
- detectedIndent = true;
- emptyLines = 0;
- captureStart = state.position;
- while (!is_EOL(ch) && ch !== 0) {
- ch = state.input.charCodeAt(++state.position);
- }
- captureSegment(state, captureStart, state.position, false);
- }
- return true;
- }
- function readBlockSequence(state, nodeIndent) {
- var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, ch;
- if (state.firstTabInLine !== -1) return false;
- if (state.anchor !== null) {
- state.anchorMap[state.anchor] = _result;
- }
- ch = state.input.charCodeAt(state.position);
- while (ch !== 0) {
- if (state.firstTabInLine !== -1) {
- state.position = state.firstTabInLine;
- throwError(state, "tab characters must not be used in indentation");
- }
- if (ch !== 45) {
- break;
- }
- following = state.input.charCodeAt(state.position + 1);
- if (!is_WS_OR_EOL(following)) {
- break;
- }
- detected = true;
- state.position++;
- if (skipSeparationSpace(state, true, -1)) {
- if (state.lineIndent <= nodeIndent) {
- _result.push(null);
- ch = state.input.charCodeAt(state.position);
- continue;
- }
- }
- _line = state.line;
- composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
- _result.push(state.result);
- skipSeparationSpace(state, true, -1);
- ch = state.input.charCodeAt(state.position);
- if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
- throwError(state, "bad indentation of a sequence entry");
- } else if (state.lineIndent < nodeIndent) {
- break;
- }
- }
- if (detected) {
- state.tag = _tag;
- state.anchor = _anchor;
- state.kind = "sequence";
- state.result = _result;
- return true;
- }
- return false;
- }
- function readBlockMapping(state, nodeIndent, flowIndent) {
- var following, allowCompact, _line, _keyLine, _keyLineStart, _keyPos, _tag = state.tag, _anchor = state.anchor, _result = {}, overridableKeys = /* @__PURE__ */ Object.create(null), keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
- if (state.firstTabInLine !== -1) return false;
- if (state.anchor !== null) {
- state.anchorMap[state.anchor] = _result;
- }
- ch = state.input.charCodeAt(state.position);
- while (ch !== 0) {
- if (!atExplicitKey && state.firstTabInLine !== -1) {
- state.position = state.firstTabInLine;
- throwError(state, "tab characters must not be used in indentation");
- }
- following = state.input.charCodeAt(state.position + 1);
- _line = state.line;
- if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
- if (ch === 63) {
- if (atExplicitKey) {
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
- keyTag = keyNode = valueNode = null;
- }
- detected = true;
- atExplicitKey = true;
- allowCompact = true;
- } else if (atExplicitKey) {
- atExplicitKey = false;
- allowCompact = true;
- } else {
- throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
- }
- state.position += 1;
- ch = following;
- } else {
- _keyLine = state.line;
- _keyLineStart = state.lineStart;
- _keyPos = state.position;
- if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
- break;
- }
- if (state.line === _line) {
- ch = state.input.charCodeAt(state.position);
- while (is_WHITE_SPACE(ch)) {
- ch = state.input.charCodeAt(++state.position);
- }
- if (ch === 58) {
- ch = state.input.charCodeAt(++state.position);
- if (!is_WS_OR_EOL(ch)) {
- throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
- }
- if (atExplicitKey) {
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
- keyTag = keyNode = valueNode = null;
- }
- detected = true;
- atExplicitKey = false;
- allowCompact = false;
- keyTag = state.tag;
- keyNode = state.result;
- } else if (detected) {
- throwError(state, "can not read an implicit mapping pair; a colon is missed");
- } else {
- state.tag = _tag;
- state.anchor = _anchor;
- return true;
- }
- } else if (detected) {
- throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
- } else {
- state.tag = _tag;
- state.anchor = _anchor;
- return true;
- }
- }
- if (state.line === _line || state.lineIndent > nodeIndent) {
- if (atExplicitKey) {
- _keyLine = state.line;
- _keyLineStart = state.lineStart;
- _keyPos = state.position;
- }
- if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
- if (atExplicitKey) {
- keyNode = state.result;
- } else {
- valueNode = state.result;
- }
- }
- if (!atExplicitKey) {
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
- keyTag = keyNode = valueNode = null;
- }
- skipSeparationSpace(state, true, -1);
- ch = state.input.charCodeAt(state.position);
- }
- if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
- throwError(state, "bad indentation of a mapping entry");
- } else if (state.lineIndent < nodeIndent) {
- break;
- }
- }
- if (atExplicitKey) {
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
- }
- if (detected) {
- state.tag = _tag;
- state.anchor = _anchor;
- state.kind = "mapping";
- state.result = _result;
- }
- return detected;
- }
- function readTagProperty(state) {
- var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch;
- ch = state.input.charCodeAt(state.position);
- if (ch !== 33) return false;
- if (state.tag !== null) {
- throwError(state, "duplication of a tag property");
- }
- ch = state.input.charCodeAt(++state.position);
- if (ch === 60) {
- isVerbatim = true;
- ch = state.input.charCodeAt(++state.position);
- } else if (ch === 33) {
- isNamed = true;
- tagHandle = "!!";
- ch = state.input.charCodeAt(++state.position);
- } else {
- tagHandle = "!";
- }
- _position = state.position;
- if (isVerbatim) {
- do {
- ch = state.input.charCodeAt(++state.position);
- } while (ch !== 0 && ch !== 62);
- if (state.position < state.length) {
- tagName = state.input.slice(_position, state.position);
- ch = state.input.charCodeAt(++state.position);
- } else {
- throwError(state, "unexpected end of the stream within a verbatim tag");
- }
- } else {
- while (ch !== 0 && !is_WS_OR_EOL(ch)) {
- if (ch === 33) {
- if (!isNamed) {
- tagHandle = state.input.slice(_position - 1, state.position + 1);
- if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
- throwError(state, "named tag handle cannot contain such characters");
- }
- isNamed = true;
- _position = state.position + 1;
- } else {
- throwError(state, "tag suffix cannot contain exclamation marks");
- }
- }
- ch = state.input.charCodeAt(++state.position);
- }
- tagName = state.input.slice(_position, state.position);
- if (PATTERN_FLOW_INDICATORS.test(tagName)) {
- throwError(state, "tag suffix cannot contain flow indicator characters");
- }
- }
- if (tagName && !PATTERN_TAG_URI.test(tagName)) {
- throwError(state, "tag name cannot contain such characters: " + tagName);
- }
- try {
- tagName = decodeURIComponent(tagName);
- } catch (err) {
- throwError(state, "tag name is malformed: " + tagName);
- }
- if (isVerbatim) {
- state.tag = tagName;
- } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
- state.tag = state.tagMap[tagHandle] + tagName;
- } else if (tagHandle === "!") {
- state.tag = "!" + tagName;
- } else if (tagHandle === "!!") {
- state.tag = "tag:yaml.org,2002:" + tagName;
- } else {
- throwError(state, 'undeclared tag handle "' + tagHandle + '"');
- }
- return true;
- }
- function readAnchorProperty(state) {
- var _position, ch;
- ch = state.input.charCodeAt(state.position);
- if (ch !== 38) return false;
- if (state.anchor !== null) {
- throwError(state, "duplication of an anchor property");
- }
- ch = state.input.charCodeAt(++state.position);
- _position = state.position;
- while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
- ch = state.input.charCodeAt(++state.position);
- }
- if (state.position === _position) {
- throwError(state, "name of an anchor node must contain at least one character");
- }
- state.anchor = state.input.slice(_position, state.position);
- return true;
- }
- function readAlias(state) {
- var _position, alias, ch;
- ch = state.input.charCodeAt(state.position);
- if (ch !== 42) return false;
- ch = state.input.charCodeAt(++state.position);
- _position = state.position;
- while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
- ch = state.input.charCodeAt(++state.position);
- }
- if (state.position === _position) {
- throwError(state, "name of an alias node must contain at least one character");
- }
- alias = state.input.slice(_position, state.position);
- if (!_hasOwnProperty.call(state.anchorMap, alias)) {
- throwError(state, 'unidentified alias "' + alias + '"');
- }
- state.result = state.anchorMap[alias];
- skipSeparationSpace(state, true, -1);
- return true;
- }
- function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
- var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, typeList, type, flowIndent, blockIndent;
- if (state.listener !== null) {
- state.listener("open", state);
- }
- state.tag = null;
- state.anchor = null;
- state.kind = null;
- state.result = null;
- allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
- if (allowToSeek) {
- if (skipSeparationSpace(state, true, -1)) {
- atNewLine = true;
- if (state.lineIndent > parentIndent) {
- indentStatus = 1;
- } else if (state.lineIndent === parentIndent) {
- indentStatus = 0;
- } else if (state.lineIndent < parentIndent) {
- indentStatus = -1;
- }
- }
- }
- if (indentStatus === 1) {
- while (readTagProperty(state) || readAnchorProperty(state)) {
- if (skipSeparationSpace(state, true, -1)) {
- atNewLine = true;
- allowBlockCollections = allowBlockStyles;
- if (state.lineIndent > parentIndent) {
- indentStatus = 1;
- } else if (state.lineIndent === parentIndent) {
- indentStatus = 0;
- } else if (state.lineIndent < parentIndent) {
- indentStatus = -1;
- }
- } else {
- allowBlockCollections = false;
- }
- }
- }
- if (allowBlockCollections) {
- allowBlockCollections = atNewLine || allowCompact;
- }
- if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
- if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
- flowIndent = parentIndent;
- } else {
- flowIndent = parentIndent + 1;
- }
- blockIndent = state.position - state.lineStart;
- if (indentStatus === 1) {
- if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) {
- hasContent = true;
- } else {
- if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) {
- hasContent = true;
- } else if (readAlias(state)) {
- hasContent = true;
- if (state.tag !== null || state.anchor !== null) {
- throwError(state, "alias node should not have any properties");
- }
- } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
- hasContent = true;
- if (state.tag === null) {
- state.tag = "?";
- }
- }
- if (state.anchor !== null) {
- state.anchorMap[state.anchor] = state.result;
- }
- }
- } else if (indentStatus === 0) {
- hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
- }
- }
- if (state.tag === null) {
- if (state.anchor !== null) {
- state.anchorMap[state.anchor] = state.result;
- }
- } else if (state.tag === "?") {
- if (state.result !== null && state.kind !== "scalar") {
- throwError(state, 'unacceptable node kind for !> tag; it should be "scalar", not "' + state.kind + '"');
- }
- for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
- type = state.implicitTypes[typeIndex];
- if (type.resolve(state.result)) {
- state.result = type.construct(state.result);
- state.tag = type.tag;
- if (state.anchor !== null) {
- state.anchorMap[state.anchor] = state.result;
- }
- break;
- }
- }
- } else if (state.tag !== "!") {
- if (_hasOwnProperty.call(state.typeMap[state.kind || "fallback"], state.tag)) {
- type = state.typeMap[state.kind || "fallback"][state.tag];
- } else {
- type = null;
- typeList = state.typeMap.multi[state.kind || "fallback"];
- for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
- if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
- type = typeList[typeIndex];
- break;
- }
- }
- }
- if (!type) {
- throwError(state, "unknown tag !<" + state.tag + ">");
- }
- if (state.result !== null && type.kind !== state.kind) {
- throwError(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
- }
- if (!type.resolve(state.result, state.tag)) {
- throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
- } else {
- state.result = type.construct(state.result, state.tag);
- if (state.anchor !== null) {
- state.anchorMap[state.anchor] = state.result;
- }
- }
- }
- if (state.listener !== null) {
- state.listener("close", state);
- }
- return state.tag !== null || state.anchor !== null || hasContent;
- }
- function readDocument(state) {
- var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
- state.version = null;
- state.checkLineBreaks = state.legacy;
- state.tagMap = /* @__PURE__ */ Object.create(null);
- state.anchorMap = /* @__PURE__ */ Object.create(null);
- while ((ch = state.input.charCodeAt(state.position)) !== 0) {
- skipSeparationSpace(state, true, -1);
- ch = state.input.charCodeAt(state.position);
- if (state.lineIndent > 0 || ch !== 37) {
- break;
- }
- hasDirectives = true;
- ch = state.input.charCodeAt(++state.position);
- _position = state.position;
- while (ch !== 0 && !is_WS_OR_EOL(ch)) {
- ch = state.input.charCodeAt(++state.position);
- }
- directiveName = state.input.slice(_position, state.position);
- directiveArgs = [];
- if (directiveName.length < 1) {
- throwError(state, "directive name must not be less than one character in length");
- }
- while (ch !== 0) {
- while (is_WHITE_SPACE(ch)) {
- ch = state.input.charCodeAt(++state.position);
- }
- if (ch === 35) {
- do {
- ch = state.input.charCodeAt(++state.position);
- } while (ch !== 0 && !is_EOL(ch));
- break;
- }
- if (is_EOL(ch)) break;
- _position = state.position;
- while (ch !== 0 && !is_WS_OR_EOL(ch)) {
- ch = state.input.charCodeAt(++state.position);
- }
- directiveArgs.push(state.input.slice(_position, state.position));
- }
- if (ch !== 0) readLineBreak(state);
- if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
- directiveHandlers[directiveName](state, directiveName, directiveArgs);
- } else {
- throwWarning(state, 'unknown document directive "' + directiveName + '"');
- }
- }
- skipSeparationSpace(state, true, -1);
- if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
- state.position += 3;
- skipSeparationSpace(state, true, -1);
- } else if (hasDirectives) {
- throwError(state, "directives end mark is expected");
- }
- composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
- skipSeparationSpace(state, true, -1);
- if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
- throwWarning(state, "non-ASCII line breaks are interpreted as content");
- }
- state.documents.push(state.result);
- if (state.position === state.lineStart && testDocumentSeparator(state)) {
- if (state.input.charCodeAt(state.position) === 46) {
- state.position += 3;
- skipSeparationSpace(state, true, -1);
- }
- return;
- }
- if (state.position < state.length - 1) {
- throwError(state, "end of the stream or a document separator is expected");
- } else {
- return;
- }
- }
- function loadDocuments(input, options) {
- input = String(input);
- options = options || {};
- if (input.length !== 0) {
- if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
- input += "\n";
- }
- if (input.charCodeAt(0) === 65279) {
- input = input.slice(1);
- }
- }
- var state = new State(input, options);
- var nullpos = input.indexOf("\0");
- if (nullpos !== -1) {
- state.position = nullpos;
- throwError(state, "null byte is not allowed in input");
- }
- state.input += "\0";
- while (state.input.charCodeAt(state.position) === 32) {
- state.lineIndent += 1;
- state.position += 1;
- }
- while (state.position < state.length - 1) {
- readDocument(state);
- }
- return state.documents;
- }
- function loadAll(input, iterator, options) {
- if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
- options = iterator;
- iterator = null;
- }
- var documents = loadDocuments(input, options);
- if (typeof iterator !== "function") {
- return documents;
- }
- for (var index = 0, length = documents.length; index < length; index += 1) {
- iterator(documents[index]);
- }
- }
- function load(input, options) {
- var documents = loadDocuments(input, options);
- if (documents.length === 0) {
- return void 0;
- } else if (documents.length === 1) {
- return documents[0];
- }
- throw new YAMLException("expected a single document in the stream, but found more");
- }
- module2.exports.loadAll = loadAll;
- module2.exports.load = load;
- }
-});
-
-// ../../node_modules/js-yaml/lib/dumper.js
-var require_dumper = __commonJS({
- "../../node_modules/js-yaml/lib/dumper.js"(exports2, module2) {
- "use strict";
- var common = require_common();
- var YAMLException = require_exception();
- var DEFAULT_SCHEMA = require_default();
- var _toString = Object.prototype.toString;
- var _hasOwnProperty = Object.prototype.hasOwnProperty;
- var CHAR_BOM = 65279;
- var CHAR_TAB = 9;
- var CHAR_LINE_FEED = 10;
- var CHAR_CARRIAGE_RETURN = 13;
- var CHAR_SPACE = 32;
- var CHAR_EXCLAMATION = 33;
- var CHAR_DOUBLE_QUOTE = 34;
- var CHAR_SHARP = 35;
- var CHAR_PERCENT = 37;
- var CHAR_AMPERSAND = 38;
- var CHAR_SINGLE_QUOTE = 39;
- var CHAR_ASTERISK = 42;
- var CHAR_COMMA = 44;
- var CHAR_MINUS = 45;
- var CHAR_COLON = 58;
- var CHAR_EQUALS = 61;
- var CHAR_GREATER_THAN = 62;
- var CHAR_QUESTION = 63;
- var CHAR_COMMERCIAL_AT = 64;
- var CHAR_LEFT_SQUARE_BRACKET = 91;
- var CHAR_RIGHT_SQUARE_BRACKET = 93;
- var CHAR_GRAVE_ACCENT = 96;
- var CHAR_LEFT_CURLY_BRACKET = 123;
- var CHAR_VERTICAL_LINE = 124;
- var CHAR_RIGHT_CURLY_BRACKET = 125;
- var ESCAPE_SEQUENCES = {};
- ESCAPE_SEQUENCES[0] = "\\0";
- ESCAPE_SEQUENCES[7] = "\\a";
- ESCAPE_SEQUENCES[8] = "\\b";
- ESCAPE_SEQUENCES[9] = "\\t";
- ESCAPE_SEQUENCES[10] = "\\n";
- ESCAPE_SEQUENCES[11] = "\\v";
- ESCAPE_SEQUENCES[12] = "\\f";
- ESCAPE_SEQUENCES[13] = "\\r";
- ESCAPE_SEQUENCES[27] = "\\e";
- ESCAPE_SEQUENCES[34] = '\\"';
- ESCAPE_SEQUENCES[92] = "\\\\";
- ESCAPE_SEQUENCES[133] = "\\N";
- ESCAPE_SEQUENCES[160] = "\\_";
- ESCAPE_SEQUENCES[8232] = "\\L";
- ESCAPE_SEQUENCES[8233] = "\\P";
- var DEPRECATED_BOOLEANS_SYNTAX = [
- "y",
- "Y",
- "yes",
- "Yes",
- "YES",
- "on",
- "On",
- "ON",
- "n",
- "N",
- "no",
- "No",
- "NO",
- "off",
- "Off",
- "OFF"
- ];
- var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
- function compileStyleMap(schema2, map) {
- var result, keys, index, length, tag, style, type;
- if (map === null) return {};
- result = {};
- keys = Object.keys(map);
- for (index = 0, length = keys.length; index < length; index += 1) {
- tag = keys[index];
- style = String(map[tag]);
- if (tag.slice(0, 2) === "!!") {
- tag = "tag:yaml.org,2002:" + tag.slice(2);
- }
- type = schema2.compiledTypeMap["fallback"][tag];
- if (type && _hasOwnProperty.call(type.styleAliases, style)) {
- style = type.styleAliases[style];
- }
- result[tag] = style;
- }
- return result;
- }
- function encodeHex(character) {
- var string, handle, length;
- string = character.toString(16).toUpperCase();
- if (character <= 255) {
- handle = "x";
- length = 2;
- } else if (character <= 65535) {
- handle = "u";
- length = 4;
- } else if (character <= 4294967295) {
- handle = "U";
- length = 8;
- } else {
- throw new YAMLException("code point within a string may not be greater than 0xFFFFFFFF");
- }
- return "\\" + handle + common.repeat("0", length - string.length) + string;
- }
- var QUOTING_TYPE_SINGLE = 1;
- var QUOTING_TYPE_DOUBLE = 2;
- function State(options) {
- this.schema = options["schema"] || DEFAULT_SCHEMA;
- this.indent = Math.max(1, options["indent"] || 2);
- this.noArrayIndent = options["noArrayIndent"] || false;
- this.skipInvalid = options["skipInvalid"] || false;
- this.flowLevel = common.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
- this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
- this.sortKeys = options["sortKeys"] || false;
- this.lineWidth = options["lineWidth"] || 80;
- this.noRefs = options["noRefs"] || false;
- this.noCompatMode = options["noCompatMode"] || false;
- this.condenseFlow = options["condenseFlow"] || false;
- this.quotingType = options["quotingType"] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
- this.forceQuotes = options["forceQuotes"] || false;
- this.replacer = typeof options["replacer"] === "function" ? options["replacer"] : null;
- this.implicitTypes = this.schema.compiledImplicit;
- this.explicitTypes = this.schema.compiledExplicit;
- this.tag = null;
- this.result = "";
- this.duplicates = [];
- this.usedDuplicates = null;
- }
- function indentString(string, spaces) {
- var ind = common.repeat(" ", spaces), position = 0, next = -1, result = "", line, length = string.length;
- while (position < length) {
- next = string.indexOf("\n", position);
- if (next === -1) {
- line = string.slice(position);
- position = length;
- } else {
- line = string.slice(position, next + 1);
- position = next + 1;
- }
- if (line.length && line !== "\n") result += ind;
- result += line;
- }
- return result;
- }
- function generateNextLine(state, level) {
- return "\n" + common.repeat(" ", state.indent * level);
- }
- function testImplicitResolving(state, str) {
- var index, length, type;
- for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
- type = state.implicitTypes[index];
- if (type.resolve(str)) {
- return true;
- }
- }
- return false;
- }
- function isWhitespace(c) {
- return c === CHAR_SPACE || c === CHAR_TAB;
- }
- function isPrintable(c) {
- return 32 <= c && c <= 126 || 161 <= c && c <= 55295 && c !== 8232 && c !== 8233 || 57344 <= c && c <= 65533 && c !== CHAR_BOM || 65536 <= c && c <= 1114111;
- }
- function isNsCharOrWhitespace(c) {
- return isPrintable(c) && c !== CHAR_BOM && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
- }
- function isPlainSafe(c, prev, inblock) {
- var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
- var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
- return (
- // ns-plain-safe
- (inblock ? (
- // c = flow-in
- cIsNsCharOrWhitespace
- ) : cIsNsCharOrWhitespace && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET) && c !== CHAR_SHARP && !(prev === CHAR_COLON && !cIsNsChar) || isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP || prev === CHAR_COLON && cIsNsChar
- );
- }
- function isPlainSafeFirst(c) {
- return isPrintable(c) && c !== CHAR_BOM && !isWhitespace(c) && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_SHARP && c !== CHAR_AMPERSAND && c !== CHAR_ASTERISK && c !== CHAR_EXCLAMATION && c !== CHAR_VERTICAL_LINE && c !== CHAR_EQUALS && c !== CHAR_GREATER_THAN && c !== CHAR_SINGLE_QUOTE && c !== CHAR_DOUBLE_QUOTE && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT;
- }
- function isPlainSafeLast(c) {
- return !isWhitespace(c) && c !== CHAR_COLON;
- }
- function codePointAt(string, pos) {
- var first = string.charCodeAt(pos), second;
- if (first >= 55296 && first <= 56319 && pos + 1 < string.length) {
- second = string.charCodeAt(pos + 1);
- if (second >= 56320 && second <= 57343) {
- return (first - 55296) * 1024 + second - 56320 + 65536;
- }
- }
- return first;
- }
- function needIndentIndicator(string) {
- var leadingSpaceRe = /^\n* /;
- return leadingSpaceRe.test(string);
- }
- var STYLE_PLAIN = 1;
- var STYLE_SINGLE = 2;
- var STYLE_LITERAL = 3;
- var STYLE_FOLDED = 4;
- var STYLE_DOUBLE = 5;
- function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) {
- var i;
- var char = 0;
- var prevChar = null;
- var hasLineBreak = false;
- var hasFoldableLine = false;
- var shouldTrackWidth = lineWidth !== -1;
- var previousLineBreak = -1;
- var plain = isPlainSafeFirst(codePointAt(string, 0)) && isPlainSafeLast(codePointAt(string, string.length - 1));
- if (singleLineOnly || forceQuotes) {
- for (i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
- char = codePointAt(string, i);
- if (!isPrintable(char)) {
- return STYLE_DOUBLE;
- }
- plain = plain && isPlainSafe(char, prevChar, inblock);
- prevChar = char;
- }
- } else {
- for (i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
- char = codePointAt(string, i);
- if (char === CHAR_LINE_FEED) {
- hasLineBreak = true;
- if (shouldTrackWidth) {
- hasFoldableLine = hasFoldableLine || // Foldable line = too long, and not more-indented.
- i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
- previousLineBreak = i;
- }
- } else if (!isPrintable(char)) {
- return STYLE_DOUBLE;
- }
- plain = plain && isPlainSafe(char, prevChar, inblock);
- prevChar = char;
- }
- hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ");
- }
- if (!hasLineBreak && !hasFoldableLine) {
- if (plain && !forceQuotes && !testAmbiguousType(string)) {
- return STYLE_PLAIN;
- }
- return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
- }
- if (indentPerLevel > 9 && needIndentIndicator(string)) {
- return STYLE_DOUBLE;
- }
- if (!forceQuotes) {
- return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
- }
- return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
- }
- function writeScalar(state, string, level, iskey, inblock) {
- state.dump = function() {
- if (string.length === 0) {
- return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
- }
- if (!state.noCompatMode) {
- if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {
- return state.quotingType === QUOTING_TYPE_DOUBLE ? '"' + string + '"' : "'" + string + "'";
- }
- }
- var indent = state.indent * Math.max(1, level);
- var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
- var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
- function testAmbiguity(string2) {
- return testImplicitResolving(state, string2);
- }
- switch (chooseScalarStyle(
- string,
- singleLineOnly,
- state.indent,
- lineWidth,
- testAmbiguity,
- state.quotingType,
- state.forceQuotes && !iskey,
- inblock
- )) {
- case STYLE_PLAIN:
- return string;
- case STYLE_SINGLE:
- return "'" + string.replace(/'/g, "''") + "'";
- case STYLE_LITERAL:
- return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
- case STYLE_FOLDED:
- return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
- case STYLE_DOUBLE:
- return '"' + escapeString(string, lineWidth) + '"';
- default:
- throw new YAMLException("impossible error: invalid scalar style");
- }
- }();
- }
- function blockHeader(string, indentPerLevel) {
- var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : "";
- var clip = string[string.length - 1] === "\n";
- var keep = clip && (string[string.length - 2] === "\n" || string === "\n");
- var chomp = keep ? "+" : clip ? "" : "-";
- return indentIndicator + chomp + "\n";
- }
- function dropEndingNewline(string) {
- return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
- }
- function foldString(string, width) {
- var lineRe = /(\n+)([^\n]*)/g;
- var result = function() {
- var nextLF = string.indexOf("\n");
- nextLF = nextLF !== -1 ? nextLF : string.length;
- lineRe.lastIndex = nextLF;
- return foldLine(string.slice(0, nextLF), width);
- }();
- var prevMoreIndented = string[0] === "\n" || string[0] === " ";
- var moreIndented;
- var match;
- while (match = lineRe.exec(string)) {
- var prefix = match[1], line = match[2];
- moreIndented = line[0] === " ";
- result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
- prevMoreIndented = moreIndented;
- }
- return result;
- }
- function foldLine(line, width) {
- if (line === "" || line[0] === " ") return line;
- var breakRe = / [^ ]/g;
- var match;
- var start = 0, end, curr = 0, next = 0;
- var result = "";
- while (match = breakRe.exec(line)) {
- next = match.index;
- if (next - start > width) {
- end = curr > start ? curr : next;
- result += "\n" + line.slice(start, end);
- start = end + 1;
- }
- curr = next;
- }
- result += "\n";
- if (line.length - start > width && curr > start) {
- result += line.slice(start, curr) + "\n" + line.slice(curr + 1);
- } else {
- result += line.slice(start);
- }
- return result.slice(1);
- }
- function escapeString(string) {
- var result = "";
- var char = 0;
- var escapeSeq;
- for (var i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
- char = codePointAt(string, i);
- escapeSeq = ESCAPE_SEQUENCES[char];
- if (!escapeSeq && isPrintable(char)) {
- result += string[i];
- if (char >= 65536) result += string[i + 1];
- } else {
- result += escapeSeq || encodeHex(char);
- }
- }
- return result;
- }
- function writeFlowSequence(state, level, object) {
- var _result = "", _tag = state.tag, index, length, value;
- for (index = 0, length = object.length; index < length; index += 1) {
- value = object[index];
- if (state.replacer) {
- value = state.replacer.call(object, String(index), value);
- }
- if (writeNode(state, level, value, false, false) || typeof value === "undefined" && writeNode(state, level, null, false, false)) {
- if (_result !== "") _result += "," + (!state.condenseFlow ? " " : "");
- _result += state.dump;
- }
- }
- state.tag = _tag;
- state.dump = "[" + _result + "]";
- }
- function writeBlockSequence(state, level, object, compact) {
- var _result = "", _tag = state.tag, index, length, value;
- for (index = 0, length = object.length; index < length; index += 1) {
- value = object[index];
- if (state.replacer) {
- value = state.replacer.call(object, String(index), value);
- }
- if (writeNode(state, level + 1, value, true, true, false, true) || typeof value === "undefined" && writeNode(state, level + 1, null, true, true, false, true)) {
- if (!compact || _result !== "") {
- _result += generateNextLine(state, level);
- }
- if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
- _result += "-";
- } else {
- _result += "- ";
- }
- _result += state.dump;
- }
- }
- state.tag = _tag;
- state.dump = _result || "[]";
- }
- function writeFlowMapping(state, level, object) {
- var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, pairBuffer;
- for (index = 0, length = objectKeyList.length; index < length; index += 1) {
- pairBuffer = "";
- if (_result !== "") pairBuffer += ", ";
- if (state.condenseFlow) pairBuffer += '"';
- objectKey = objectKeyList[index];
- objectValue = object[objectKey];
- if (state.replacer) {
- objectValue = state.replacer.call(object, objectKey, objectValue);
- }
- if (!writeNode(state, level, objectKey, false, false)) {
- continue;
- }
- if (state.dump.length > 1024) pairBuffer += "? ";
- pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
- if (!writeNode(state, level, objectValue, false, false)) {
- continue;
- }
- pairBuffer += state.dump;
- _result += pairBuffer;
- }
- state.tag = _tag;
- state.dump = "{" + _result + "}";
- }
- function writeBlockMapping(state, level, object, compact) {
- var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, explicitPair, pairBuffer;
- if (state.sortKeys === true) {
- objectKeyList.sort();
- } else if (typeof state.sortKeys === "function") {
- objectKeyList.sort(state.sortKeys);
- } else if (state.sortKeys) {
- throw new YAMLException("sortKeys must be a boolean or a function");
- }
- for (index = 0, length = objectKeyList.length; index < length; index += 1) {
- pairBuffer = "";
- if (!compact || _result !== "") {
- pairBuffer += generateNextLine(state, level);
- }
- objectKey = objectKeyList[index];
- objectValue = object[objectKey];
- if (state.replacer) {
- objectValue = state.replacer.call(object, objectKey, objectValue);
- }
- if (!writeNode(state, level + 1, objectKey, true, true, true)) {
- continue;
- }
- explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
- if (explicitPair) {
- if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
- pairBuffer += "?";
- } else {
- pairBuffer += "? ";
- }
- }
- pairBuffer += state.dump;
- if (explicitPair) {
- pairBuffer += generateNextLine(state, level);
- }
- if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
- continue;
- }
- if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
- pairBuffer += ":";
- } else {
- pairBuffer += ": ";
- }
- pairBuffer += state.dump;
- _result += pairBuffer;
- }
- state.tag = _tag;
- state.dump = _result || "{}";
- }
- function detectType(state, object, explicit) {
- var _result, typeList, index, length, type, style;
- typeList = explicit ? state.explicitTypes : state.implicitTypes;
- for (index = 0, length = typeList.length; index < length; index += 1) {
- type = typeList[index];
- if ((type.instanceOf || type.predicate) && (!type.instanceOf || typeof object === "object" && object instanceof type.instanceOf) && (!type.predicate || type.predicate(object))) {
- if (explicit) {
- if (type.multi && type.representName) {
- state.tag = type.representName(object);
- } else {
- state.tag = type.tag;
- }
- } else {
- state.tag = "?";
- }
- if (type.represent) {
- style = state.styleMap[type.tag] || type.defaultStyle;
- if (_toString.call(type.represent) === "[object Function]") {
- _result = type.represent(object, style);
- } else if (_hasOwnProperty.call(type.represent, style)) {
- _result = type.represent[style](object, style);
- } else {
- throw new YAMLException("!<" + type.tag + '> tag resolver accepts not "' + style + '" style');
- }
- state.dump = _result;
- }
- return true;
- }
- }
- return false;
- }
- function writeNode(state, level, object, block, compact, iskey, isblockseq) {
- state.tag = null;
- state.dump = object;
- if (!detectType(state, object, false)) {
- detectType(state, object, true);
- }
- var type = _toString.call(state.dump);
- var inblock = block;
- var tagStr;
- if (block) {
- block = state.flowLevel < 0 || state.flowLevel > level;
- }
- var objectOrArray = type === "[object Object]" || type === "[object Array]", duplicateIndex, duplicate;
- if (objectOrArray) {
- duplicateIndex = state.duplicates.indexOf(object);
- duplicate = duplicateIndex !== -1;
- }
- if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) {
- compact = false;
- }
- if (duplicate && state.usedDuplicates[duplicateIndex]) {
- state.dump = "*ref_" + duplicateIndex;
- } else {
- if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
- state.usedDuplicates[duplicateIndex] = true;
- }
- if (type === "[object Object]") {
- if (block && Object.keys(state.dump).length !== 0) {
- writeBlockMapping(state, level, state.dump, compact);
- if (duplicate) {
- state.dump = "&ref_" + duplicateIndex + state.dump;
- }
- } else {
- writeFlowMapping(state, level, state.dump);
- if (duplicate) {
- state.dump = "&ref_" + duplicateIndex + " " + state.dump;
- }
- }
- } else if (type === "[object Array]") {
- if (block && state.dump.length !== 0) {
- if (state.noArrayIndent && !isblockseq && level > 0) {
- writeBlockSequence(state, level - 1, state.dump, compact);
- } else {
- writeBlockSequence(state, level, state.dump, compact);
- }
- if (duplicate) {
- state.dump = "&ref_" + duplicateIndex + state.dump;
- }
- } else {
- writeFlowSequence(state, level, state.dump);
- if (duplicate) {
- state.dump = "&ref_" + duplicateIndex + " " + state.dump;
- }
- }
- } else if (type === "[object String]") {
- if (state.tag !== "?") {
- writeScalar(state, state.dump, level, iskey, inblock);
- }
- } else if (type === "[object Undefined]") {
- return false;
- } else {
- if (state.skipInvalid) return false;
- throw new YAMLException("unacceptable kind of an object to dump " + type);
- }
- if (state.tag !== null && state.tag !== "?") {
- tagStr = encodeURI(
- state.tag[0] === "!" ? state.tag.slice(1) : state.tag
- ).replace(/!/g, "%21");
- if (state.tag[0] === "!") {
- tagStr = "!" + tagStr;
- } else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") {
- tagStr = "!!" + tagStr.slice(18);
- } else {
- tagStr = "!<" + tagStr + ">";
- }
- state.dump = tagStr + " " + state.dump;
- }
- }
- return true;
- }
- function getDuplicateReferences(object, state) {
- var objects = [], duplicatesIndexes = [], index, length;
- inspectNode(object, objects, duplicatesIndexes);
- for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
- state.duplicates.push(objects[duplicatesIndexes[index]]);
- }
- state.usedDuplicates = new Array(length);
- }
- function inspectNode(object, objects, duplicatesIndexes) {
- var objectKeyList, index, length;
- if (object !== null && typeof object === "object") {
- index = objects.indexOf(object);
- if (index !== -1) {
- if (duplicatesIndexes.indexOf(index) === -1) {
- duplicatesIndexes.push(index);
- }
- } else {
- objects.push(object);
- if (Array.isArray(object)) {
- for (index = 0, length = object.length; index < length; index += 1) {
- inspectNode(object[index], objects, duplicatesIndexes);
- }
- } else {
- objectKeyList = Object.keys(object);
- for (index = 0, length = objectKeyList.length; index < length; index += 1) {
- inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
- }
- }
- }
- }
- }
- function dump(input, options) {
- options = options || {};
- var state = new State(options);
- if (!state.noRefs) getDuplicateReferences(input, state);
- var value = input;
- if (state.replacer) {
- value = state.replacer.call({ "": value }, "", value);
- }
- if (writeNode(state, 0, value, true, true)) return state.dump + "\n";
- return "";
- }
- module2.exports.dump = dump;
- }
-});
-
-// ../../node_modules/js-yaml/index.js
-var require_js_yaml = __commonJS({
- "../../node_modules/js-yaml/index.js"(exports2, module2) {
- "use strict";
- var loader = require_loader();
- var dumper = require_dumper();
- function renamed(from, to) {
- return function() {
- throw new Error("Function yaml." + from + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default.");
- };
- }
- module2.exports.Type = require_type();
- module2.exports.Schema = require_schema();
- module2.exports.FAILSAFE_SCHEMA = require_failsafe();
- module2.exports.JSON_SCHEMA = require_json();
- module2.exports.CORE_SCHEMA = require_core();
- module2.exports.DEFAULT_SCHEMA = require_default();
- module2.exports.load = loader.load;
- module2.exports.loadAll = loader.loadAll;
- module2.exports.dump = dumper.dump;
- module2.exports.YAMLException = require_exception();
- module2.exports.types = {
- binary: require_binary(),
- float: require_float(),
- map: require_map(),
- null: require_null(),
- pairs: require_pairs(),
- set: require_set(),
- timestamp: require_timestamp(),
- bool: require_bool(),
- int: require_int(),
- merge: require_merge(),
- omap: require_omap(),
- seq: require_seq(),
- str: require_str()
- };
- module2.exports.safeLoad = renamed("safeLoad", "load");
- module2.exports.safeLoadAll = renamed("safeLoadAll", "loadAll");
- module2.exports.safeDump = renamed("safeDump", "dump");
- }
-});
-
-// ../../node_modules/path-browserify/index.js
-var require_path_browserify = __commonJS({
- "../../node_modules/path-browserify/index.js"(exports2, module2) {
- "use strict";
- function assertPath(path) {
- if (typeof path !== "string") {
- throw new TypeError("Path must be a string. Received " + JSON.stringify(path));
- }
- }
- function normalizeStringPosix(path, allowAboveRoot) {
- var res = "";
- var lastSegmentLength = 0;
- var lastSlash = -1;
- var dots = 0;
- var code;
- for (var i = 0; i <= path.length; ++i) {
- if (i < path.length)
- code = path.charCodeAt(i);
- else if (code === 47)
- break;
- else
- code = 47;
- if (code === 47) {
- if (lastSlash === i - 1 || dots === 1) {
- } else if (lastSlash !== i - 1 && dots === 2) {
- if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 || res.charCodeAt(res.length - 2) !== 46) {
- if (res.length > 2) {
- var lastSlashIndex = res.lastIndexOf("/");
- if (lastSlashIndex !== res.length - 1) {
- if (lastSlashIndex === -1) {
- res = "";
- lastSegmentLength = 0;
- } else {
- res = res.slice(0, lastSlashIndex);
- lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
- }
- lastSlash = i;
- dots = 0;
- continue;
- }
- } else if (res.length === 2 || res.length === 1) {
- res = "";
- lastSegmentLength = 0;
- lastSlash = i;
- dots = 0;
- continue;
- }
- }
- if (allowAboveRoot) {
- if (res.length > 0)
- res += "/..";
- else
- res = "..";
- lastSegmentLength = 2;
- }
- } else {
- if (res.length > 0)
- res += "/" + path.slice(lastSlash + 1, i);
- else
- res = path.slice(lastSlash + 1, i);
- lastSegmentLength = i - lastSlash - 1;
- }
- lastSlash = i;
- dots = 0;
- } else if (code === 46 && dots !== -1) {
- ++dots;
- } else {
- dots = -1;
- }
- }
- return res;
- }
- function _format(sep, pathObject) {
- var dir = pathObject.dir || pathObject.root;
- var base = pathObject.base || (pathObject.name || "") + (pathObject.ext || "");
- if (!dir) {
- return base;
- }
- if (dir === pathObject.root) {
- return dir + base;
- }
- return dir + sep + base;
- }
- var posix = {
- // path.resolve([from ...], to)
- resolve: function resolve() {
- var resolvedPath = "";
- var resolvedAbsolute = false;
- var cwd;
- for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
- var path;
- if (i >= 0)
- path = arguments[i];
- else {
- if (cwd === void 0)
- cwd = process.cwd();
- path = cwd;
- }
- assertPath(path);
- if (path.length === 0) {
- continue;
- }
- resolvedPath = path + "/" + resolvedPath;
- resolvedAbsolute = path.charCodeAt(0) === 47;
- }
- resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);
- if (resolvedAbsolute) {
- if (resolvedPath.length > 0)
- return "/" + resolvedPath;
- else
- return "/";
- } else if (resolvedPath.length > 0) {
- return resolvedPath;
- } else {
- return ".";
- }
- },
- normalize: function normalize(path) {
- assertPath(path);
- if (path.length === 0) return ".";
- var isAbsolute = path.charCodeAt(0) === 47;
- var trailingSeparator = path.charCodeAt(path.length - 1) === 47;
- path = normalizeStringPosix(path, !isAbsolute);
- if (path.length === 0 && !isAbsolute) path = ".";
- if (path.length > 0 && trailingSeparator) path += "/";
- if (isAbsolute) return "/" + path;
- return path;
- },
- isAbsolute: function isAbsolute(path) {
- assertPath(path);
- return path.length > 0 && path.charCodeAt(0) === 47;
- },
- join: function join() {
- if (arguments.length === 0)
- return ".";
- var joined;
- for (var i = 0; i < arguments.length; ++i) {
- var arg = arguments[i];
- assertPath(arg);
- if (arg.length > 0) {
- if (joined === void 0)
- joined = arg;
- else
- joined += "/" + arg;
- }
- }
- if (joined === void 0)
- return ".";
- return posix.normalize(joined);
- },
- relative: function relative(from, to) {
- assertPath(from);
- assertPath(to);
- if (from === to) return "";
- from = posix.resolve(from);
- to = posix.resolve(to);
- if (from === to) return "";
- var fromStart = 1;
- for (; fromStart < from.length; ++fromStart) {
- if (from.charCodeAt(fromStart) !== 47)
- break;
- }
- var fromEnd = from.length;
- var fromLen = fromEnd - fromStart;
- var toStart = 1;
- for (; toStart < to.length; ++toStart) {
- if (to.charCodeAt(toStart) !== 47)
- break;
- }
- var toEnd = to.length;
- var toLen = toEnd - toStart;
- var length = fromLen < toLen ? fromLen : toLen;
- var lastCommonSep = -1;
- var i = 0;
- for (; i <= length; ++i) {
- if (i === length) {
- if (toLen > length) {
- if (to.charCodeAt(toStart + i) === 47) {
- return to.slice(toStart + i + 1);
- } else if (i === 0) {
- return to.slice(toStart + i);
- }
- } else if (fromLen > length) {
- if (from.charCodeAt(fromStart + i) === 47) {
- lastCommonSep = i;
- } else if (i === 0) {
- lastCommonSep = 0;
- }
- }
- break;
- }
- var fromCode = from.charCodeAt(fromStart + i);
- var toCode = to.charCodeAt(toStart + i);
- if (fromCode !== toCode)
- break;
- else if (fromCode === 47)
- lastCommonSep = i;
- }
- var out = "";
- for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
- if (i === fromEnd || from.charCodeAt(i) === 47) {
- if (out.length === 0)
- out += "..";
- else
- out += "/..";
- }
- }
- if (out.length > 0)
- return out + to.slice(toStart + lastCommonSep);
- else {
- toStart += lastCommonSep;
- if (to.charCodeAt(toStart) === 47)
- ++toStart;
- return to.slice(toStart);
- }
- },
- _makeLong: function _makeLong(path) {
- return path;
- },
- dirname: function dirname(path) {
- assertPath(path);
- if (path.length === 0) return ".";
- var code = path.charCodeAt(0);
- var hasRoot = code === 47;
- var end = -1;
- var matchedSlash = true;
- for (var i = path.length - 1; i >= 1; --i) {
- code = path.charCodeAt(i);
- if (code === 47) {
- if (!matchedSlash) {
- end = i;
- break;
- }
- } else {
- matchedSlash = false;
- }
- }
- if (end === -1) return hasRoot ? "/" : ".";
- if (hasRoot && end === 1) return "//";
- return path.slice(0, end);
- },
- basename: function basename(path, ext) {
- if (ext !== void 0 && typeof ext !== "string") throw new TypeError('"ext" argument must be a string');
- assertPath(path);
- var start = 0;
- var end = -1;
- var matchedSlash = true;
- var i;
- if (ext !== void 0 && ext.length > 0 && ext.length <= path.length) {
- if (ext.length === path.length && ext === path) return "";
- var extIdx = ext.length - 1;
- var firstNonSlashEnd = -1;
- for (i = path.length - 1; i >= 0; --i) {
- var code = path.charCodeAt(i);
- if (code === 47) {
- if (!matchedSlash) {
- start = i + 1;
- break;
- }
- } else {
- if (firstNonSlashEnd === -1) {
- matchedSlash = false;
- firstNonSlashEnd = i + 1;
- }
- if (extIdx >= 0) {
- if (code === ext.charCodeAt(extIdx)) {
- if (--extIdx === -1) {
- end = i;
- }
- } else {
- extIdx = -1;
- end = firstNonSlashEnd;
- }
- }
- }
- }
- if (start === end) end = firstNonSlashEnd;
- else if (end === -1) end = path.length;
- return path.slice(start, end);
- } else {
- for (i = path.length - 1; i >= 0; --i) {
- if (path.charCodeAt(i) === 47) {
- if (!matchedSlash) {
- start = i + 1;
- break;
- }
- } else if (end === -1) {
- matchedSlash = false;
- end = i + 1;
- }
- }
- if (end === -1) return "";
- return path.slice(start, end);
- }
- },
- extname: function extname(path) {
- assertPath(path);
- var startDot = -1;
- var startPart = 0;
- var end = -1;
- var matchedSlash = true;
- var preDotState = 0;
- for (var i = path.length - 1; i >= 0; --i) {
- var code = path.charCodeAt(i);
- if (code === 47) {
- if (!matchedSlash) {
- startPart = i + 1;
- break;
- }
- continue;
- }
- if (end === -1) {
- matchedSlash = false;
- end = i + 1;
- }
- if (code === 46) {
- if (startDot === -1)
- startDot = i;
- else if (preDotState !== 1)
- preDotState = 1;
- } else if (startDot !== -1) {
- preDotState = -1;
- }
- }
- if (startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot
- preDotState === 0 || // The (right-most) trimmed path component is exactly '..'
- preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
- return "";
- }
- return path.slice(startDot, end);
- },
- format: function format(pathObject) {
- if (pathObject === null || typeof pathObject !== "object") {
- throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
- }
- return _format("/", pathObject);
- },
- parse: function parse2(path) {
- assertPath(path);
- var ret = { root: "", dir: "", base: "", ext: "", name: "" };
- if (path.length === 0) return ret;
- var code = path.charCodeAt(0);
- var isAbsolute = code === 47;
- var start;
- if (isAbsolute) {
- ret.root = "/";
- start = 1;
- } else {
- start = 0;
- }
- var startDot = -1;
- var startPart = 0;
- var end = -1;
- var matchedSlash = true;
- var i = path.length - 1;
- var preDotState = 0;
- for (; i >= start; --i) {
- code = path.charCodeAt(i);
- if (code === 47) {
- if (!matchedSlash) {
- startPart = i + 1;
- break;
- }
- continue;
- }
- if (end === -1) {
- matchedSlash = false;
- end = i + 1;
- }
- if (code === 46) {
- if (startDot === -1) startDot = i;
- else if (preDotState !== 1) preDotState = 1;
- } else if (startDot !== -1) {
- preDotState = -1;
- }
- }
- if (startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot
- preDotState === 0 || // The (right-most) trimmed path component is exactly '..'
- preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
- if (end !== -1) {
- if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);
- else ret.base = ret.name = path.slice(startPart, end);
- }
- } else {
- if (startPart === 0 && isAbsolute) {
- ret.name = path.slice(1, startDot);
- ret.base = path.slice(1, end);
- } else {
- ret.name = path.slice(startPart, startDot);
- ret.base = path.slice(startPart, end);
- }
- ret.ext = path.slice(startDot, end);
- }
- if (startPart > 0) ret.dir = path.slice(0, startPart - 1);
- else if (isAbsolute) ret.dir = "/";
- return ret;
- },
- sep: "/",
- delimiter: ":",
- win32: null,
- posix: null
- };
- posix.posix = posix;
- module2.exports = posix;
- }
-});
-
-// ../../node_modules/http2-client/lib/utils.js
-var require_utils = __commonJS({
- "../../node_modules/http2-client/lib/utils.js"(exports2, module2) {
- var DebounceTimers = class {
- constructor(cb, defaultDelay) {
- this.cb = cb;
- this.delay = defaultDelay;
- this.timers = {};
- this.pausers = {};
- }
- setDelay(delay) {
- if (delay >= 0)
- this.delay = delay;
- }
- pause(key) {
- this.pausers[key] = this.pausers[key] || 0;
- this.pausers[key]++;
- }
- unpause(key) {
- var count = this.pausers[key] || 0;
- if (count > 0)
- count--;
- this.pausers[key] = count;
- }
- unpauseAndTime(key) {
- this.unpause(key);
- this.time(key);
- }
- time(key) {
- var self2 = this;
- var timers = this.timers;
- var timer = this.timers[key];
- if (this.pausers[key] > 0)
- return;
- if (timer)
- clearTimeout(timer);
- timers[key] = setTimeout(function onTimer() {
- self2.cb(key);
- delete timers[key];
- }, self2.delay);
- }
- };
- var ERR_INVALID_ARG_TYPE = class extends TypeError {
- constructor(name, expected, actual) {
- const type = name.includes(".") ? "property" : "argument";
- let msg = `The "${name}" ${type} ${determiner} ${expected}`;
- }
- };
- function assertIsObject(value, name, types = "Object") {
- if (value !== void 0 && (value === null || typeof value !== "object" || Array.isArray(value))) {
- const err = new ERR_INVALID_ARG_TYPE(name, types, value);
- Error.captureStackTrace(err, assertIsObject);
- throw err;
- }
- }
- module2.exports = {
- ERR_INVALID_ARG_TYPE,
- assertIsObject,
- DebounceTimers
- };
- }
-});
-
-// ../../node_modules/http2-client/lib/request-options.js
-var require_request_options = __commonJS({
- "../../node_modules/http2-client/lib/request-options.js"(exports2, module2) {
- var { assertIsObject } = require_utils();
- function initializeOptions(options) {
- assertIsObject(options, "options");
- options = Object.assign({}, options);
- options.allowHalfOpen = true;
- options.rejectUnauthorized = false;
- assertIsObject(options.settings, "options.settings");
- options.settings = Object.assign({}, options.settings);
- options.Http1IncomingMessage = options.Http1IncomingMessage || this.http.IncomingMessage;
- options.Http1ServerResponse = options.Http1ServerResponse || this.http.ServerResponse;
- options.Http2ServerRequest = options.Http2ServerRequest || (this.http2 || {}).Http2ServerRequest;
- options.Http2ServerResponse = options.Http2ServerResponse || (this.http2 || {}).Http2ServerResponse;
- return options;
- }
- function initializeTLSOptions(options, servername) {
- options = initializeOptions.call(this, options);
- var ALPNProtocols = options.ALPNProtocols = [];
- if (this.http2Support)
- ALPNProtocols.push("h2");
- if (options.allowHTTP1 == true || !this.http2Support)
- ALPNProtocols.push("http/1.1");
- if (servername !== void 0 && options.servername === void 0)
- options.servername = servername;
- return options;
- }
- module2.exports = {
- initializeTLSOptions
- };
- }
-});
-
-// ../../node_modules/http2-client/lib/request.js
-var require_request = __commonJS({
- "../../node_modules/http2-client/lib/request.js"(exports2, module2) {
- var { URL: URL3 } = require("url");
- var { EventEmitter } = require("events");
- var _extend = require("util")._extend;
- var { DebounceTimers, assertIsObject, ERR_INVALID_ARG_TYPE } = require_utils();
- var { initializeTLSOptions } = require_request_options();
- var http = require("http");
- var https = require("https");
- var { Stream } = require("stream");
- function addFunctions(container, obj) {
- const proto = obj.prototype;
- Object.keys(proto).forEach((name) => {
- if (container.indexOf(name) != -1)
- return;
- if (name.indexOf("_") != 0 && typeof proto[name] == "function") {
- container.push(name);
- }
- });
- }
- var STUBBED_METHODS_NAME = [];
- addFunctions(STUBBED_METHODS_NAME, http.ClientRequest);
- addFunctions(STUBBED_METHODS_NAME, http.OutgoingMessage);
- addFunctions(STUBBED_METHODS_NAME, EventEmitter);
- addFunctions(STUBBED_METHODS_NAME, Stream);
- var PROPERTIES_TO_PROXY = [
- "httpVersionMajor",
- "httpVersionMinor",
- "httpVersion"
- ];
- var HEADERS_TO_REMOVE = ["host", "connection"];
- var $stubs = Symbol("stubs");
- function ClientRequest() {
- this.http2Mimic = true;
- this[$stubs] = [];
- for (var i = 0; i < STUBBED_METHODS_NAME.length; i++) {
- let name = STUBBED_METHODS_NAME[i];
- if (!ClientRequest.prototype[name]) {
- this[name] = function method() {
- return this.genericStubber(name, arguments);
- }.bind(this);
- }
- }
- var requestOptions, cb, url, args;
- const isInternal = arguments[0] instanceof RequestInternalEnforce;
- var isInternalMethod, isInternalProtocol;
- if (isInternal) {
- const enforceOptions = arguments[0];
- if (enforceOptions.method)
- isInternalMethod = enforceOptions.method;
- if (enforceOptions.protocol)
- isInternalProtocol = enforceOptions.protocol;
- }
- if (isInternal) {
- args = arguments[0].args;
- } else {
- args = arguments;
- }
- if (args[2] != void 0) {
- url = args[0];
- requestOptions = args[1];
- cb = args[2];
- } else if (args[1] == void 0) {
- requestOptions = args[0];
- } else {
- requestOptions = args[0];
- cb = args[1];
- }
- cb = cb || function dummy() {
- };
- if (typeof requestOptions === "string") {
- requestOptions = urlToOptions(new URL3(requestOptions));
- if (!requestOptions.hostname) {
- throw new Error("Unable to determine the domain name");
- }
- } else {
- if (url) {
- requestOptions = _extend(urlToOptions(new URL3(url)), requestOptions);
- } else {
- requestOptions = _extend({}, requestOptions);
- }
- }
- if (isInternalProtocol != isInternalProtocol) {
- requestOptions.protocol = isInternalProtocol;
- }
- if (requestOptions.protocol == "https:" && !requestOptions.port && requestOptions.port != 0)
- requestOptions.port = 443;
- if (!requestOptions.port && requestOptions.port != 0)
- requestOptions.port = 80;
- if (isInternalMethod) {
- requestOptions.method = isInternalMethod;
- } else if (!requestOptions.method)
- requestOptions.method = "GET";
- requestOptions.method = requestOptions.method.toUpperCase();
- const requestManager = requestOptions.requestManager || this.getGlobalManager(requestOptions);
- requestManager.handleClientRequest(this, requestOptions, cb);
- }
- ClientRequest.prototype = {
- getGlobalManager(options) {
- if (options.agent)
- return options.agent.protocol == "https:" ? HttpsRequest.globalManager : HttpRequest.globalManager;
- else
- return HttpRequestManager.globalManager;
- },
- genericStubber(method, args) {
- if (this[$stubs]) {
- this[$stubs].push([method, args]);
- return true;
- } else
- return this[method](...arguments);
- },
- on(eventName, cb) {
- if (eventName == "response") {
- if (!cb.http2Safe) {
- eventName = "http1.response";
- arguments[0] = eventName;
- }
- }
- if (this._on) {
- this._on(...arguments);
- } else
- this.genericStubber("on", arguments);
- },
- once(eventName, cb) {
- if (eventName == "response") {
- if (!cb.http2Safe) {
- eventName = "http1.response";
- }
- }
- if (this._once) {
- this._once(...arguments);
- } else
- this.genericStubber("once", arguments);
- },
- emitError(error) {
- if (this[$stubs]) {
- this[$stubs].forEach(([method, args]) => {
- if ((method === "on" || method === "once") && args[0] === "error") {
- args[1](error);
- }
- });
- } else
- return this.emit("error", error);
- },
- take(stream) {
- for (var i = 0; i < STUBBED_METHODS_NAME.length; i++) {
- let name = STUBBED_METHODS_NAME[i];
- if (stream[name]) {
- this[name] = stream[name].bind(stream);
- }
- }
- this._on = stream.on.bind(stream);
- this._once = stream.once.bind(stream);
- this.proxyProps(stream);
- for (let i2 = 0; i2 < this[$stubs].length; i2++) {
- var stub = this[$stubs][i2];
- stream[stub[0]](...stub[1]);
- }
- this[$stubs] = null;
- },
- proxyProps(http2Stream) {
- function getter() {
- return http2Stream[this];
- }
- function setter(value) {
- http2Stream[this] = value;
- }
- const notToProxy = ["on", "_on", "_once", "once", "http2Mimic"].concat(STUBBED_METHODS_NAME);
- const keys = Object.keys(this);
- const keysToProxy = [].concat(PROPERTIES_TO_PROXY);
- keys.forEach(function whichProxyKeys(key) {
- if (notToProxy.indexOf(key) == -1 && keysToProxy.indexOf(key) == -1) {
- keysToProxy.push(key);
- }
- });
- const properties = Object.getOwnPropertyDescriptors(http2Stream);
- for (var i = 0; i < keysToProxy.length; i++) {
- let name = keysToProxy[i];
- const propConfig = properties[name];
- let shouldCopyValue;
- if (!propConfig)
- shouldCopyValue = true;
- if (propConfig && (propConfig.writable || propConfig))
- shouldCopyValue = true;
- if (shouldCopyValue)
- http2Stream[name] = this[name];
- Object.defineProperty(this, name, {
- get: getter.bind(name),
- set: setter.bind(name)
- });
- }
- }
- };
- var HttpRequestManager = class _HttpRequestManager extends EventEmitter {
- constructor(options) {
- super();
- this.httpsAgent = https.globalAgent;
- this.httpAgent = http.globalAgent;
- this.init(options);
- }
- log() {
- }
- init(options) {
- options = options || {};
- this.http2Clients = {};
- this.cachedHTTP1Result = {};
- this.setModules();
- this.http2Debouncer = new DebounceTimers(function stopConnection(key) {
- this.log("stopping ", key);
- var foundConnection = this.http2Clients[key];
- if (foundConnection) {
- this.removeHttp2Client(key, foundConnection);
- }
- }.bind(this), 1e3);
- this.keepH1IdentificationCacheFor = options.keepH1IdentificationCacheFor || 3e4;
- this.http2Debouncer.setDelay(options.keepH2ConnectionFor);
- if (options.useHttp) {
- this.enforceProtocol = "http:";
- } else if (options.useHttps) {
- this.enforceProtocol = "https:";
- }
- }
- setModules() {
- this["http"] = require("http");
- this["https"] = require("https");
- this["tls"] = require("tls");
- this["net"] = require("net");
- this.http2Support = false;
- try {
- this["http2"] = require("http2");
- this.http2Support = true;
- } catch (err) {
- }
- }
- handleClientRequest(clientRequest, requestOptions, cb) {
- const requestManager = this;
- const clientKey = requestManager.getClientKey(requestOptions);
- if (requestManager.hasCachedConnection(clientKey)) {
- const socket = requestManager.getHttp2Client(clientKey);
- const connectionOptions = {
- createConnection() {
- return socket;
- }
- };
- process.nextTick(function onMakeRequest() {
- requestManager.makeRequest(clientRequest, clientKey, requestOptions, cb, connectionOptions);
- }.bind(requestManager));
- } else
- requestManager.holdConnectionToIdentification(clientKey, requestOptions, function onIdentification(error, connectionOptions) {
- if (error) {
- clientRequest.emitError(error);
- return;
- }
- requestManager.makeRequest(clientRequest, clientKey, requestOptions, cb, connectionOptions);
- }.bind(requestManager));
- }
- getClientKey(url) {
- return `${url.protocol || this.enforceProtocol}${url.servername || url.host || url.hostname}:${url.port}`;
- }
- getHttp2Client(clientKey) {
- return this.http2Clients[clientKey];
- }
- setHttp2Client(clientKey, client) {
- const httpManager = this;
- const prevClient = httpManager.http2Clients[clientKey];
- if (prevClient)
- httpManager.removeHttp2Client(clientKey, prevClient);
- httpManager.http2Clients[clientKey] = client;
- function closeClient() {
- httpManager.removeHttp2Client(clientKey, client);
- }
- client.on("close", closeClient);
- client.on("goaway", closeClient);
- client.on("error", closeClient);
- client.on("frameError", closeClient);
- client.on("timeout", closeClient);
- }
- removeHttp2Client(clientKey, client) {
- try {
- delete this.http2Clients[clientKey];
- if (!client.closed) {
- client.close();
- }
- } catch (err) {
- }
- client.removeAllListeners("close");
- client.removeAllListeners("error");
- client.removeAllListeners("frameError");
- client.removeAllListeners("timeout");
- }
- request(url, options, cb) {
- var args = new RequestInternalEnforce(arguments);
- if (this.enforceProtocol) {
- args.protocol = this.enforceProtocol;
- }
- return new ClientRequest(args);
- }
- get() {
- var args = new RequestInternalEnforce(arguments);
- args.method = "GET";
- var request = this.request(args);
- request.end();
- return request;
- }
- hasCachedConnection(clientKey) {
- const http2Client = this.getHttp2Client(clientKey);
- if (http2Client) {
- return true;
- }
- return this.cachedHTTP1Result[clientKey] + this.keepH1IdentificationCacheFor < Date.now();
- }
- makeRequest(inStream, clientKey, requestOptions, cb, connectionOptions) {
- const http2Client = this.getHttp2Client(clientKey);
- if (http2Client) {
- return this.makeHttp2Request(clientKey, inStream, http2Client, Object.assign(connectionOptions || {}, requestOptions), cb);
- }
- if (!requestOptions.agent) {
- if (requestOptions.protocol == "https:")
- requestOptions.agent = this.httpsAgent;
- else
- requestOptions.agent = this.httpAgent;
- }
- return this.makeHttpRequest(clientKey, inStream, requestOptions, cb, connectionOptions);
- }
- holdConnectionToIdentification(clientKey, requestOptions, cb) {
- const topic = `identify-${clientKey}`;
- if (this._events[topic])
- this.once(topic, cb);
- else {
- this.once(topic, function letKnowThereIsAnEvent() {
- });
- const socket = this.identifyConnection(requestOptions, function onIdentify(error, type) {
- if (error) {
- return cb(error);
- }
- var options = {
- createConnection() {
- return socket;
- }
- };
- if (type == "h2" && this.http2Support) {
- var http2Client = this.http2.connect(requestOptions, options);
- this.setHttp2Client(clientKey, http2Client);
- } else {
- this.cachedHTTP1Result[clientKey] = Date.now();
- }
- cb(null, options);
- this.emit(topic, options);
- }.bind(this));
- }
- }
- makeHttpRequest(clientKey, inStream, options, cb, connectionOptions) {
- if (options instanceof URL3)
- options = urlToOptions(options);
- const h1op = _extend({}, options);
- if (connectionOptions)
- h1op.createConnection = connectionOptions.createConnection;
- const requestModule = h1op.protocol == "https:" ? this.https : this.http;
- const req = requestModule.request(h1op, cb);
- inStream.take(req);
- inStream._on("response", function onHttp1Response(v) {
- this.emit("http1.response", v);
- });
- }
- makeHttp2Request(clientKey, inStream, http2Client, requestOptions, cb) {
- var http2Debouncer = this.http2Debouncer;
- http2Debouncer.pause(clientKey);
- var headers = _extend({}, requestOptions.headers || {});
- if (requestOptions.method)
- headers[":method"] = requestOptions.method;
- if (requestOptions.path)
- headers[":path"] = requestOptions.path;
- Object.keys(headers).forEach((key) => {
- if (HEADERS_TO_REMOVE.indexOf((key + "").toLowerCase()) != -1) {
- delete headers[key];
- }
- });
- requestOptions.headers = headers;
- var req = http2Client.request(
- headers
- );
- inStream.emit("socket", requestOptions.createConnection());
- let maxContentLength;
- let currentContent = 0;
- req.on("data", function onData(data) {
- currentContent += data.length;
- if (currentContent >= maxContentLength)
- http2Debouncer.unpauseAndTime(clientKey);
- });
- inStream.take(req);
- function onResponse(headers2) {
- maxContentLength = parseInt(headers2["content-length"]);
- if (maxContentLength < 0)
- this.http2Debouncer.unpauseAndTime(clientKey);
- _HttpRequestManager.httpCompatibleResponse(req, requestOptions, headers2);
- inStream.emit("http1.response", req);
- if (cb)
- cb(req);
- }
- onResponse.http2Safe = true;
- req.once("response", onResponse.bind(this));
- }
- static httpCompatibleResponse(res, requestOptions, headers) {
- res.httpVersion = "2.0";
- res.rawHeaders = headers;
- res.headers = headers;
- res.statusCode = headers[":status"];
- delete headers[":status"];
- }
- identifyConnection(requestOptions, cb) {
- var socket = this.connect(requestOptions, { allowHTTP1: true }, function onConnect() {
- socket.removeListener("error", cb);
- if (socket.alpnProtocol == "h2") {
- cb(null, "h2");
- } else {
- socket.end();
- cb(null, "h1");
- }
- });
- socket.on("error", cb);
- return socket;
- }
- connect(authority, options, listener) {
- if (typeof options === "function") {
- listener = options;
- options = void 0;
- }
- assertIsObject(options, "options");
- options = Object.assign({}, options);
- if (typeof authority === "string")
- authority = new URL3(authority);
- assertIsObject(authority, "authority", ["string", "Object", "URL"]);
- var protocol = authority.protocol || options.protocol || (this.enforceProtocol != "detect" ? this.enforceProtocol : null) || "http:";
- var port = "" + (authority.port !== "" ? authority.port : authority.protocol === "http:" ? 80 : 443);
- var host = authority.hostname || authority.host || "localhost";
- var socket;
- if (typeof options.createConnection === "function") {
- socket = options.createConnection(authority, options);
- } else {
- switch (protocol) {
- case "http:":
- socket = this.net.connect(port, host, listener);
- break;
- case "https:":
- socket = this.tls.connect(port, host, initializeTLSOptions.call(this, options, host), listener);
- break;
- default:
- throw new Error("Not supprted" + protocol);
- }
- }
- return socket;
- }
- };
- function urlToOptions(url) {
- var options = {
- protocol: url.protocol,
- hostname: url.hostname,
- hash: url.hash,
- search: url.search,
- pathname: url.pathname,
- path: `${url.pathname}${url.search}`,
- href: url.href
- };
- if (url.port !== "") {
- options.port = Number(url.port);
- }
- if (url.username || url.password) {
- options.auth = `${url.username}:${url.password}`;
- }
- return options;
- }
- var RequestInternalEnforce = class _RequestInternalEnforce {
- constructor(args) {
- if (args[0] instanceof _RequestInternalEnforce) {
- return args[0];
- }
- this.args = args;
- this.method = null;
- this.protocol = null;
- }
- };
- var HttpsRequest = class extends HttpRequestManager {
- constructor() {
- super(...arguments);
- this.Agent = https.Agent;
- this.globalAgent = https.globalAgent;
- this.enforceProtocol = "https:";
- }
- };
- var httpsRequestSinglton = new HttpsRequest();
- HttpsRequest.globalManager = httpsRequestSinglton;
- HttpsRequest.Manager = HttpsRequest;
- var HttpRequest = class extends HttpRequestManager {
- constructor() {
- super(...arguments);
- this.Agent = http.Agent;
- this.globalAgent = http.globalAgent;
- this.enforceProtocol = "http:";
- }
- };
- var httpRequestSinglton = new HttpRequest();
- HttpRequest.globalManager = httpRequestSinglton;
- HttpRequest.Manager = HttpRequest;
- var singeltonHttpManager = new HttpRequestManager();
- singeltonHttpManager.enforceProtocol = "detect";
- HttpRequestManager.globalManager = singeltonHttpManager;
- module2.exports = {
- HttpRequest,
- HttpsRequest,
- HTTP2OutgoingMessage: ClientRequest,
- ClientRequest,
- HttpRequestManager
- };
- }
-});
-
-// ../../node_modules/http2-client/lib/http.js
-var require_http = __commonJS({
- "../../node_modules/http2-client/lib/http.js"(exports2, module2) {
- var {
- HttpRequest,
- ClientRequest
- } = require_request();
- var globalManager = HttpRequest.globalManager;
- var request = globalManager.request.bind(globalManager);
- var get = globalManager.get.bind(globalManager);
- var http = Object.assign({}, require("http"));
- module2.exports = Object.assign(http, {
- ClientRequest,
- globalManager,
- request,
- get
- });
- }
-});
-
-// ../../node_modules/http2-client/lib/https.js
-var require_https = __commonJS({
- "../../node_modules/http2-client/lib/https.js"(exports2, module2) {
- var {
- HttpsRequest,
- ClientRequest
- } = require_request();
- var globalManager = HttpsRequest.globalManager;
- var request = globalManager.request.bind(globalManager);
- var get = globalManager.get.bind(globalManager);
- var https = Object.assign({}, require("https"));
- module2.exports = Object.assign(https, {
- ClientRequest,
- globalManager,
- request,
- get
- });
- }
-});
-
-// ../../node_modules/http2-client/lib/index.js
-var require_lib = __commonJS({
- "../../node_modules/http2-client/lib/index.js"(exports2, module2) {
- var {
- HttpRequestManager,
- HTTP2OutgoingMessage,
- ClientRequest
- } = require_request();
- var http = require_http();
- var https = require_https();
- var autoDetectManager = new HttpRequestManager();
- HttpRequestManager.globalManager = autoDetectManager;
- var request = autoDetectManager.request.bind(autoDetectManager);
- var get = autoDetectManager.get.bind(autoDetectManager);
- module2.exports = {
- HTTP2OutgoingMessage,
- ClientRequest,
- globalManager: HttpRequestManager.globalManager,
- request,
- get,
- http,
- https
- };
- }
-});
-
-// ../../node_modules/node-fetch-h2/lib/index.js
-var require_lib2 = __commonJS({
- "../../node_modules/node-fetch-h2/lib/index.js"(exports2, module2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", { value: true });
- function _interopDefault(ex) {
- return ex && typeof ex === "object" && "default" in ex ? ex["default"] : ex;
- }
- var Stream = _interopDefault(require("stream"));
- var http = _interopDefault(require("http"));
- var Url = _interopDefault(require("url"));
- var h2 = _interopDefault(require_lib());
- var zlib = _interopDefault(require("zlib"));
- var BUFFER = Symbol("buffer");
- var TYPE = Symbol("type");
- var Blob2 = class _Blob {
- constructor() {
- this[TYPE] = "";
- const blobParts = arguments[0];
- const options = arguments[1];
- const buffers = [];
- if (blobParts) {
- const a = blobParts;
- const length = Number(a.length);
- for (let i = 0; i < length; i++) {
- const element = a[i];
- let buffer;
- if (element instanceof Buffer) {
- buffer = element;
- } else if (ArrayBuffer.isView(element)) {
- buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength);
- } else if (element instanceof ArrayBuffer) {
- buffer = Buffer.from(element);
- } else if (element instanceof _Blob) {
- buffer = element[BUFFER];
- } else {
- buffer = Buffer.from(typeof element === "string" ? element : String(element));
- }
- buffers.push(buffer);
- }
- }
- this[BUFFER] = Buffer.concat(buffers);
- let type = options && options.type !== void 0 && String(options.type).toLowerCase();
- if (type && !/[^\u0020-\u007E]/.test(type)) {
- this[TYPE] = type;
- }
- }
- get size() {
- return this[BUFFER].length;
- }
- get type() {
- return this[TYPE];
- }
- slice() {
- const size = this.size;
- const start = arguments[0];
- const end = arguments[1];
- let relativeStart, relativeEnd;
- if (start === void 0) {
- relativeStart = 0;
- } else if (start < 0) {
- relativeStart = Math.max(size + start, 0);
- } else {
- relativeStart = Math.min(start, size);
- }
- if (end === void 0) {
- relativeEnd = size;
- } else if (end < 0) {
- relativeEnd = Math.max(size + end, 0);
- } else {
- relativeEnd = Math.min(end, size);
- }
- const span = Math.max(relativeEnd - relativeStart, 0);
- const buffer = this[BUFFER];
- const slicedBuffer = buffer.slice(relativeStart, relativeStart + span);
- const blob = new _Blob([], { type: arguments[2] });
- blob[BUFFER] = slicedBuffer;
- return blob;
- }
- };
- Object.defineProperties(Blob2.prototype, {
- size: { enumerable: true },
- type: { enumerable: true },
- slice: { enumerable: true }
- });
- Object.defineProperty(Blob2.prototype, Symbol.toStringTag, {
- value: "Blob",
- writable: false,
- enumerable: false,
- configurable: true
- });
- function FetchError(message, type, systemError) {
- Error.call(this, message);
- this.message = message;
- this.type = type;
- if (systemError) {
- this.code = this.errno = systemError.code;
- }
- Error.captureStackTrace(this, this.constructor);
- }
- FetchError.prototype = Object.create(Error.prototype);
- FetchError.prototype.constructor = FetchError;
- FetchError.prototype.name = "FetchError";
- var convert2;
- try {
- convert2 = require("encoding").convert;
- } catch (e) {
- }
- var INTERNALS = Symbol("Body internals");
- var PassThrough = Stream.PassThrough;
- function Body(body) {
- var _this = this;
- var _ref = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, _ref$size = _ref.size;
- let size = _ref$size === void 0 ? 0 : _ref$size;
- var _ref$timeout = _ref.timeout;
- let timeout = _ref$timeout === void 0 ? 0 : _ref$timeout;
- if (body == null) {
- body = null;
- } else if (isURLSearchParams(body)) {
- body = Buffer.from(body.toString());
- } else if (body instanceof Blob2) {
- body = body[BUFFER];
- } else if (Buffer.isBuffer(body)) ;
- else if (Object.prototype.toString.call(body) === "[object ArrayBuffer]") {
- body = Buffer.from(body);
- } else if (ArrayBuffer.isView(body)) {
- body = Buffer.from(body.buffer, body.byteOffset, body.byteLength);
- } else if (body instanceof Stream) ;
- else {
- body = Buffer.from(String(body));
- }
- this[INTERNALS] = {
- body,
- disturbed: false,
- error: null
- };
- this.size = size;
- this.timeout = timeout;
- if (body instanceof Stream) {
- body.on("error", function(err) {
- const error = err.name === "AbortError" ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, "system", err);
- _this[INTERNALS].error = error;
- });
- }
- }
- Body.prototype = {
- get body() {
- return this[INTERNALS].body;
- },
- get bodyUsed() {
- return this[INTERNALS].disturbed;
- },
- /**
- * Decode response as ArrayBuffer
- *
- * @return Promise
- */
- arrayBuffer() {
- return consumeBody.call(this).then(function(buf) {
- return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
- });
- },
- /**
- * Return raw response as Blob
- *
- * @return Promise
- */
- blob() {
- let ct = this.headers && this.headers.get("content-type") || "";
- return consumeBody.call(this).then(function(buf) {
- return Object.assign(
- // Prevent copying
- new Blob2([], {
- type: ct.toLowerCase()
- }),
- {
- [BUFFER]: buf
- }
- );
- });
- },
- /**
- * Decode response as json
- *
- * @return Promise
- */
- json() {
- var _this2 = this;
- return consumeBody.call(this).then(function(buffer) {
- try {
- return JSON.parse(buffer.toString());
- } catch (err) {
- return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, "invalid-json"));
- }
- });
- },
- /**
- * Decode response as text
- *
- * @return Promise
- */
- text() {
- return consumeBody.call(this).then(function(buffer) {
- return buffer.toString();
- });
- },
- /**
- * Decode response as buffer (non-spec api)
- *
- * @return Promise
- */
- buffer() {
- return consumeBody.call(this);
- },
- /**
- * Decode response as text, while automatically detecting the encoding and
- * trying to decode to UTF-8 (non-spec api)
- *
- * @return Promise
- */
- textConverted() {
- var _this3 = this;
- return consumeBody.call(this).then(function(buffer) {
- return convertBody(buffer, _this3.headers);
- });
- }
- };
- Object.defineProperties(Body.prototype, {
- body: { enumerable: true },
- bodyUsed: { enumerable: true },
- arrayBuffer: { enumerable: true },
- blob: { enumerable: true },
- json: { enumerable: true },
- text: { enumerable: true }
- });
- Body.mixIn = function(proto) {
- for (const name of Object.getOwnPropertyNames(Body.prototype)) {
- if (!(name in proto)) {
- const desc = Object.getOwnPropertyDescriptor(Body.prototype, name);
- Object.defineProperty(proto, name, desc);
- }
- }
- };
- function consumeBody() {
- var _this4 = this;
- if (this[INTERNALS].disturbed) {
- return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`));
- }
- this[INTERNALS].disturbed = true;
- if (this[INTERNALS].error) {
- return Body.Promise.reject(this[INTERNALS].error);
- }
- if (this.body === null) {
- return Body.Promise.resolve(Buffer.alloc(0));
- }
- if (Buffer.isBuffer(this.body)) {
- return Body.Promise.resolve(this.body);
- }
- if (!(this.body instanceof Stream)) {
- return Body.Promise.resolve(Buffer.alloc(0));
- }
- let accum = [];
- let accumBytes = 0;
- let abort = false;
- return new Body.Promise(function(resolve, reject) {
- let resTimeout;
- if (_this4.timeout) {
- resTimeout = setTimeout(function() {
- abort = true;
- reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, "body-timeout"));
- }, _this4.timeout);
- }
- _this4.body.on("error", function(err) {
- if (err.name === "AbortError") {
- abort = true;
- reject(err);
- } else {
- reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, "system", err));
- }
- });
- _this4.body.on("data", function(chunk) {
- if (abort || chunk === null) {
- return;
- }
- if (_this4.size && accumBytes + chunk.length > _this4.size) {
- abort = true;
- reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, "max-size"));
- return;
- }
- accumBytes += chunk.length;
- accum.push(chunk);
- });
- _this4.body.on("end", function() {
- if (abort) {
- return;
- }
- clearTimeout(resTimeout);
- try {
- resolve(Buffer.concat(accum));
- } catch (err) {
- reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, "system", err));
- }
- });
- });
- }
- function convertBody(buffer, headers) {
- if (typeof convert2 !== "function") {
- throw new Error("The package `encoding` must be installed to use the textConverted() function");
- }
- const ct = headers.get("content-type");
- let charset = "utf-8";
- let res, str;
- if (ct) {
- res = /charset=([^;]*)/i.exec(ct);
- }
- str = buffer.slice(0, 1024).toString();
- if (!res && str) {
- res = / 0 && arguments[0] !== void 0 ? arguments[0] : void 0;
- this[MAP] = /* @__PURE__ */ Object.create(null);
- if (init instanceof _Headers) {
- const rawHeaders = init.raw();
- const headerNames = Object.keys(rawHeaders);
- for (const headerName of headerNames) {
- for (const value of rawHeaders[headerName]) {
- this.append(headerName, value);
- }
- }
- return;
- }
- if (init == null) ;
- else if (typeof init === "object") {
- const method = init[Symbol.iterator];
- if (method != null) {
- if (typeof method !== "function") {
- throw new TypeError("Header pairs must be iterable");
- }
- const pairs = [];
- for (const pair of init) {
- if (typeof pair !== "object" || typeof pair[Symbol.iterator] !== "function") {
- throw new TypeError("Each header pair must be iterable");
- }
- pairs.push(Array.from(pair));
- }
- for (const pair of pairs) {
- if (pair.length !== 2) {
- throw new TypeError("Each header pair must be a name/value tuple");
- }
- this.append(pair[0], pair[1]);
- }
- } else {
- for (const key of Object.keys(init)) {
- const value = init[key];
- this.append(key, value);
- }
- }
- } else {
- throw new TypeError("Provided initializer must be an object");
- }
- }
- /**
- * Return combined header value given name
- *
- * @param String name Header name
- * @return Mixed
- */
- get(name) {
- name = `${name}`;
- validateName(name);
- const key = find(this[MAP], name);
- if (key === void 0) {
- return null;
- }
- return this[MAP][key].join(", ");
- }
- /**
- * Iterate over all headers
- *
- * @param Function callback Executed for each item with parameters (value, name, thisArg)
- * @param Boolean thisArg `this` context for callback function
- * @return Void
- */
- forEach(callback) {
- let thisArg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : void 0;
- let pairs = getHeaders(this);
- let i = 0;
- while (i < pairs.length) {
- var _pairs$i = pairs[i];
- const name = _pairs$i[0], value = _pairs$i[1];
- callback.call(thisArg, value, name, this);
- pairs = getHeaders(this);
- i++;
- }
- }
- /**
- * Overwrite header values given name
- *
- * @param String name Header name
- * @param String value Header value
- * @return Void
- */
- set(name, value) {
- name = `${name}`;
- value = `${value}`;
- validateName(name);
- validateValue(value);
- const key = find(this[MAP], name);
- this[MAP][key !== void 0 ? key : name] = [value];
- }
- /**
- * Append a value onto existing header
- *
- * @param String name Header name
- * @param String value Header value
- * @return Void
- */
- append(name, value) {
- name = `${name}`;
- value = `${value}`;
- validateName(name);
- validateValue(value);
- const key = find(this[MAP], name);
- if (key !== void 0) {
- this[MAP][key].push(value);
- } else {
- this[MAP][name] = [value];
- }
- }
- /**
- * Check for header name existence
- *
- * @param String name Header name
- * @return Boolean
- */
- has(name) {
- name = `${name}`;
- validateName(name);
- return find(this[MAP], name) !== void 0;
- }
- /**
- * Delete all header values given name
- *
- * @param String name Header name
- * @return Void
- */
- delete(name) {
- name = `${name}`;
- validateName(name);
- const key = find(this[MAP], name);
- if (key !== void 0) {
- delete this[MAP][key];
- }
- }
- /**
- * Return raw headers (non-spec api)
- *
- * @return Object
- */
- raw() {
- return this[MAP];
- }
- /**
- * Get an iterator on keys.
- *
- * @return Iterator
- */
- keys() {
- return createHeadersIterator(this, "key");
- }
- /**
- * Get an iterator on values.
- *
- * @return Iterator
- */
- values() {
- return createHeadersIterator(this, "value");
- }
- /**
- * Get an iterator on entries.
- *
- * This is the default iterator of the Headers object.
- *
- * @return Iterator
- */
- [Symbol.iterator]() {
- return createHeadersIterator(this, "key+value");
- }
- };
- Headers.prototype.entries = Headers.prototype[Symbol.iterator];
- Object.defineProperty(Headers.prototype, Symbol.toStringTag, {
- value: "Headers",
- writable: false,
- enumerable: false,
- configurable: true
- });
- Object.defineProperties(Headers.prototype, {
- get: { enumerable: true },
- forEach: { enumerable: true },
- set: { enumerable: true },
- append: { enumerable: true },
- has: { enumerable: true },
- delete: { enumerable: true },
- keys: { enumerable: true },
- values: { enumerable: true },
- entries: { enumerable: true }
- });
- function getHeaders(headers) {
- let kind = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "key+value";
- const keys = Object.keys(headers[MAP]).sort();
- return keys.map(kind === "key" ? function(k) {
- return k.toLowerCase();
- } : kind === "value" ? function(k) {
- return headers[MAP][k].join(", ");
- } : function(k) {
- return [k.toLowerCase(), headers[MAP][k].join(", ")];
- });
- }
- var INTERNAL = Symbol("internal");
- function createHeadersIterator(target, kind) {
- const iterator = Object.create(HeadersIteratorPrototype);
- iterator[INTERNAL] = {
- target,
- kind,
- index: 0
- };
- return iterator;
- }
- var HeadersIteratorPrototype = Object.setPrototypeOf({
- next() {
- if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) {
- throw new TypeError("Value of `this` is not a HeadersIterator");
- }
- var _INTERNAL = this[INTERNAL];
- const target = _INTERNAL.target, kind = _INTERNAL.kind, index = _INTERNAL.index;
- const values = getHeaders(target, kind);
- const len = values.length;
- if (index >= len) {
- return {
- value: void 0,
- done: true
- };
- }
- this[INTERNAL].index = index + 1;
- return {
- value: values[index],
- done: false
- };
- }
- }, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));
- Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, {
- value: "HeadersIterator",
- writable: false,
- enumerable: false,
- configurable: true
- });
- function exportNodeCompatibleHeaders(headers) {
- const obj = Object.assign({ __proto__: null }, headers[MAP]);
- const hostHeaderKey = find(headers[MAP], "Host");
- if (hostHeaderKey !== void 0) {
- obj[hostHeaderKey] = obj[hostHeaderKey][0];
- }
- return obj;
- }
- function createHeadersLenient(obj) {
- const headers = new Headers();
- for (const name of Object.keys(obj)) {
- if (invalidTokenRegex.test(name)) {
- continue;
- }
- if (Array.isArray(obj[name])) {
- for (const val of obj[name]) {
- if (invalidHeaderCharRegex.test(val)) {
- continue;
- }
- if (headers[MAP][name] === void 0) {
- headers[MAP][name] = [val];
- } else {
- headers[MAP][name].push(val);
- }
- }
- } else if (!invalidHeaderCharRegex.test(obj[name])) {
- headers[MAP][name] = [obj[name]];
- }
- }
- return headers;
- }
- var INTERNALS$1 = Symbol("Response internals");
- var STATUS_CODES = http.STATUS_CODES;
- var Response = class _Response {
- constructor() {
- let body = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
- let opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
- Body.call(this, body, opts);
- const status = opts.status || 200;
- const headers = new Headers(opts.headers);
- if (body != null && !headers.has("Content-Type")) {
- const contentType = extractContentType(body);
- if (contentType) {
- headers.append("Content-Type", contentType);
- }
- }
- this[INTERNALS$1] = {
- url: opts.url,
- status,
- statusText: opts.statusText || STATUS_CODES[status],
- headers
- };
- }
- get url() {
- return this[INTERNALS$1].url;
- }
- get status() {
- return this[INTERNALS$1].status;
- }
- /**
- * Convenience property representing if the request ended normally
- */
- get ok() {
- return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;
- }
- get statusText() {
- return this[INTERNALS$1].statusText;
- }
- get headers() {
- return this[INTERNALS$1].headers;
- }
- /**
- * Clone this response
- *
- * @return Response
- */
- clone() {
- return new _Response(clone(this), {
- url: this.url,
- status: this.status,
- statusText: this.statusText,
- headers: this.headers,
- ok: this.ok
- });
- }
- };
- Body.mixIn(Response.prototype);
- Object.defineProperties(Response.prototype, {
- url: { enumerable: true },
- status: { enumerable: true },
- ok: { enumerable: true },
- statusText: { enumerable: true },
- headers: { enumerable: true },
- clone: { enumerable: true }
- });
- Object.defineProperty(Response.prototype, Symbol.toStringTag, {
- value: "Response",
- writable: false,
- enumerable: false,
- configurable: true
- });
- var INTERNALS$2 = Symbol("Request internals");
- var parse_url = Url.parse;
- var format_url = Url.format;
- var streamDestructionSupported = "destroy" in Stream.Readable.prototype;
- function isRequest(input) {
- return typeof input === "object" && typeof input[INTERNALS$2] === "object";
- }
- function isAbortSignal(signal) {
- const proto = signal && typeof signal === "object" && Object.getPrototypeOf(signal);
- return !!(proto && proto.constructor.name === "AbortSignal");
- }
- var Request = class _Request {
- constructor(input) {
- let init = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
- let parsedURL;
- if (!isRequest(input)) {
- if (input && input.href) {
- parsedURL = parse_url(input.href);
- } else {
- parsedURL = parse_url(`${input}`);
- }
- input = {};
- } else {
- parsedURL = parse_url(input.url);
- }
- let method = init.method || input.method || "GET";
- method = method.toUpperCase();
- if ((init.body != null || isRequest(input) && input.body !== null) && (method === "GET" || method === "HEAD")) {
- throw new TypeError("Request with GET/HEAD method cannot have body");
- }
- let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null;
- Body.call(this, inputBody, {
- timeout: init.timeout || input.timeout || 0,
- size: init.size || input.size || 0
- });
- const headers = new Headers(init.headers || input.headers || {});
- if (inputBody != null && !headers.has("Content-Type")) {
- const contentType = extractContentType(inputBody);
- if (contentType) {
- headers.append("Content-Type", contentType);
- }
- }
- let signal = isRequest(input) ? input.signal : null;
- if ("signal" in init) signal = init.signal;
- if (signal != null && !isAbortSignal(signal)) {
- throw new TypeError("Expected signal to be an instanceof AbortSignal");
- }
- this[INTERNALS$2] = {
- method,
- redirect: init.redirect || input.redirect || "follow",
- headers,
- parsedURL,
- signal
- };
- this.follow = init.follow !== void 0 ? init.follow : input.follow !== void 0 ? input.follow : 20;
- this.compress = init.compress !== void 0 ? init.compress : input.compress !== void 0 ? input.compress : true;
- this.counter = init.counter || input.counter || 0;
- this.agent = init.agent || input.agent;
- }
- get method() {
- return this[INTERNALS$2].method;
- }
- get url() {
- return format_url(this[INTERNALS$2].parsedURL);
- }
- get headers() {
- return this[INTERNALS$2].headers;
- }
- get redirect() {
- return this[INTERNALS$2].redirect;
- }
- get signal() {
- return this[INTERNALS$2].signal;
- }
- /**
- * Clone this request
- *
- * @return Request
- */
- clone() {
- return new _Request(this);
- }
- };
- Body.mixIn(Request.prototype);
- Object.defineProperty(Request.prototype, Symbol.toStringTag, {
- value: "Request",
- writable: false,
- enumerable: false,
- configurable: true
- });
- Object.defineProperties(Request.prototype, {
- method: { enumerable: true },
- url: { enumerable: true },
- headers: { enumerable: true },
- redirect: { enumerable: true },
- clone: { enumerable: true },
- signal: { enumerable: true }
- });
- function getNodeRequestOptions(request) {
- const parsedURL = request[INTERNALS$2].parsedURL;
- const headers = new Headers(request[INTERNALS$2].headers);
- if (!headers.has("Accept")) {
- headers.set("Accept", "*/*");
- }
- if (!parsedURL.protocol || !parsedURL.hostname) {
- throw new TypeError("Only absolute URLs are supported");
- }
- if (!/^https?:$/.test(parsedURL.protocol)) {
- throw new TypeError("Only HTTP(S) protocols are supported");
- }
- if (request.signal && request.body instanceof Stream.Readable && !streamDestructionSupported) {
- throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8");
- }
- let contentLengthValue = null;
- if (request.body == null && /^(POST|PUT)$/i.test(request.method)) {
- contentLengthValue = "0";
- }
- if (request.body != null) {
- const totalBytes = getTotalBytes(request);
- if (typeof totalBytes === "number") {
- contentLengthValue = String(totalBytes);
- }
- }
- if (contentLengthValue) {
- headers.set("Content-Length", contentLengthValue);
- }
- if (!headers.has("User-Agent")) {
- headers.set("User-Agent", "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)");
- }
- if (request.compress && !headers.has("Accept-Encoding")) {
- headers.set("Accept-Encoding", "gzip,deflate");
- }
- if (!headers.has("Connection") && !request.agent) {
- headers.set("Connection", "close");
- }
- return Object.assign({}, parsedURL, {
- method: request.method,
- headers: exportNodeCompatibleHeaders(headers),
- agent: request.agent
- });
- }
- function AbortError(message) {
- Error.call(this, message);
- this.type = "aborted";
- this.message = message;
- Error.captureStackTrace(this, this.constructor);
- }
- AbortError.prototype = Object.create(Error.prototype);
- AbortError.prototype.constructor = AbortError;
- AbortError.prototype.name = "AbortError";
- var PassThrough$1 = Stream.PassThrough;
- var resolve_url = Url.resolve;
- function fetch(url, opts) {
- if (!fetch.Promise) {
- throw new Error("native promise missing, set fetch.Promise to your favorite alternative");
- }
- Body.Promise = fetch.Promise;
- return new fetch.Promise(function(resolve, reject) {
- const request = new Request(url, opts);
- const options = getNodeRequestOptions(request);
- const send = h2.request;
- const signal = request.signal;
- let response = null;
- const abort = function abort2() {
- let error = new AbortError("The user aborted a request.");
- reject(error);
- if (request.body && request.body instanceof Stream.Readable) {
- request.body.destroy(error);
- }
- if (!response || !response.body) return;
- response.body.emit("error", error);
- };
- if (signal && signal.aborted) {
- abort();
- return;
- }
- const abortAndFinalize = function abortAndFinalize2() {
- abort();
- finalize();
- };
- const req = send(options);
- let reqTimeout;
- if (signal) {
- signal.addEventListener("abort", abortAndFinalize);
- }
- function finalize() {
- req.abort();
- if (signal) signal.removeEventListener("abort", abortAndFinalize);
- clearTimeout(reqTimeout);
- }
- if (request.timeout) {
- req.once("socket", function(socket) {
- reqTimeout = setTimeout(function() {
- reject(new FetchError(`network timeout at: ${request.url}`, "request-timeout"));
- finalize();
- }, request.timeout);
- });
- }
- req.on("error", function(err) {
- reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, "system", err));
- finalize();
- });
- req.on("response", function(res) {
- clearTimeout(reqTimeout);
- const headers = createHeadersLenient(res.headers);
- if (fetch.isRedirect(res.statusCode)) {
- const location2 = headers.get("Location");
- const locationURL = location2 === null ? null : resolve_url(request.url, location2);
- switch (request.redirect) {
- case "error":
- reject(new FetchError(`redirect mode is set to error: ${request.url}`, "no-redirect"));
- finalize();
- return;
- case "manual":
- if (locationURL !== null) {
- try {
- headers.set("Location", locationURL);
- } catch (err) {
- reject(err);
- }
- }
- break;
- case "follow":
- if (locationURL === null) {
- break;
- }
- if (request.counter >= request.follow) {
- reject(new FetchError(`maximum redirect reached at: ${request.url}`, "max-redirect"));
- finalize();
- return;
- }
- const requestOpts = {
- headers: new Headers(request.headers),
- follow: request.follow,
- counter: request.counter + 1,
- agent: request.agent,
- compress: request.compress,
- method: request.method,
- body: request.body,
- signal: request.signal
- };
- if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) {
- reject(new FetchError("Cannot follow redirect with body being a readable stream", "unsupported-redirect"));
- finalize();
- return;
- }
- if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === "POST") {
- requestOpts.method = "GET";
- requestOpts.body = void 0;
- requestOpts.headers.delete("content-length");
- }
- resolve(fetch(new Request(locationURL, requestOpts)));
- finalize();
- return;
- }
- }
- res.once("end", function() {
- if (signal) signal.removeEventListener("abort", abortAndFinalize);
- });
- let body = res.pipe(new PassThrough$1());
- const response_options = {
- url: request.url,
- status: res.statusCode,
- statusText: res.statusMessage,
- headers,
- size: request.size,
- timeout: request.timeout
- };
- const codings = headers.get("Content-Encoding");
- if (!request.compress || request.method === "HEAD" || codings === null || res.statusCode === 204 || res.statusCode === 304) {
- response = new Response(body, response_options);
- resolve(response);
- return;
- }
- const zlibOptions = {
- flush: zlib.Z_SYNC_FLUSH,
- finishFlush: zlib.Z_SYNC_FLUSH
- };
- if (codings == "gzip" || codings == "x-gzip") {
- body = body.pipe(zlib.createGunzip(zlibOptions));
- response = new Response(body, response_options);
- resolve(response);
- return;
- }
- if (codings == "deflate" || codings == "x-deflate") {
- const raw = res.pipe(new PassThrough$1());
- raw.once("data", function(chunk) {
- if ((chunk[0] & 15) === 8) {
- body = body.pipe(zlib.createInflate());
- } else {
- body = body.pipe(zlib.createInflateRaw());
- }
- response = new Response(body, response_options);
- resolve(response);
- });
- return;
- }
- response = new Response(body, response_options);
- resolve(response);
- });
- writeToStream(req, request);
- });
- }
- fetch.isRedirect = function(code) {
- return code === 301 || code === 302 || code === 303 || code === 307 || code === 308;
- };
- fetch.Promise = global.Promise;
- module2.exports = exports2 = fetch;
- Object.defineProperty(exports2, "__esModule", { value: true });
- exports2.default = exports2;
- exports2.Headers = Headers;
- exports2.Request = Request;
- exports2.Response = Response;
- exports2.FetchError = FetchError;
- }
-});
-
-// ../../node_modules/oas-resolver-browser/node_modules/yaml/dist/PlainValue-ec8e588e.js
-var require_PlainValue_ec8e588e = __commonJS({
- "../../node_modules/oas-resolver-browser/node_modules/yaml/dist/PlainValue-ec8e588e.js"(exports2) {
- "use strict";
- var Char = {
- ANCHOR: "&",
- COMMENT: "#",
- TAG: "!",
- DIRECTIVES_END: "-",
- DOCUMENT_END: "."
- };
- var Type = {
- ALIAS: "ALIAS",
- BLANK_LINE: "BLANK_LINE",
- BLOCK_FOLDED: "BLOCK_FOLDED",
- BLOCK_LITERAL: "BLOCK_LITERAL",
- COMMENT: "COMMENT",
- DIRECTIVE: "DIRECTIVE",
- DOCUMENT: "DOCUMENT",
- FLOW_MAP: "FLOW_MAP",
- FLOW_SEQ: "FLOW_SEQ",
- MAP: "MAP",
- MAP_KEY: "MAP_KEY",
- MAP_VALUE: "MAP_VALUE",
- PLAIN: "PLAIN",
- QUOTE_DOUBLE: "QUOTE_DOUBLE",
- QUOTE_SINGLE: "QUOTE_SINGLE",
- SEQ: "SEQ",
- SEQ_ITEM: "SEQ_ITEM"
- };
- var defaultTagPrefix = "tag:yaml.org,2002:";
- var defaultTags = {
- MAP: "tag:yaml.org,2002:map",
- SEQ: "tag:yaml.org,2002:seq",
- STR: "tag:yaml.org,2002:str"
- };
- function findLineStarts(src) {
- const ls = [0];
- let offset = src.indexOf("\n");
- while (offset !== -1) {
- offset += 1;
- ls.push(offset);
- offset = src.indexOf("\n", offset);
- }
- return ls;
- }
- function getSrcInfo(cst) {
- let lineStarts, src;
- if (typeof cst === "string") {
- lineStarts = findLineStarts(cst);
- src = cst;
- } else {
- if (Array.isArray(cst)) cst = cst[0];
- if (cst && cst.context) {
- if (!cst.lineStarts) cst.lineStarts = findLineStarts(cst.context.src);
- lineStarts = cst.lineStarts;
- src = cst.context.src;
- }
- }
- return {
- lineStarts,
- src
- };
- }
- function getLinePos(offset, cst) {
- if (typeof offset !== "number" || offset < 0) return null;
- const {
- lineStarts,
- src
- } = getSrcInfo(cst);
- if (!lineStarts || !src || offset > src.length) return null;
- for (let i = 0; i < lineStarts.length; ++i) {
- const start = lineStarts[i];
- if (offset < start) {
- return {
- line: i,
- col: offset - lineStarts[i - 1] + 1
- };
- }
- if (offset === start) return {
- line: i + 1,
- col: 1
- };
- }
- const line = lineStarts.length;
- return {
- line,
- col: offset - lineStarts[line - 1] + 1
- };
- }
- function getLine(line, cst) {
- const {
- lineStarts,
- src
- } = getSrcInfo(cst);
- if (!lineStarts || !(line >= 1) || line > lineStarts.length) return null;
- const start = lineStarts[line - 1];
- let end = lineStarts[line];
- while (end && end > start && src[end - 1] === "\n") --end;
- return src.slice(start, end);
- }
- function getPrettyContext({
- start,
- end
- }, cst, maxWidth = 80) {
- let src = getLine(start.line, cst);
- if (!src) return null;
- let {
- col
- } = start;
- if (src.length > maxWidth) {
- if (col <= maxWidth - 10) {
- src = src.substr(0, maxWidth - 1) + "\u2026";
- } else {
- const halfWidth = Math.round(maxWidth / 2);
- if (src.length > col + halfWidth) src = src.substr(0, col + halfWidth - 1) + "\u2026";
- col -= src.length - maxWidth;
- src = "\u2026" + src.substr(1 - maxWidth);
- }
- }
- let errLen = 1;
- let errEnd = "";
- if (end) {
- if (end.line === start.line && col + (end.col - start.col) <= maxWidth + 1) {
- errLen = end.col - start.col;
- } else {
- errLen = Math.min(src.length + 1, maxWidth) - col;
- errEnd = "\u2026";
- }
- }
- const offset = col > 1 ? " ".repeat(col - 1) : "";
- const err = "^".repeat(errLen);
- return `${src}
-${offset}${err}${errEnd}`;
- }
- var Range = class _Range {
- static copy(orig) {
- return new _Range(orig.start, orig.end);
- }
- constructor(start, end) {
- this.start = start;
- this.end = end || start;
- }
- isEmpty() {
- return typeof this.start !== "number" || !this.end || this.end <= this.start;
- }
- /**
- * Set `origStart` and `origEnd` to point to the original source range for
- * this node, which may differ due to dropped CR characters.
- *
- * @param {number[]} cr - Positions of dropped CR characters
- * @param {number} offset - Starting index of `cr` from the last call
- * @returns {number} - The next offset, matching the one found for `origStart`
- */
- setOrigRange(cr, offset) {
- const {
- start,
- end
- } = this;
- if (cr.length === 0 || end <= cr[0]) {
- this.origStart = start;
- this.origEnd = end;
- return offset;
- }
- let i = offset;
- while (i < cr.length) {
- if (cr[i] > start) break;
- else ++i;
- }
- this.origStart = start + i;
- const nextOffset = i;
- while (i < cr.length) {
- if (cr[i] >= end) break;
- else ++i;
- }
- this.origEnd = end + i;
- return nextOffset;
- }
- };
- var Node = class _Node {
- static addStringTerminator(src, offset, str) {
- if (str[str.length - 1] === "\n") return str;
- const next = _Node.endOfWhiteSpace(src, offset);
- return next >= src.length || src[next] === "\n" ? str + "\n" : str;
- }
- // ^(---|...)
- static atDocumentBoundary(src, offset, sep) {
- const ch0 = src[offset];
- if (!ch0) return true;
- const prev = src[offset - 1];
- if (prev && prev !== "\n") return false;
- if (sep) {
- if (ch0 !== sep) return false;
- } else {
- if (ch0 !== Char.DIRECTIVES_END && ch0 !== Char.DOCUMENT_END) return false;
- }
- const ch1 = src[offset + 1];
- const ch2 = src[offset + 2];
- if (ch1 !== ch0 || ch2 !== ch0) return false;
- const ch3 = src[offset + 3];
- return !ch3 || ch3 === "\n" || ch3 === " " || ch3 === " ";
- }
- static endOfIdentifier(src, offset) {
- let ch = src[offset];
- const isVerbatim = ch === "<";
- const notOk = isVerbatim ? ["\n", " ", " ", ">"] : ["\n", " ", " ", "[", "]", "{", "}", ","];
- while (ch && notOk.indexOf(ch) === -1) ch = src[offset += 1];
- if (isVerbatim && ch === ">") offset += 1;
- return offset;
- }
- static endOfIndent(src, offset) {
- let ch = src[offset];
- while (ch === " ") ch = src[offset += 1];
- return offset;
- }
- static endOfLine(src, offset) {
- let ch = src[offset];
- while (ch && ch !== "\n") ch = src[offset += 1];
- return offset;
- }
- static endOfWhiteSpace(src, offset) {
- let ch = src[offset];
- while (ch === " " || ch === " ") ch = src[offset += 1];
- return offset;
- }
- static startOfLine(src, offset) {
- let ch = src[offset - 1];
- if (ch === "\n") return offset;
- while (ch && ch !== "\n") ch = src[offset -= 1];
- return offset + 1;
- }
- /**
- * End of indentation, or null if the line's indent level is not more
- * than `indent`
- *
- * @param {string} src
- * @param {number} indent
- * @param {number} lineStart
- * @returns {?number}
- */
- static endOfBlockIndent(src, indent, lineStart) {
- const inEnd = _Node.endOfIndent(src, lineStart);
- if (inEnd > lineStart + indent) {
- return inEnd;
- } else {
- const wsEnd = _Node.endOfWhiteSpace(src, inEnd);
- const ch = src[wsEnd];
- if (!ch || ch === "\n") return wsEnd;
- }
- return null;
- }
- static atBlank(src, offset, endAsBlank) {
- const ch = src[offset];
- return ch === "\n" || ch === " " || ch === " " || endAsBlank && !ch;
- }
- static nextNodeIsIndented(ch, indentDiff, indicatorAsIndent) {
- if (!ch || indentDiff < 0) return false;
- if (indentDiff > 0) return true;
- return indicatorAsIndent && ch === "-";
- }
- // should be at line or string end, or at next non-whitespace char
- static normalizeOffset(src, offset) {
- const ch = src[offset];
- return !ch ? offset : ch !== "\n" && src[offset - 1] === "\n" ? offset - 1 : _Node.endOfWhiteSpace(src, offset);
- }
- // fold single newline into space, multiple newlines to N - 1 newlines
- // presumes src[offset] === '\n'
- static foldNewline(src, offset, indent) {
- let inCount = 0;
- let error = false;
- let fold = "";
- let ch = src[offset + 1];
- while (ch === " " || ch === " " || ch === "\n") {
- switch (ch) {
- case "\n":
- inCount = 0;
- offset += 1;
- fold += "\n";
- break;
- case " ":
- if (inCount <= indent) error = true;
- offset = _Node.endOfWhiteSpace(src, offset + 2) - 1;
- break;
- case " ":
- inCount += 1;
- offset += 1;
- break;
- }
- ch = src[offset + 1];
- }
- if (!fold) fold = " ";
- if (ch && inCount <= indent) error = true;
- return {
- fold,
- offset,
- error
- };
- }
- constructor(type, props, context) {
- Object.defineProperty(this, "context", {
- value: context || null,
- writable: true
- });
- this.error = null;
- this.range = null;
- this.valueRange = null;
- this.props = props || [];
- this.type = type;
- this.value = null;
- }
- getPropValue(idx, key, skipKey) {
- if (!this.context) return null;
- const {
- src
- } = this.context;
- const prop = this.props[idx];
- return prop && src[prop.start] === key ? src.slice(prop.start + (skipKey ? 1 : 0), prop.end) : null;
- }
- get anchor() {
- for (let i = 0; i < this.props.length; ++i) {
- const anchor = this.getPropValue(i, Char.ANCHOR, true);
- if (anchor != null) return anchor;
- }
- return null;
- }
- get comment() {
- const comments = [];
- for (let i = 0; i < this.props.length; ++i) {
- const comment = this.getPropValue(i, Char.COMMENT, true);
- if (comment != null) comments.push(comment);
- }
- return comments.length > 0 ? comments.join("\n") : null;
- }
- commentHasRequiredWhitespace(start) {
- const {
- src
- } = this.context;
- if (this.header && start === this.header.end) return false;
- if (!this.valueRange) return false;
- const {
- end
- } = this.valueRange;
- return start !== end || _Node.atBlank(src, end - 1);
- }
- get hasComment() {
- if (this.context) {
- const {
- src
- } = this.context;
- for (let i = 0; i < this.props.length; ++i) {
- if (src[this.props[i].start] === Char.COMMENT) return true;
- }
- }
- return false;
- }
- get hasProps() {
- if (this.context) {
- const {
- src
- } = this.context;
- for (let i = 0; i < this.props.length; ++i) {
- if (src[this.props[i].start] !== Char.COMMENT) return true;
- }
- }
- return false;
- }
- get includesTrailingLines() {
- return false;
- }
- get jsonLike() {
- const jsonLikeTypes = [Type.FLOW_MAP, Type.FLOW_SEQ, Type.QUOTE_DOUBLE, Type.QUOTE_SINGLE];
- return jsonLikeTypes.indexOf(this.type) !== -1;
- }
- get rangeAsLinePos() {
- if (!this.range || !this.context) return void 0;
- const start = getLinePos(this.range.start, this.context.root);
- if (!start) return void 0;
- const end = getLinePos(this.range.end, this.context.root);
- return {
- start,
- end
- };
- }
- get rawValue() {
- if (!this.valueRange || !this.context) return null;
- const {
- start,
- end
- } = this.valueRange;
- return this.context.src.slice(start, end);
- }
- get tag() {
- for (let i = 0; i < this.props.length; ++i) {
- const tag = this.getPropValue(i, Char.TAG, false);
- if (tag != null) {
- if (tag[1] === "<") {
- return {
- verbatim: tag.slice(2, -1)
- };
- } else {
- const [_2, handle, suffix] = tag.match(/^(.*!)([^!]*)$/);
- return {
- handle,
- suffix
- };
- }
- }
- }
- return null;
- }
- get valueRangeContainsNewline() {
- if (!this.valueRange || !this.context) return false;
- const {
- start,
- end
- } = this.valueRange;
- const {
- src
- } = this.context;
- for (let i = start; i < end; ++i) {
- if (src[i] === "\n") return true;
- }
- return false;
- }
- parseComment(start) {
- const {
- src
- } = this.context;
- if (src[start] === Char.COMMENT) {
- const end = _Node.endOfLine(src, start + 1);
- const commentRange = new Range(start, end);
- this.props.push(commentRange);
- return end;
- }
- return start;
- }
- /**
- * Populates the `origStart` and `origEnd` values of all ranges for this
- * node. Extended by child classes to handle descendant nodes.
- *
- * @param {number[]} cr - Positions of dropped CR characters
- * @param {number} offset - Starting index of `cr` from the last call
- * @returns {number} - The next offset, matching the one found for `origStart`
- */
- setOrigRanges(cr, offset) {
- if (this.range) offset = this.range.setOrigRange(cr, offset);
- if (this.valueRange) this.valueRange.setOrigRange(cr, offset);
- this.props.forEach((prop) => prop.setOrigRange(cr, offset));
- return offset;
- }
- toString() {
- const {
- context: {
- src
- },
- range,
- value
- } = this;
- if (value != null) return value;
- const str = src.slice(range.start, range.end);
- return _Node.addStringTerminator(src, range.end, str);
- }
- };
- var YAMLError = class extends Error {
- constructor(name, source, message) {
- if (!message || !(source instanceof Node)) throw new Error(`Invalid arguments for new ${name}`);
- super();
- this.name = name;
- this.message = message;
- this.source = source;
- }
- makePretty() {
- if (!this.source) return;
- this.nodeType = this.source.type;
- const cst = this.source.context && this.source.context.root;
- if (typeof this.offset === "number") {
- this.range = new Range(this.offset, this.offset + 1);
- const start = cst && getLinePos(this.offset, cst);
- if (start) {
- const end = {
- line: start.line,
- col: start.col + 1
- };
- this.linePos = {
- start,
- end
- };
- }
- delete this.offset;
- } else {
- this.range = this.source.range;
- this.linePos = this.source.rangeAsLinePos;
- }
- if (this.linePos) {
- const {
- line,
- col
- } = this.linePos.start;
- this.message += ` at line ${line}, column ${col}`;
- const ctx = cst && getPrettyContext(this.linePos, cst);
- if (ctx) this.message += `:
-
-${ctx}
-`;
- }
- delete this.source;
- }
- };
- var YAMLReferenceError = class extends YAMLError {
- constructor(source, message) {
- super("YAMLReferenceError", source, message);
- }
- };
- var YAMLSemanticError = class extends YAMLError {
- constructor(source, message) {
- super("YAMLSemanticError", source, message);
- }
- };
- var YAMLSyntaxError = class extends YAMLError {
- constructor(source, message) {
- super("YAMLSyntaxError", source, message);
- }
- };
- var YAMLWarning = class extends YAMLError {
- constructor(source, message) {
- super("YAMLWarning", source, message);
- }
- };
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- var PlainValue = class _PlainValue extends Node {
- static endOfLine(src, start, inFlow) {
- let ch = src[start];
- let offset = start;
- while (ch && ch !== "\n") {
- if (inFlow && (ch === "[" || ch === "]" || ch === "{" || ch === "}" || ch === ",")) break;
- const next = src[offset + 1];
- if (ch === ":" && (!next || next === "\n" || next === " " || next === " " || inFlow && next === ",")) break;
- if ((ch === " " || ch === " ") && next === "#") break;
- offset += 1;
- ch = next;
- }
- return offset;
- }
- get strValue() {
- if (!this.valueRange || !this.context) return null;
- let {
- start,
- end
- } = this.valueRange;
- const {
- src
- } = this.context;
- let ch = src[end - 1];
- while (start < end && (ch === "\n" || ch === " " || ch === " ")) ch = src[--end - 1];
- let str = "";
- for (let i = start; i < end; ++i) {
- const ch2 = src[i];
- if (ch2 === "\n") {
- const {
- fold,
- offset
- } = Node.foldNewline(src, i, -1);
- str += fold;
- i = offset;
- } else if (ch2 === " " || ch2 === " ") {
- const wsStart = i;
- let next = src[i + 1];
- while (i < end && (next === " " || next === " ")) {
- i += 1;
- next = src[i + 1];
- }
- if (next !== "\n") str += i > wsStart ? src.slice(wsStart, i + 1) : ch2;
- } else {
- str += ch2;
- }
- }
- const ch0 = src[start];
- switch (ch0) {
- case " ": {
- const msg = "Plain value cannot start with a tab character";
- const errors = [new YAMLSemanticError(this, msg)];
- return {
- errors,
- str
- };
- }
- case "@":
- case "`": {
- const msg = `Plain value cannot start with reserved character ${ch0}`;
- const errors = [new YAMLSemanticError(this, msg)];
- return {
- errors,
- str
- };
- }
- default:
- return str;
- }
- }
- parseBlockValue(start) {
- const {
- indent,
- inFlow,
- src
- } = this.context;
- let offset = start;
- let valueEnd = start;
- for (let ch = src[offset]; ch === "\n"; ch = src[offset]) {
- if (Node.atDocumentBoundary(src, offset + 1)) break;
- const end = Node.endOfBlockIndent(src, indent, offset + 1);
- if (end === null || src[end] === "#") break;
- if (src[end] === "\n") {
- offset = end;
- } else {
- valueEnd = _PlainValue.endOfLine(src, end, inFlow);
- offset = valueEnd;
- }
- }
- if (this.valueRange.isEmpty()) this.valueRange.start = start;
- this.valueRange.end = valueEnd;
- return valueEnd;
- }
- /**
- * Parses a plain value from the source
- *
- * Accepted forms are:
- * ```
- * #comment
- *
- * first line
- *
- * first line #comment
- *
- * first line
- * block
- * lines
- *
- * #comment
- * block
- * lines
- * ```
- * where block lines are empty or have an indent level greater than `indent`.
- *
- * @param {ParseContext} context
- * @param {number} start - Index of first character
- * @returns {number} - Index of the character after this scalar, may be `\n`
- */
- parse(context, start) {
- this.context = context;
- const {
- inFlow,
- src
- } = context;
- let offset = start;
- const ch = src[offset];
- if (ch && ch !== "#" && ch !== "\n") {
- offset = _PlainValue.endOfLine(src, start, inFlow);
- }
- this.valueRange = new Range(start, offset);
- offset = Node.endOfWhiteSpace(src, offset);
- offset = this.parseComment(offset);
- if (!this.hasComment || this.valueRange.isEmpty()) {
- offset = this.parseBlockValue(offset);
- }
- return offset;
- }
- };
- exports2.Char = Char;
- exports2.Node = Node;
- exports2.PlainValue = PlainValue;
- exports2.Range = Range;
- exports2.Type = Type;
- exports2.YAMLError = YAMLError;
- exports2.YAMLReferenceError = YAMLReferenceError;
- exports2.YAMLSemanticError = YAMLSemanticError;
- exports2.YAMLSyntaxError = YAMLSyntaxError;
- exports2.YAMLWarning = YAMLWarning;
- exports2._defineProperty = _defineProperty;
- exports2.defaultTagPrefix = defaultTagPrefix;
- exports2.defaultTags = defaultTags;
- }
-});
-
-// ../../node_modules/oas-resolver-browser/node_modules/yaml/dist/parse-cst.js
-var require_parse_cst = __commonJS({
- "../../node_modules/oas-resolver-browser/node_modules/yaml/dist/parse-cst.js"(exports2) {
- "use strict";
- var PlainValue = require_PlainValue_ec8e588e();
- var BlankLine = class extends PlainValue.Node {
- constructor() {
- super(PlainValue.Type.BLANK_LINE);
- }
- /* istanbul ignore next */
- get includesTrailingLines() {
- return true;
- }
- /**
- * Parses a blank line from the source
- *
- * @param {ParseContext} context
- * @param {number} start - Index of first \n character
- * @returns {number} - Index of the character after this
- */
- parse(context, start) {
- this.context = context;
- this.range = new PlainValue.Range(start, start + 1);
- return start + 1;
- }
- };
- var CollectionItem = class extends PlainValue.Node {
- constructor(type, props) {
- super(type, props);
- this.node = null;
- }
- get includesTrailingLines() {
- return !!this.node && this.node.includesTrailingLines;
- }
- /**
- * @param {ParseContext} context
- * @param {number} start - Index of first character
- * @returns {number} - Index of the character after this
- */
- parse(context, start) {
- this.context = context;
- const {
- parseNode,
- src
- } = context;
- let {
- atLineStart,
- lineStart
- } = context;
- if (!atLineStart && this.type === PlainValue.Type.SEQ_ITEM) this.error = new PlainValue.YAMLSemanticError(this, "Sequence items must not have preceding content on the same line");
- const indent = atLineStart ? start - lineStart : context.indent;
- let offset = PlainValue.Node.endOfWhiteSpace(src, start + 1);
- let ch = src[offset];
- const inlineComment = ch === "#";
- const comments = [];
- let blankLine = null;
- while (ch === "\n" || ch === "#") {
- if (ch === "#") {
- const end2 = PlainValue.Node.endOfLine(src, offset + 1);
- comments.push(new PlainValue.Range(offset, end2));
- offset = end2;
- } else {
- atLineStart = true;
- lineStart = offset + 1;
- const wsEnd = PlainValue.Node.endOfWhiteSpace(src, lineStart);
- if (src[wsEnd] === "\n" && comments.length === 0) {
- blankLine = new BlankLine();
- lineStart = blankLine.parse({
- src
- }, lineStart);
- }
- offset = PlainValue.Node.endOfIndent(src, lineStart);
- }
- ch = src[offset];
- }
- if (PlainValue.Node.nextNodeIsIndented(ch, offset - (lineStart + indent), this.type !== PlainValue.Type.SEQ_ITEM)) {
- this.node = parseNode({
- atLineStart,
- inCollection: false,
- indent,
- lineStart,
- parent: this
- }, offset);
- } else if (ch && lineStart > start + 1) {
- offset = lineStart - 1;
- }
- if (this.node) {
- if (blankLine) {
- const items = context.parent.items || context.parent.contents;
- if (items) items.push(blankLine);
- }
- if (comments.length) Array.prototype.push.apply(this.props, comments);
- offset = this.node.range.end;
- } else {
- if (inlineComment) {
- const c = comments[0];
- this.props.push(c);
- offset = c.end;
- } else {
- offset = PlainValue.Node.endOfLine(src, start + 1);
- }
- }
- const end = this.node ? this.node.valueRange.end : offset;
- this.valueRange = new PlainValue.Range(start, end);
- return offset;
- }
- setOrigRanges(cr, offset) {
- offset = super.setOrigRanges(cr, offset);
- return this.node ? this.node.setOrigRanges(cr, offset) : offset;
- }
- toString() {
- const {
- context: {
- src
- },
- node,
- range,
- value
- } = this;
- if (value != null) return value;
- const str = node ? src.slice(range.start, node.range.start) + String(node) : src.slice(range.start, range.end);
- return PlainValue.Node.addStringTerminator(src, range.end, str);
- }
- };
- var Comment = class extends PlainValue.Node {
- constructor() {
- super(PlainValue.Type.COMMENT);
- }
- /**
- * Parses a comment line from the source
- *
- * @param {ParseContext} context
- * @param {number} start - Index of first character
- * @returns {number} - Index of the character after this scalar
- */
- parse(context, start) {
- this.context = context;
- const offset = this.parseComment(start);
- this.range = new PlainValue.Range(start, offset);
- return offset;
- }
- };
- function grabCollectionEndComments(node) {
- let cnode = node;
- while (cnode instanceof CollectionItem) cnode = cnode.node;
- if (!(cnode instanceof Collection)) return null;
- const len = cnode.items.length;
- let ci = -1;
- for (let i = len - 1; i >= 0; --i) {
- const n = cnode.items[i];
- if (n.type === PlainValue.Type.COMMENT) {
- const {
- indent,
- lineStart
- } = n.context;
- if (indent > 0 && n.range.start >= lineStart + indent) break;
- ci = i;
- } else if (n.type === PlainValue.Type.BLANK_LINE) ci = i;
- else break;
- }
- if (ci === -1) return null;
- const ca = cnode.items.splice(ci, len - ci);
- const prevEnd = ca[0].range.start;
- while (true) {
- cnode.range.end = prevEnd;
- if (cnode.valueRange && cnode.valueRange.end > prevEnd) cnode.valueRange.end = prevEnd;
- if (cnode === node) break;
- cnode = cnode.context.parent;
- }
- return ca;
- }
- var Collection = class _Collection extends PlainValue.Node {
- static nextContentHasIndent(src, offset, indent) {
- const lineStart = PlainValue.Node.endOfLine(src, offset) + 1;
- offset = PlainValue.Node.endOfWhiteSpace(src, lineStart);
- const ch = src[offset];
- if (!ch) return false;
- if (offset >= lineStart + indent) return true;
- if (ch !== "#" && ch !== "\n") return false;
- return _Collection.nextContentHasIndent(src, offset, indent);
- }
- constructor(firstItem) {
- super(firstItem.type === PlainValue.Type.SEQ_ITEM ? PlainValue.Type.SEQ : PlainValue.Type.MAP);
- for (let i = firstItem.props.length - 1; i >= 0; --i) {
- if (firstItem.props[i].start < firstItem.context.lineStart) {
- this.props = firstItem.props.slice(0, i + 1);
- firstItem.props = firstItem.props.slice(i + 1);
- const itemRange = firstItem.props[0] || firstItem.valueRange;
- firstItem.range.start = itemRange.start;
- break;
- }
- }
- this.items = [firstItem];
- const ec = grabCollectionEndComments(firstItem);
- if (ec) Array.prototype.push.apply(this.items, ec);
- }
- get includesTrailingLines() {
- return this.items.length > 0;
- }
- /**
- * @param {ParseContext} context
- * @param {number} start - Index of first character
- * @returns {number} - Index of the character after this
- */
- parse(context, start) {
- this.context = context;
- const {
- parseNode,
- src
- } = context;
- let lineStart = PlainValue.Node.startOfLine(src, start);
- const firstItem = this.items[0];
- firstItem.context.parent = this;
- this.valueRange = PlainValue.Range.copy(firstItem.valueRange);
- const indent = firstItem.range.start - firstItem.context.lineStart;
- let offset = start;
- offset = PlainValue.Node.normalizeOffset(src, offset);
- let ch = src[offset];
- let atLineStart = PlainValue.Node.endOfWhiteSpace(src, lineStart) === offset;
- let prevIncludesTrailingLines = false;
- while (ch) {
- while (ch === "\n" || ch === "#") {
- if (atLineStart && ch === "\n" && !prevIncludesTrailingLines) {
- const blankLine = new BlankLine();
- offset = blankLine.parse({
- src
- }, offset);
- this.valueRange.end = offset;
- if (offset >= src.length) {
- ch = null;
- break;
- }
- this.items.push(blankLine);
- offset -= 1;
- } else if (ch === "#") {
- if (offset < lineStart + indent && !_Collection.nextContentHasIndent(src, offset, indent)) {
- return offset;
- }
- const comment = new Comment();
- offset = comment.parse({
- indent,
- lineStart,
- src
- }, offset);
- this.items.push(comment);
- this.valueRange.end = offset;
- if (offset >= src.length) {
- ch = null;
- break;
- }
- }
- lineStart = offset + 1;
- offset = PlainValue.Node.endOfIndent(src, lineStart);
- if (PlainValue.Node.atBlank(src, offset)) {
- const wsEnd = PlainValue.Node.endOfWhiteSpace(src, offset);
- const next = src[wsEnd];
- if (!next || next === "\n" || next === "#") {
- offset = wsEnd;
- }
- }
- ch = src[offset];
- atLineStart = true;
- }
- if (!ch) {
- break;
- }
- if (offset !== lineStart + indent && (atLineStart || ch !== ":")) {
- if (offset < lineStart + indent) {
- if (lineStart > start) offset = lineStart;
- break;
- } else if (!this.error) {
- const msg = "All collection items must start at the same column";
- this.error = new PlainValue.YAMLSyntaxError(this, msg);
- }
- }
- if (firstItem.type === PlainValue.Type.SEQ_ITEM) {
- if (ch !== "-") {
- if (lineStart > start) offset = lineStart;
- break;
- }
- } else if (ch === "-" && !this.error) {
- const next = src[offset + 1];
- if (!next || next === "\n" || next === " " || next === " ") {
- const msg = "A collection cannot be both a mapping and a sequence";
- this.error = new PlainValue.YAMLSyntaxError(this, msg);
- }
- }
- const node = parseNode({
- atLineStart,
- inCollection: true,
- indent,
- lineStart,
- parent: this
- }, offset);
- if (!node) return offset;
- this.items.push(node);
- this.valueRange.end = node.valueRange.end;
- offset = PlainValue.Node.normalizeOffset(src, node.range.end);
- ch = src[offset];
- atLineStart = false;
- prevIncludesTrailingLines = node.includesTrailingLines;
- if (ch) {
- let ls = offset - 1;
- let prev = src[ls];
- while (prev === " " || prev === " ") prev = src[--ls];
- if (prev === "\n") {
- lineStart = ls + 1;
- atLineStart = true;
- }
- }
- const ec = grabCollectionEndComments(node);
- if (ec) Array.prototype.push.apply(this.items, ec);
- }
- return offset;
- }
- setOrigRanges(cr, offset) {
- offset = super.setOrigRanges(cr, offset);
- this.items.forEach((node) => {
- offset = node.setOrigRanges(cr, offset);
- });
- return offset;
- }
- toString() {
- const {
- context: {
- src
- },
- items,
- range,
- value
- } = this;
- if (value != null) return value;
- let str = src.slice(range.start, items[0].range.start) + String(items[0]);
- for (let i = 1; i < items.length; ++i) {
- const item = items[i];
- const {
- atLineStart,
- indent
- } = item.context;
- if (atLineStart) for (let i2 = 0; i2 < indent; ++i2) str += " ";
- str += String(item);
- }
- return PlainValue.Node.addStringTerminator(src, range.end, str);
- }
- };
- var Directive = class extends PlainValue.Node {
- constructor() {
- super(PlainValue.Type.DIRECTIVE);
- this.name = null;
- }
- get parameters() {
- const raw = this.rawValue;
- return raw ? raw.trim().split(/[ \t]+/) : [];
- }
- parseName(start) {
- const {
- src
- } = this.context;
- let offset = start;
- let ch = src[offset];
- while (ch && ch !== "\n" && ch !== " " && ch !== " ") ch = src[offset += 1];
- this.name = src.slice(start, offset);
- return offset;
- }
- parseParameters(start) {
- const {
- src
- } = this.context;
- let offset = start;
- let ch = src[offset];
- while (ch && ch !== "\n" && ch !== "#") ch = src[offset += 1];
- this.valueRange = new PlainValue.Range(start, offset);
- return offset;
- }
- parse(context, start) {
- this.context = context;
- let offset = this.parseName(start + 1);
- offset = this.parseParameters(offset);
- offset = this.parseComment(offset);
- this.range = new PlainValue.Range(start, offset);
- return offset;
- }
- };
- var Document = class _Document extends PlainValue.Node {
- static startCommentOrEndBlankLine(src, start) {
- const offset = PlainValue.Node.endOfWhiteSpace(src, start);
- const ch = src[offset];
- return ch === "#" || ch === "\n" ? offset : start;
- }
- constructor() {
- super(PlainValue.Type.DOCUMENT);
- this.directives = null;
- this.contents = null;
- this.directivesEndMarker = null;
- this.documentEndMarker = null;
- }
- parseDirectives(start) {
- const {
- src
- } = this.context;
- this.directives = [];
- let atLineStart = true;
- let hasDirectives = false;
- let offset = start;
- while (!PlainValue.Node.atDocumentBoundary(src, offset, PlainValue.Char.DIRECTIVES_END)) {
- offset = _Document.startCommentOrEndBlankLine(src, offset);
- switch (src[offset]) {
- case "\n":
- if (atLineStart) {
- const blankLine = new BlankLine();
- offset = blankLine.parse({
- src
- }, offset);
- if (offset < src.length) {
- this.directives.push(blankLine);
- }
- } else {
- offset += 1;
- atLineStart = true;
- }
- break;
- case "#":
- {
- const comment = new Comment();
- offset = comment.parse({
- src
- }, offset);
- this.directives.push(comment);
- atLineStart = false;
- }
- break;
- case "%":
- {
- const directive = new Directive();
- offset = directive.parse({
- parent: this,
- src
- }, offset);
- this.directives.push(directive);
- hasDirectives = true;
- atLineStart = false;
- }
- break;
- default:
- if (hasDirectives) {
- this.error = new PlainValue.YAMLSemanticError(this, "Missing directives-end indicator line");
- } else if (this.directives.length > 0) {
- this.contents = this.directives;
- this.directives = [];
- }
- return offset;
- }
- }
- if (src[offset]) {
- this.directivesEndMarker = new PlainValue.Range(offset, offset + 3);
- return offset + 3;
- }
- if (hasDirectives) {
- this.error = new PlainValue.YAMLSemanticError(this, "Missing directives-end indicator line");
- } else if (this.directives.length > 0) {
- this.contents = this.directives;
- this.directives = [];
- }
- return offset;
- }
- parseContents(start) {
- const {
- parseNode,
- src
- } = this.context;
- if (!this.contents) this.contents = [];
- let lineStart = start;
- while (src[lineStart - 1] === "-") lineStart -= 1;
- let offset = PlainValue.Node.endOfWhiteSpace(src, start);
- let atLineStart = lineStart === start;
- this.valueRange = new PlainValue.Range(offset);
- while (!PlainValue.Node.atDocumentBoundary(src, offset, PlainValue.Char.DOCUMENT_END)) {
- switch (src[offset]) {
- case "\n":
- if (atLineStart) {
- const blankLine = new BlankLine();
- offset = blankLine.parse({
- src
- }, offset);
- if (offset < src.length) {
- this.contents.push(blankLine);
- }
- } else {
- offset += 1;
- atLineStart = true;
- }
- lineStart = offset;
- break;
- case "#":
- {
- const comment = new Comment();
- offset = comment.parse({
- src
- }, offset);
- this.contents.push(comment);
- atLineStart = false;
- }
- break;
- default: {
- const iEnd = PlainValue.Node.endOfIndent(src, offset);
- const context = {
- atLineStart,
- indent: -1,
- inFlow: false,
- inCollection: false,
- lineStart,
- parent: this
- };
- const node = parseNode(context, iEnd);
- if (!node) return this.valueRange.end = iEnd;
- this.contents.push(node);
- offset = node.range.end;
- atLineStart = false;
- const ec = grabCollectionEndComments(node);
- if (ec) Array.prototype.push.apply(this.contents, ec);
- }
- }
- offset = _Document.startCommentOrEndBlankLine(src, offset);
- }
- this.valueRange.end = offset;
- if (src[offset]) {
- this.documentEndMarker = new PlainValue.Range(offset, offset + 3);
- offset += 3;
- if (src[offset]) {
- offset = PlainValue.Node.endOfWhiteSpace(src, offset);
- if (src[offset] === "#") {
- const comment = new Comment();
- offset = comment.parse({
- src
- }, offset);
- this.contents.push(comment);
- }
- switch (src[offset]) {
- case "\n":
- offset += 1;
- break;
- case void 0:
- break;
- default:
- this.error = new PlainValue.YAMLSyntaxError(this, "Document end marker line cannot have a non-comment suffix");
- }
- }
- }
- return offset;
- }
- /**
- * @param {ParseContext} context
- * @param {number} start - Index of first character
- * @returns {number} - Index of the character after this
- */
- parse(context, start) {
- context.root = this;
- this.context = context;
- const {
- src
- } = context;
- let offset = src.charCodeAt(start) === 65279 ? start + 1 : start;
- offset = this.parseDirectives(offset);
- offset = this.parseContents(offset);
- return offset;
- }
- setOrigRanges(cr, offset) {
- offset = super.setOrigRanges(cr, offset);
- this.directives.forEach((node) => {
- offset = node.setOrigRanges(cr, offset);
- });
- if (this.directivesEndMarker) offset = this.directivesEndMarker.setOrigRange(cr, offset);
- this.contents.forEach((node) => {
- offset = node.setOrigRanges(cr, offset);
- });
- if (this.documentEndMarker) offset = this.documentEndMarker.setOrigRange(cr, offset);
- return offset;
- }
- toString() {
- const {
- contents,
- directives,
- value
- } = this;
- if (value != null) return value;
- let str = directives.join("");
- if (contents.length > 0) {
- if (directives.length > 0 || contents[0].type === PlainValue.Type.COMMENT) str += "---\n";
- str += contents.join("");
- }
- if (str[str.length - 1] !== "\n") str += "\n";
- return str;
- }
- };
- var Alias = class extends PlainValue.Node {
- /**
- * Parses an *alias from the source
- *
- * @param {ParseContext} context
- * @param {number} start - Index of first character
- * @returns {number} - Index of the character after this scalar
- */
- parse(context, start) {
- this.context = context;
- const {
- src
- } = context;
- let offset = PlainValue.Node.endOfIdentifier(src, start + 1);
- this.valueRange = new PlainValue.Range(start + 1, offset);
- offset = PlainValue.Node.endOfWhiteSpace(src, offset);
- offset = this.parseComment(offset);
- return offset;
- }
- };
- var Chomp = {
- CLIP: "CLIP",
- KEEP: "KEEP",
- STRIP: "STRIP"
- };
- var BlockValue = class extends PlainValue.Node {
- constructor(type, props) {
- super(type, props);
- this.blockIndent = null;
- this.chomping = Chomp.CLIP;
- this.header = null;
- }
- get includesTrailingLines() {
- return this.chomping === Chomp.KEEP;
- }
- get strValue() {
- if (!this.valueRange || !this.context) return null;
- let {
- start,
- end
- } = this.valueRange;
- const {
- indent,
- src
- } = this.context;
- if (this.valueRange.isEmpty()) return "";
- let lastNewLine = null;
- let ch = src[end - 1];
- while (ch === "\n" || ch === " " || ch === " ") {
- end -= 1;
- if (end <= start) {
- if (this.chomping === Chomp.KEEP) break;
- else return "";
- }
- if (ch === "\n") lastNewLine = end;
- ch = src[end - 1];
- }
- let keepStart = end + 1;
- if (lastNewLine) {
- if (this.chomping === Chomp.KEEP) {
- keepStart = lastNewLine;
- end = this.valueRange.end;
- } else {
- end = lastNewLine;
- }
- }
- const bi = indent + this.blockIndent;
- const folded = this.type === PlainValue.Type.BLOCK_FOLDED;
- let atStart = true;
- let str = "";
- let sep = "";
- let prevMoreIndented = false;
- for (let i = start; i < end; ++i) {
- for (let j = 0; j < bi; ++j) {
- if (src[i] !== " ") break;
- i += 1;
- }
- const ch2 = src[i];
- if (ch2 === "\n") {
- if (sep === "\n") str += "\n";
- else sep = "\n";
- } else {
- const lineEnd = PlainValue.Node.endOfLine(src, i);
- const line = src.slice(i, lineEnd);
- i = lineEnd;
- if (folded && (ch2 === " " || ch2 === " ") && i < keepStart) {
- if (sep === " ") sep = "\n";
- else if (!prevMoreIndented && !atStart && sep === "\n") sep = "\n\n";
- str += sep + line;
- sep = lineEnd < end && src[lineEnd] || "";
- prevMoreIndented = true;
- } else {
- str += sep + line;
- sep = folded && i < keepStart ? " " : "\n";
- prevMoreIndented = false;
- }
- if (atStart && line !== "") atStart = false;
- }
- }
- return this.chomping === Chomp.STRIP ? str : str + "\n";
- }
- parseBlockHeader(start) {
- const {
- src
- } = this.context;
- let offset = start + 1;
- let bi = "";
- while (true) {
- const ch = src[offset];
- switch (ch) {
- case "-":
- this.chomping = Chomp.STRIP;
- break;
- case "+":
- this.chomping = Chomp.KEEP;
- break;
- case "0":
- case "1":
- case "2":
- case "3":
- case "4":
- case "5":
- case "6":
- case "7":
- case "8":
- case "9":
- bi += ch;
- break;
- default:
- this.blockIndent = Number(bi) || null;
- this.header = new PlainValue.Range(start, offset);
- return offset;
- }
- offset += 1;
- }
- }
- parseBlockValue(start) {
- const {
- indent,
- src
- } = this.context;
- const explicit = !!this.blockIndent;
- let offset = start;
- let valueEnd = start;
- let minBlockIndent = 1;
- for (let ch = src[offset]; ch === "\n"; ch = src[offset]) {
- offset += 1;
- if (PlainValue.Node.atDocumentBoundary(src, offset)) break;
- const end = PlainValue.Node.endOfBlockIndent(src, indent, offset);
- if (end === null) break;
- const ch2 = src[end];
- const lineIndent = end - (offset + indent);
- if (!this.blockIndent) {
- if (src[end] !== "\n") {
- if (lineIndent < minBlockIndent) {
- const msg = "Block scalars with more-indented leading empty lines must use an explicit indentation indicator";
- this.error = new PlainValue.YAMLSemanticError(this, msg);
- }
- this.blockIndent = lineIndent;
- } else if (lineIndent > minBlockIndent) {
- minBlockIndent = lineIndent;
- }
- } else if (ch2 && ch2 !== "\n" && lineIndent < this.blockIndent) {
- if (src[end] === "#") break;
- if (!this.error) {
- const src2 = explicit ? "explicit indentation indicator" : "first line";
- const msg = `Block scalars must not be less indented than their ${src2}`;
- this.error = new PlainValue.YAMLSemanticError(this, msg);
- }
- }
- if (src[end] === "\n") {
- offset = end;
- } else {
- offset = valueEnd = PlainValue.Node.endOfLine(src, end);
- }
- }
- if (this.chomping !== Chomp.KEEP) {
- offset = src[valueEnd] ? valueEnd + 1 : valueEnd;
- }
- this.valueRange = new PlainValue.Range(start + 1, offset);
- return offset;
- }
- /**
- * Parses a block value from the source
- *
- * Accepted forms are:
- * ```
- * BS
- * block
- * lines
- *
- * BS #comment
- * block
- * lines
- * ```
- * where the block style BS matches the regexp `[|>][-+1-9]*` and block lines
- * are empty or have an indent level greater than `indent`.
- *
- * @param {ParseContext} context
- * @param {number} start - Index of first character
- * @returns {number} - Index of the character after this block
- */
- parse(context, start) {
- this.context = context;
- const {
- src
- } = context;
- let offset = this.parseBlockHeader(start);
- offset = PlainValue.Node.endOfWhiteSpace(src, offset);
- offset = this.parseComment(offset);
- offset = this.parseBlockValue(offset);
- return offset;
- }
- setOrigRanges(cr, offset) {
- offset = super.setOrigRanges(cr, offset);
- return this.header ? this.header.setOrigRange(cr, offset) : offset;
- }
- };
- var FlowCollection = class extends PlainValue.Node {
- constructor(type, props) {
- super(type, props);
- this.items = null;
- }
- prevNodeIsJsonLike(idx = this.items.length) {
- const node = this.items[idx - 1];
- return !!node && (node.jsonLike || node.type === PlainValue.Type.COMMENT && this.prevNodeIsJsonLike(idx - 1));
- }
- /**
- * @param {ParseContext} context
- * @param {number} start - Index of first character
- * @returns {number} - Index of the character after this
- */
- parse(context, start) {
- this.context = context;
- const {
- parseNode,
- src
- } = context;
- let {
- indent,
- lineStart
- } = context;
- let char = src[start];
- this.items = [{
- char,
- offset: start
- }];
- let offset = PlainValue.Node.endOfWhiteSpace(src, start + 1);
- char = src[offset];
- while (char && char !== "]" && char !== "}") {
- switch (char) {
- case "\n":
- {
- lineStart = offset + 1;
- const wsEnd = PlainValue.Node.endOfWhiteSpace(src, lineStart);
- if (src[wsEnd] === "\n") {
- const blankLine = new BlankLine();
- lineStart = blankLine.parse({
- src
- }, lineStart);
- this.items.push(blankLine);
- }
- offset = PlainValue.Node.endOfIndent(src, lineStart);
- if (offset <= lineStart + indent) {
- char = src[offset];
- if (offset < lineStart + indent || char !== "]" && char !== "}") {
- const msg = "Insufficient indentation in flow collection";
- this.error = new PlainValue.YAMLSemanticError(this, msg);
- }
- }
- }
- break;
- case ",":
- {
- this.items.push({
- char,
- offset
- });
- offset += 1;
- }
- break;
- case "#":
- {
- const comment = new Comment();
- offset = comment.parse({
- src
- }, offset);
- this.items.push(comment);
- }
- break;
- case "?":
- case ":": {
- const next = src[offset + 1];
- if (next === "\n" || next === " " || next === " " || next === "," || // in-flow : after JSON-like key does not need to be followed by whitespace
- char === ":" && this.prevNodeIsJsonLike()) {
- this.items.push({
- char,
- offset
- });
- offset += 1;
- break;
- }
- }
- default: {
- const node = parseNode({
- atLineStart: false,
- inCollection: false,
- inFlow: true,
- indent: -1,
- lineStart,
- parent: this
- }, offset);
- if (!node) {
- this.valueRange = new PlainValue.Range(start, offset);
- return offset;
- }
- this.items.push(node);
- offset = PlainValue.Node.normalizeOffset(src, node.range.end);
- }
- }
- offset = PlainValue.Node.endOfWhiteSpace(src, offset);
- char = src[offset];
- }
- this.valueRange = new PlainValue.Range(start, offset + 1);
- if (char) {
- this.items.push({
- char,
- offset
- });
- offset = PlainValue.Node.endOfWhiteSpace(src, offset + 1);
- offset = this.parseComment(offset);
- }
- return offset;
- }
- setOrigRanges(cr, offset) {
- offset = super.setOrigRanges(cr, offset);
- this.items.forEach((node) => {
- if (node instanceof PlainValue.Node) {
- offset = node.setOrigRanges(cr, offset);
- } else if (cr.length === 0) {
- node.origOffset = node.offset;
- } else {
- let i = offset;
- while (i < cr.length) {
- if (cr[i] > node.offset) break;
- else ++i;
- }
- node.origOffset = node.offset + i;
- offset = i;
- }
- });
- return offset;
- }
- toString() {
- const {
- context: {
- src
- },
- items,
- range,
- value
- } = this;
- if (value != null) return value;
- const nodes = items.filter((item) => item instanceof PlainValue.Node);
- let str = "";
- let prevEnd = range.start;
- nodes.forEach((node) => {
- const prefix = src.slice(prevEnd, node.range.start);
- prevEnd = node.range.end;
- str += prefix + String(node);
- if (str[str.length - 1] === "\n" && src[prevEnd - 1] !== "\n" && src[prevEnd] === "\n") {
- prevEnd += 1;
- }
- });
- str += src.slice(prevEnd, range.end);
- return PlainValue.Node.addStringTerminator(src, range.end, str);
- }
- };
- var QuoteDouble = class _QuoteDouble extends PlainValue.Node {
- static endOfQuote(src, offset) {
- let ch = src[offset];
- while (ch && ch !== '"') {
- offset += ch === "\\" ? 2 : 1;
- ch = src[offset];
- }
- return offset + 1;
- }
- /**
- * @returns {string | { str: string, errors: YAMLSyntaxError[] }}
- */
- get strValue() {
- if (!this.valueRange || !this.context) return null;
- const errors = [];
- const {
- start,
- end
- } = this.valueRange;
- const {
- indent,
- src
- } = this.context;
- if (src[end - 1] !== '"') errors.push(new PlainValue.YAMLSyntaxError(this, 'Missing closing "quote'));
- let str = "";
- for (let i = start + 1; i < end - 1; ++i) {
- const ch = src[i];
- if (ch === "\n") {
- if (PlainValue.Node.atDocumentBoundary(src, i + 1)) errors.push(new PlainValue.YAMLSemanticError(this, "Document boundary indicators are not allowed within string values"));
- const {
- fold,
- offset,
- error
- } = PlainValue.Node.foldNewline(src, i, indent);
- str += fold;
- i = offset;
- if (error) errors.push(new PlainValue.YAMLSemanticError(this, "Multi-line double-quoted string needs to be sufficiently indented"));
- } else if (ch === "\\") {
- i += 1;
- switch (src[i]) {
- case "0":
- str += "\0";
- break;
- case "a":
- str += "\x07";
- break;
- case "b":
- str += "\b";
- break;
- case "e":
- str += "\x1B";
- break;
- case "f":
- str += "\f";
- break;
- case "n":
- str += "\n";
- break;
- case "r":
- str += "\r";
- break;
- case "t":
- str += " ";
- break;
- case "v":
- str += "\v";
- break;
- case "N":
- str += "\x85";
- break;
- case "_":
- str += "\xA0";
- break;
- case "L":
- str += "\u2028";
- break;
- case "P":
- str += "\u2029";
- break;
- case " ":
- str += " ";
- break;
- case '"':
- str += '"';
- break;
- case "/":
- str += "/";
- break;
- case "\\":
- str += "\\";
- break;
- case " ":
- str += " ";
- break;
- case "x":
- str += this.parseCharCode(i + 1, 2, errors);
- i += 2;
- break;
- case "u":
- str += this.parseCharCode(i + 1, 4, errors);
- i += 4;
- break;
- case "U":
- str += this.parseCharCode(i + 1, 8, errors);
- i += 8;
- break;
- case "\n":
- while (src[i + 1] === " " || src[i + 1] === " ") i += 1;
- break;
- default:
- errors.push(new PlainValue.YAMLSyntaxError(this, `Invalid escape sequence ${src.substr(i - 1, 2)}`));
- str += "\\" + src[i];
- }
- } else if (ch === " " || ch === " ") {
- const wsStart = i;
- let next = src[i + 1];
- while (next === " " || next === " ") {
- i += 1;
- next = src[i + 1];
- }
- if (next !== "\n") str += i > wsStart ? src.slice(wsStart, i + 1) : ch;
- } else {
- str += ch;
- }
- }
- return errors.length > 0 ? {
- errors,
- str
- } : str;
- }
- parseCharCode(offset, length, errors) {
- const {
- src
- } = this.context;
- const cc = src.substr(offset, length);
- const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
- const code = ok ? parseInt(cc, 16) : NaN;
- if (isNaN(code)) {
- errors.push(new PlainValue.YAMLSyntaxError(this, `Invalid escape sequence ${src.substr(offset - 2, length + 2)}`));
- return src.substr(offset - 2, length + 2);
- }
- return String.fromCodePoint(code);
- }
- /**
- * Parses a "double quoted" value from the source
- *
- * @param {ParseContext} context
- * @param {number} start - Index of first character
- * @returns {number} - Index of the character after this scalar
- */
- parse(context, start) {
- this.context = context;
- const {
- src
- } = context;
- let offset = _QuoteDouble.endOfQuote(src, start + 1);
- this.valueRange = new PlainValue.Range(start, offset);
- offset = PlainValue.Node.endOfWhiteSpace(src, offset);
- offset = this.parseComment(offset);
- return offset;
- }
- };
- var QuoteSingle = class _QuoteSingle extends PlainValue.Node {
- static endOfQuote(src, offset) {
- let ch = src[offset];
- while (ch) {
- if (ch === "'") {
- if (src[offset + 1] !== "'") break;
- ch = src[offset += 2];
- } else {
- ch = src[offset += 1];
- }
- }
- return offset + 1;
- }
- /**
- * @returns {string | { str: string, errors: YAMLSyntaxError[] }}
- */
- get strValue() {
- if (!this.valueRange || !this.context) return null;
- const errors = [];
- const {
- start,
- end
- } = this.valueRange;
- const {
- indent,
- src
- } = this.context;
- if (src[end - 1] !== "'") errors.push(new PlainValue.YAMLSyntaxError(this, "Missing closing 'quote"));
- let str = "";
- for (let i = start + 1; i < end - 1; ++i) {
- const ch = src[i];
- if (ch === "\n") {
- if (PlainValue.Node.atDocumentBoundary(src, i + 1)) errors.push(new PlainValue.YAMLSemanticError(this, "Document boundary indicators are not allowed within string values"));
- const {
- fold,
- offset,
- error
- } = PlainValue.Node.foldNewline(src, i, indent);
- str += fold;
- i = offset;
- if (error) errors.push(new PlainValue.YAMLSemanticError(this, "Multi-line single-quoted string needs to be sufficiently indented"));
- } else if (ch === "'") {
- str += ch;
- i += 1;
- if (src[i] !== "'") errors.push(new PlainValue.YAMLSyntaxError(this, "Unescaped single quote? This should not happen."));
- } else if (ch === " " || ch === " ") {
- const wsStart = i;
- let next = src[i + 1];
- while (next === " " || next === " ") {
- i += 1;
- next = src[i + 1];
- }
- if (next !== "\n") str += i > wsStart ? src.slice(wsStart, i + 1) : ch;
- } else {
- str += ch;
- }
- }
- return errors.length > 0 ? {
- errors,
- str
- } : str;
- }
- /**
- * Parses a 'single quoted' value from the source
- *
- * @param {ParseContext} context
- * @param {number} start - Index of first character
- * @returns {number} - Index of the character after this scalar
- */
- parse(context, start) {
- this.context = context;
- const {
- src
- } = context;
- let offset = _QuoteSingle.endOfQuote(src, start + 1);
- this.valueRange = new PlainValue.Range(start, offset);
- offset = PlainValue.Node.endOfWhiteSpace(src, offset);
- offset = this.parseComment(offset);
- return offset;
- }
- };
- function createNewNode(type, props) {
- switch (type) {
- case PlainValue.Type.ALIAS:
- return new Alias(type, props);
- case PlainValue.Type.BLOCK_FOLDED:
- case PlainValue.Type.BLOCK_LITERAL:
- return new BlockValue(type, props);
- case PlainValue.Type.FLOW_MAP:
- case PlainValue.Type.FLOW_SEQ:
- return new FlowCollection(type, props);
- case PlainValue.Type.MAP_KEY:
- case PlainValue.Type.MAP_VALUE:
- case PlainValue.Type.SEQ_ITEM:
- return new CollectionItem(type, props);
- case PlainValue.Type.COMMENT:
- case PlainValue.Type.PLAIN:
- return new PlainValue.PlainValue(type, props);
- case PlainValue.Type.QUOTE_DOUBLE:
- return new QuoteDouble(type, props);
- case PlainValue.Type.QUOTE_SINGLE:
- return new QuoteSingle(type, props);
- default:
- return null;
- }
- }
- var ParseContext = class _ParseContext {
- static parseType(src, offset, inFlow) {
- switch (src[offset]) {
- case "*":
- return PlainValue.Type.ALIAS;
- case ">":
- return PlainValue.Type.BLOCK_FOLDED;
- case "|":
- return PlainValue.Type.BLOCK_LITERAL;
- case "{":
- return PlainValue.Type.FLOW_MAP;
- case "[":
- return PlainValue.Type.FLOW_SEQ;
- case "?":
- return !inFlow && PlainValue.Node.atBlank(src, offset + 1, true) ? PlainValue.Type.MAP_KEY : PlainValue.Type.PLAIN;
- case ":":
- return !inFlow && PlainValue.Node.atBlank(src, offset + 1, true) ? PlainValue.Type.MAP_VALUE : PlainValue.Type.PLAIN;
- case "-":
- return !inFlow && PlainValue.Node.atBlank(src, offset + 1, true) ? PlainValue.Type.SEQ_ITEM : PlainValue.Type.PLAIN;
- case '"':
- return PlainValue.Type.QUOTE_DOUBLE;
- case "'":
- return PlainValue.Type.QUOTE_SINGLE;
- default:
- return PlainValue.Type.PLAIN;
- }
- }
- constructor(orig = {}, {
- atLineStart,
- inCollection,
- inFlow,
- indent,
- lineStart,
- parent
- } = {}) {
- PlainValue._defineProperty(this, "parseNode", (overlay, start) => {
- if (PlainValue.Node.atDocumentBoundary(this.src, start)) return null;
- const context = new _ParseContext(this, overlay);
- const {
- props,
- type,
- valueStart
- } = context.parseProps(start);
- const node = createNewNode(type, props);
- let offset = node.parse(context, valueStart);
- node.range = new PlainValue.Range(start, offset);
- if (offset <= start) {
- node.error = new Error(`Node#parse consumed no characters`);
- node.error.parseEnd = offset;
- node.error.source = node;
- node.range.end = start + 1;
- }
- if (context.nodeStartsCollection(node)) {
- if (!node.error && !context.atLineStart && context.parent.type === PlainValue.Type.DOCUMENT) {
- node.error = new PlainValue.YAMLSyntaxError(node, "Block collection must not have preceding content here (e.g. directives-end indicator)");
- }
- const collection = new Collection(node);
- offset = collection.parse(new _ParseContext(context), offset);
- collection.range = new PlainValue.Range(start, offset);
- return collection;
- }
- return node;
- });
- this.atLineStart = atLineStart != null ? atLineStart : orig.atLineStart || false;
- this.inCollection = inCollection != null ? inCollection : orig.inCollection || false;
- this.inFlow = inFlow != null ? inFlow : orig.inFlow || false;
- this.indent = indent != null ? indent : orig.indent;
- this.lineStart = lineStart != null ? lineStart : orig.lineStart;
- this.parent = parent != null ? parent : orig.parent || {};
- this.root = orig.root;
- this.src = orig.src;
- }
- nodeStartsCollection(node) {
- const {
- inCollection,
- inFlow,
- src
- } = this;
- if (inCollection || inFlow) return false;
- if (node instanceof CollectionItem) return true;
- let offset = node.range.end;
- if (src[offset] === "\n" || src[offset - 1] === "\n") return false;
- offset = PlainValue.Node.endOfWhiteSpace(src, offset);
- return src[offset] === ":";
- }
- // Anchor and tag are before type, which determines the node implementation
- // class; hence this intermediate step.
- parseProps(offset) {
- const {
- inFlow,
- parent,
- src
- } = this;
- const props = [];
- let lineHasProps = false;
- offset = this.atLineStart ? PlainValue.Node.endOfIndent(src, offset) : PlainValue.Node.endOfWhiteSpace(src, offset);
- let ch = src[offset];
- while (ch === PlainValue.Char.ANCHOR || ch === PlainValue.Char.COMMENT || ch === PlainValue.Char.TAG || ch === "\n") {
- if (ch === "\n") {
- let inEnd = offset;
- let lineStart;
- do {
- lineStart = inEnd + 1;
- inEnd = PlainValue.Node.endOfIndent(src, lineStart);
- } while (src[inEnd] === "\n");
- const indentDiff = inEnd - (lineStart + this.indent);
- const noIndicatorAsIndent = parent.type === PlainValue.Type.SEQ_ITEM && parent.context.atLineStart;
- if (src[inEnd] !== "#" && !PlainValue.Node.nextNodeIsIndented(src[inEnd], indentDiff, !noIndicatorAsIndent)) break;
- this.atLineStart = true;
- this.lineStart = lineStart;
- lineHasProps = false;
- offset = inEnd;
- } else if (ch === PlainValue.Char.COMMENT) {
- const end = PlainValue.Node.endOfLine(src, offset + 1);
- props.push(new PlainValue.Range(offset, end));
- offset = end;
- } else {
- let end = PlainValue.Node.endOfIdentifier(src, offset + 1);
- if (ch === PlainValue.Char.TAG && src[end] === "," && /^[a-zA-Z0-9-]+\.[a-zA-Z0-9-]+,\d\d\d\d(-\d\d){0,2}\/\S/.test(src.slice(offset + 1, end + 13))) {
- end = PlainValue.Node.endOfIdentifier(src, end + 5);
- }
- props.push(new PlainValue.Range(offset, end));
- lineHasProps = true;
- offset = PlainValue.Node.endOfWhiteSpace(src, end);
- }
- ch = src[offset];
- }
- if (lineHasProps && ch === ":" && PlainValue.Node.atBlank(src, offset + 1, true)) offset -= 1;
- const type = _ParseContext.parseType(src, offset, inFlow);
- return {
- props,
- type,
- valueStart: offset
- };
- }
- /**
- * Parses a node from the source
- * @param {ParseContext} overlay
- * @param {number} start - Index of first non-whitespace character for the node
- * @returns {?Node} - null if at a document boundary
- */
- };
- function parse2(src) {
- const cr = [];
- if (src.indexOf("\r") !== -1) {
- src = src.replace(/\r\n?/g, (match, offset2) => {
- if (match.length > 1) cr.push(offset2);
- return "\n";
- });
- }
- const documents = [];
- let offset = 0;
- do {
- const doc = new Document();
- const context = new ParseContext({
- src
- });
- offset = doc.parse(context, offset);
- documents.push(doc);
- } while (offset < src.length);
- documents.setOrigRanges = () => {
- if (cr.length === 0) return false;
- for (let i = 1; i < cr.length; ++i) cr[i] -= i;
- let crOffset = 0;
- for (let i = 0; i < documents.length; ++i) {
- crOffset = documents[i].setOrigRanges(cr, crOffset);
- }
- cr.splice(0, cr.length);
- return true;
- };
- documents.toString = () => documents.join("...\n");
- return documents;
- }
- exports2.parse = parse2;
- }
-});
-
-// ../../node_modules/oas-resolver-browser/node_modules/yaml/dist/resolveSeq-d03cb037.js
-var require_resolveSeq_d03cb037 = __commonJS({
- "../../node_modules/oas-resolver-browser/node_modules/yaml/dist/resolveSeq-d03cb037.js"(exports2) {
- "use strict";
- var PlainValue = require_PlainValue_ec8e588e();
- function addCommentBefore(str, indent, comment) {
- if (!comment) return str;
- const cc = comment.replace(/[\s\S]^/gm, `$&${indent}#`);
- return `#${cc}
-${indent}${str}`;
- }
- function addComment(str, indent, comment) {
- return !comment ? str : comment.indexOf("\n") === -1 ? `${str} #${comment}` : `${str}
-` + comment.replace(/^/gm, `${indent || ""}#`);
- }
- var Node = class {
- };
- function toJSON(value, arg, ctx) {
- if (Array.isArray(value)) return value.map((v, i) => toJSON(v, String(i), ctx));
- if (value && typeof value.toJSON === "function") {
- const anchor = ctx && ctx.anchors && ctx.anchors.get(value);
- if (anchor) ctx.onCreate = (res2) => {
- anchor.res = res2;
- delete ctx.onCreate;
- };
- const res = value.toJSON(arg, ctx);
- if (anchor && ctx.onCreate) ctx.onCreate(res);
- return res;
- }
- if ((!ctx || !ctx.keep) && typeof value === "bigint") return Number(value);
- return value;
- }
- var Scalar = class extends Node {
- constructor(value) {
- super();
- this.value = value;
- }
- toJSON(arg, ctx) {
- return ctx && ctx.keep ? this.value : toJSON(this.value, arg, ctx);
- }
- toString() {
- return String(this.value);
- }
- };
- function collectionFromPath(schema2, path, value) {
- let v = value;
- for (let i = path.length - 1; i >= 0; --i) {
- const k = path[i];
- if (Number.isInteger(k) && k >= 0) {
- const a = [];
- a[k] = v;
- v = a;
- } else {
- const o = {};
- Object.defineProperty(o, k, {
- value: v,
- writable: true,
- enumerable: true,
- configurable: true
- });
- v = o;
- }
- }
- return schema2.createNode(v, false);
- }
- var isEmptyPath = (path) => path == null || typeof path === "object" && path[Symbol.iterator]().next().done;
- var Collection = class _Collection extends Node {
- constructor(schema2) {
- super();
- PlainValue._defineProperty(this, "items", []);
- this.schema = schema2;
- }
- addIn(path, value) {
- if (isEmptyPath(path)) this.add(value);
- else {
- const [key, ...rest] = path;
- const node = this.get(key, true);
- if (node instanceof _Collection) node.addIn(rest, value);
- else if (node === void 0 && this.schema) this.set(key, collectionFromPath(this.schema, rest, value));
- else throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
- }
- }
- deleteIn([key, ...rest]) {
- if (rest.length === 0) return this.delete(key);
- const node = this.get(key, true);
- if (node instanceof _Collection) return node.deleteIn(rest);
- else throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
- }
- getIn([key, ...rest], keepScalar) {
- const node = this.get(key, true);
- if (rest.length === 0) return !keepScalar && node instanceof Scalar ? node.value : node;
- else return node instanceof _Collection ? node.getIn(rest, keepScalar) : void 0;
- }
- hasAllNullValues() {
- return this.items.every((node) => {
- if (!node || node.type !== "PAIR") return false;
- const n = node.value;
- return n == null || n instanceof Scalar && n.value == null && !n.commentBefore && !n.comment && !n.tag;
- });
- }
- hasIn([key, ...rest]) {
- if (rest.length === 0) return this.has(key);
- const node = this.get(key, true);
- return node instanceof _Collection ? node.hasIn(rest) : false;
- }
- setIn([key, ...rest], value) {
- if (rest.length === 0) {
- this.set(key, value);
- } else {
- const node = this.get(key, true);
- if (node instanceof _Collection) node.setIn(rest, value);
- else if (node === void 0 && this.schema) this.set(key, collectionFromPath(this.schema, rest, value));
- else throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
- }
- }
- // overridden in implementations
- /* istanbul ignore next */
- toJSON() {
- return null;
- }
- toString(ctx, {
- blockItem,
- flowChars,
- isMap,
- itemIndent
- }, onComment, onChompKeep) {
- const {
- indent,
- indentStep,
- stringify: stringify2
- } = ctx;
- const inFlow = this.type === PlainValue.Type.FLOW_MAP || this.type === PlainValue.Type.FLOW_SEQ || ctx.inFlow;
- if (inFlow) itemIndent += indentStep;
- const allNullValues = isMap && this.hasAllNullValues();
- ctx = Object.assign({}, ctx, {
- allNullValues,
- indent: itemIndent,
- inFlow,
- type: null
- });
- let chompKeep = false;
- let hasItemWithNewLine = false;
- const nodes = this.items.reduce((nodes2, item, i) => {
- let comment;
- if (item) {
- if (!chompKeep && item.spaceBefore) nodes2.push({
- type: "comment",
- str: ""
- });
- if (item.commentBefore) item.commentBefore.match(/^.*$/gm).forEach((line) => {
- nodes2.push({
- type: "comment",
- str: `#${line}`
- });
- });
- if (item.comment) comment = item.comment;
- if (inFlow && (!chompKeep && item.spaceBefore || item.commentBefore || item.comment || item.key && (item.key.commentBefore || item.key.comment) || item.value && (item.value.commentBefore || item.value.comment))) hasItemWithNewLine = true;
- }
- chompKeep = false;
- let str2 = stringify2(item, ctx, () => comment = null, () => chompKeep = true);
- if (inFlow && !hasItemWithNewLine && str2.includes("\n")) hasItemWithNewLine = true;
- if (inFlow && i < this.items.length - 1) str2 += ",";
- str2 = addComment(str2, itemIndent, comment);
- if (chompKeep && (comment || inFlow)) chompKeep = false;
- nodes2.push({
- type: "item",
- str: str2
- });
- return nodes2;
- }, []);
- let str;
- if (nodes.length === 0) {
- str = flowChars.start + flowChars.end;
- } else if (inFlow) {
- const {
- start,
- end
- } = flowChars;
- const strings = nodes.map((n) => n.str);
- if (hasItemWithNewLine || strings.reduce((sum, str2) => sum + str2.length + 2, 2) > _Collection.maxFlowStringSingleLineLength) {
- str = start;
- for (const s of strings) {
- str += s ? `
-${indentStep}${indent}${s}` : "\n";
- }
- str += `
-${indent}${end}`;
- } else {
- str = `${start} ${strings.join(" ")} ${end}`;
- }
- } else {
- const strings = nodes.map(blockItem);
- str = strings.shift();
- for (const s of strings) str += s ? `
-${indent}${s}` : "\n";
- }
- if (this.comment) {
- str += "\n" + this.comment.replace(/^/gm, `${indent}#`);
- if (onComment) onComment();
- } else if (chompKeep && onChompKeep) onChompKeep();
- return str;
- }
- };
- PlainValue._defineProperty(Collection, "maxFlowStringSingleLineLength", 60);
- function asItemIndex(key) {
- let idx = key instanceof Scalar ? key.value : key;
- if (idx && typeof idx === "string") idx = Number(idx);
- return Number.isInteger(idx) && idx >= 0 ? idx : null;
- }
- var YAMLSeq = class extends Collection {
- add(value) {
- this.items.push(value);
- }
- delete(key) {
- const idx = asItemIndex(key);
- if (typeof idx !== "number") return false;
- const del = this.items.splice(idx, 1);
- return del.length > 0;
- }
- get(key, keepScalar) {
- const idx = asItemIndex(key);
- if (typeof idx !== "number") return void 0;
- const it = this.items[idx];
- return !keepScalar && it instanceof Scalar ? it.value : it;
- }
- has(key) {
- const idx = asItemIndex(key);
- return typeof idx === "number" && idx < this.items.length;
- }
- set(key, value) {
- const idx = asItemIndex(key);
- if (typeof idx !== "number") throw new Error(`Expected a valid index, not ${key}.`);
- this.items[idx] = value;
- }
- toJSON(_2, ctx) {
- const seq = [];
- if (ctx && ctx.onCreate) ctx.onCreate(seq);
- let i = 0;
- for (const item of this.items) seq.push(toJSON(item, String(i++), ctx));
- return seq;
- }
- toString(ctx, onComment, onChompKeep) {
- if (!ctx) return JSON.stringify(this);
- return super.toString(ctx, {
- blockItem: (n) => n.type === "comment" ? n.str : `- ${n.str}`,
- flowChars: {
- start: "[",
- end: "]"
- },
- isMap: false,
- itemIndent: (ctx.indent || "") + " "
- }, onComment, onChompKeep);
- }
- };
- var stringifyKey = (key, jsKey, ctx) => {
- if (jsKey === null) return "";
- if (typeof jsKey !== "object") return String(jsKey);
- if (key instanceof Node && ctx && ctx.doc) return key.toString({
- anchors: /* @__PURE__ */ Object.create(null),
- doc: ctx.doc,
- indent: "",
- indentStep: ctx.indentStep,
- inFlow: true,
- inStringifyKey: true,
- stringify: ctx.stringify
- });
- return JSON.stringify(jsKey);
- };
- var Pair = class _Pair extends Node {
- constructor(key, value = null) {
- super();
- this.key = key;
- this.value = value;
- this.type = _Pair.Type.PAIR;
- }
- get commentBefore() {
- return this.key instanceof Node ? this.key.commentBefore : void 0;
- }
- set commentBefore(cb) {
- if (this.key == null) this.key = new Scalar(null);
- if (this.key instanceof Node) this.key.commentBefore = cb;
- else {
- const msg = "Pair.commentBefore is an alias for Pair.key.commentBefore. To set it, the key must be a Node.";
- throw new Error(msg);
- }
- }
- addToJSMap(ctx, map) {
- const key = toJSON(this.key, "", ctx);
- if (map instanceof Map) {
- const value = toJSON(this.value, key, ctx);
- map.set(key, value);
- } else if (map instanceof Set) {
- map.add(key);
- } else {
- const stringKey = stringifyKey(this.key, key, ctx);
- const value = toJSON(this.value, stringKey, ctx);
- if (stringKey in map) Object.defineProperty(map, stringKey, {
- value,
- writable: true,
- enumerable: true,
- configurable: true
- });
- else map[stringKey] = value;
- }
- return map;
- }
- toJSON(_2, ctx) {
- const pair = ctx && ctx.mapAsMap ? /* @__PURE__ */ new Map() : {};
- return this.addToJSMap(ctx, pair);
- }
- toString(ctx, onComment, onChompKeep) {
- if (!ctx || !ctx.doc) return JSON.stringify(this);
- const {
- indent: indentSize,
- indentSeq,
- simpleKeys
- } = ctx.doc.options;
- let {
- key,
- value
- } = this;
- let keyComment = key instanceof Node && key.comment;
- if (simpleKeys) {
- if (keyComment) {
- throw new Error("With simple keys, key nodes cannot have comments");
- }
- if (key instanceof Collection) {
- const msg = "With simple keys, collection cannot be used as a key value";
- throw new Error(msg);
- }
- }
- let explicitKey = !simpleKeys && (!key || keyComment || (key instanceof Node ? key instanceof Collection || key.type === PlainValue.Type.BLOCK_FOLDED || key.type === PlainValue.Type.BLOCK_LITERAL : typeof key === "object"));
- const {
- doc,
- indent,
- indentStep,
- stringify: stringify2
- } = ctx;
- ctx = Object.assign({}, ctx, {
- implicitKey: !explicitKey,
- indent: indent + indentStep
- });
- let chompKeep = false;
- let str = stringify2(key, ctx, () => keyComment = null, () => chompKeep = true);
- str = addComment(str, ctx.indent, keyComment);
- if (!explicitKey && str.length > 1024) {
- if (simpleKeys) throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
- explicitKey = true;
- }
- if (ctx.allNullValues && !simpleKeys) {
- if (this.comment) {
- str = addComment(str, ctx.indent, this.comment);
- if (onComment) onComment();
- } else if (chompKeep && !keyComment && onChompKeep) onChompKeep();
- return ctx.inFlow && !explicitKey ? str : `? ${str}`;
- }
- str = explicitKey ? `? ${str}
-${indent}:` : `${str}:`;
- if (this.comment) {
- str = addComment(str, ctx.indent, this.comment);
- if (onComment) onComment();
- }
- let vcb = "";
- let valueComment = null;
- if (value instanceof Node) {
- if (value.spaceBefore) vcb = "\n";
- if (value.commentBefore) {
- const cs = value.commentBefore.replace(/^/gm, `${ctx.indent}#`);
- vcb += `
-${cs}`;
- }
- valueComment = value.comment;
- } else if (value && typeof value === "object") {
- value = doc.schema.createNode(value, true);
- }
- ctx.implicitKey = false;
- if (!explicitKey && !this.comment && value instanceof Scalar) ctx.indentAtStart = str.length + 1;
- chompKeep = false;
- if (!indentSeq && indentSize >= 2 && !ctx.inFlow && !explicitKey && value instanceof YAMLSeq && value.type !== PlainValue.Type.FLOW_SEQ && !value.tag && !doc.anchors.getName(value)) {
- ctx.indent = ctx.indent.substr(2);
- }
- const valueStr = stringify2(value, ctx, () => valueComment = null, () => chompKeep = true);
- let ws = " ";
- if (vcb || this.comment) {
- ws = `${vcb}
-${ctx.indent}`;
- } else if (!explicitKey && value instanceof Collection) {
- const flow = valueStr[0] === "[" || valueStr[0] === "{";
- if (!flow || valueStr.includes("\n")) ws = `
-${ctx.indent}`;
- } else if (valueStr[0] === "\n") ws = "";
- if (chompKeep && !valueComment && onChompKeep) onChompKeep();
- return addComment(str + ws + valueStr, ctx.indent, valueComment);
- }
- };
- PlainValue._defineProperty(Pair, "Type", {
- PAIR: "PAIR",
- MERGE_PAIR: "MERGE_PAIR"
- });
- var getAliasCount = (node, anchors) => {
- if (node instanceof Alias) {
- const anchor = anchors.get(node.source);
- return anchor.count * anchor.aliasCount;
- } else if (node instanceof Collection) {
- let count = 0;
- for (const item of node.items) {
- const c = getAliasCount(item, anchors);
- if (c > count) count = c;
- }
- return count;
- } else if (node instanceof Pair) {
- const kc = getAliasCount(node.key, anchors);
- const vc = getAliasCount(node.value, anchors);
- return Math.max(kc, vc);
- }
- return 1;
- };
- var Alias = class _Alias extends Node {
- static stringify({
- range,
- source
- }, {
- anchors,
- doc,
- implicitKey,
- inStringifyKey
- }) {
- let anchor = Object.keys(anchors).find((a) => anchors[a] === source);
- if (!anchor && inStringifyKey) anchor = doc.anchors.getName(source) || doc.anchors.newName();
- if (anchor) return `*${anchor}${implicitKey ? " " : ""}`;
- const msg = doc.anchors.getName(source) ? "Alias node must be after source node" : "Source node not found for alias node";
- throw new Error(`${msg} [${range}]`);
- }
- constructor(source) {
- super();
- this.source = source;
- this.type = PlainValue.Type.ALIAS;
- }
- set tag(t) {
- throw new Error("Alias nodes cannot have tags");
- }
- toJSON(arg, ctx) {
- if (!ctx) return toJSON(this.source, arg, ctx);
- const {
- anchors,
- maxAliasCount
- } = ctx;
- const anchor = anchors.get(this.source);
- if (!anchor || anchor.res === void 0) {
- const msg = "This should not happen: Alias anchor was not resolved?";
- if (this.cstNode) throw new PlainValue.YAMLReferenceError(this.cstNode, msg);
- else throw new ReferenceError(msg);
- }
- if (maxAliasCount >= 0) {
- anchor.count += 1;
- if (anchor.aliasCount === 0) anchor.aliasCount = getAliasCount(this.source, anchors);
- if (anchor.count * anchor.aliasCount > maxAliasCount) {
- const msg = "Excessive alias count indicates a resource exhaustion attack";
- if (this.cstNode) throw new PlainValue.YAMLReferenceError(this.cstNode, msg);
- else throw new ReferenceError(msg);
- }
- }
- return anchor.res;
- }
- // Only called when stringifying an alias mapping key while constructing
- // Object output.
- toString(ctx) {
- return _Alias.stringify(this, ctx);
- }
- };
- PlainValue._defineProperty(Alias, "default", true);
- function findPair(items, key) {
- const k = key instanceof Scalar ? key.value : key;
- for (const it of items) {
- if (it instanceof Pair) {
- if (it.key === key || it.key === k) return it;
- if (it.key && it.key.value === k) return it;
- }
- }
- return void 0;
- }
- var YAMLMap = class extends Collection {
- add(pair, overwrite) {
- if (!pair) pair = new Pair(pair);
- else if (!(pair instanceof Pair)) pair = new Pair(pair.key || pair, pair.value);
- const prev = findPair(this.items, pair.key);
- const sortEntries = this.schema && this.schema.sortMapEntries;
- if (prev) {
- if (overwrite) prev.value = pair.value;
- else throw new Error(`Key ${pair.key} already set`);
- } else if (sortEntries) {
- const i = this.items.findIndex((item) => sortEntries(pair, item) < 0);
- if (i === -1) this.items.push(pair);
- else this.items.splice(i, 0, pair);
- } else {
- this.items.push(pair);
- }
- }
- delete(key) {
- const it = findPair(this.items, key);
- if (!it) return false;
- const del = this.items.splice(this.items.indexOf(it), 1);
- return del.length > 0;
- }
- get(key, keepScalar) {
- const it = findPair(this.items, key);
- const node = it && it.value;
- return !keepScalar && node instanceof Scalar ? node.value : node;
- }
- has(key) {
- return !!findPair(this.items, key);
- }
- set(key, value) {
- this.add(new Pair(key, value), true);
- }
- /**
- * @param {*} arg ignored
- * @param {*} ctx Conversion context, originally set in Document#toJSON()
- * @param {Class} Type If set, forces the returned collection type
- * @returns {*} Instance of Type, Map, or Object
- */
- toJSON(_2, ctx, Type) {
- const map = Type ? new Type() : ctx && ctx.mapAsMap ? /* @__PURE__ */ new Map() : {};
- if (ctx && ctx.onCreate) ctx.onCreate(map);
- for (const item of this.items) item.addToJSMap(ctx, map);
- return map;
- }
- toString(ctx, onComment, onChompKeep) {
- if (!ctx) return JSON.stringify(this);
- for (const item of this.items) {
- if (!(item instanceof Pair)) throw new Error(`Map items must all be pairs; found ${JSON.stringify(item)} instead`);
- }
- return super.toString(ctx, {
- blockItem: (n) => n.str,
- flowChars: {
- start: "{",
- end: "}"
- },
- isMap: true,
- itemIndent: ctx.indent || ""
- }, onComment, onChompKeep);
- }
- };
- var MERGE_KEY = "<<";
- var Merge = class extends Pair {
- constructor(pair) {
- if (pair instanceof Pair) {
- let seq = pair.value;
- if (!(seq instanceof YAMLSeq)) {
- seq = new YAMLSeq();
- seq.items.push(pair.value);
- seq.range = pair.value.range;
- }
- super(pair.key, seq);
- this.range = pair.range;
- } else {
- super(new Scalar(MERGE_KEY), new YAMLSeq());
- }
- this.type = Pair.Type.MERGE_PAIR;
- }
- // If the value associated with a merge key is a single mapping node, each of
- // its key/value pairs is inserted into the current mapping, unless the key
- // already exists in it. If the value associated with the merge key is a
- // sequence, then this sequence is expected to contain mapping nodes and each
- // of these nodes is merged in turn according to its order in the sequence.
- // Keys in mapping nodes earlier in the sequence override keys specified in
- // later mapping nodes. -- http://yaml.org/type/merge.html
- addToJSMap(ctx, map) {
- for (const {
- source
- } of this.value.items) {
- if (!(source instanceof YAMLMap)) throw new Error("Merge sources must be maps");
- const srcMap = source.toJSON(null, ctx, Map);
- for (const [key, value] of srcMap) {
- if (map instanceof Map) {
- if (!map.has(key)) map.set(key, value);
- } else if (map instanceof Set) {
- map.add(key);
- } else if (!Object.prototype.hasOwnProperty.call(map, key)) {
- Object.defineProperty(map, key, {
- value,
- writable: true,
- enumerable: true,
- configurable: true
- });
- }
- }
- }
- return map;
- }
- toString(ctx, onComment) {
- const seq = this.value;
- if (seq.items.length > 1) return super.toString(ctx, onComment);
- this.value = seq.items[0];
- const str = super.toString(ctx, onComment);
- this.value = seq;
- return str;
- }
- };
- var binaryOptions = {
- defaultType: PlainValue.Type.BLOCK_LITERAL,
- lineWidth: 76
- };
- var boolOptions = {
- trueStr: "true",
- falseStr: "false"
- };
- var intOptions = {
- asBigInt: false
- };
- var nullOptions = {
- nullStr: "null"
- };
- var strOptions = {
- defaultType: PlainValue.Type.PLAIN,
- doubleQuoted: {
- jsonEncoding: false,
- minMultiLineLength: 40
- },
- fold: {
- lineWidth: 80,
- minContentWidth: 20
- }
- };
- function resolveScalar(str, tags, scalarFallback) {
- for (const {
- format,
- test,
- resolve
- } of tags) {
- if (test) {
- const match = str.match(test);
- if (match) {
- let res = resolve.apply(null, match);
- if (!(res instanceof Scalar)) res = new Scalar(res);
- if (format) res.format = format;
- return res;
- }
- }
- }
- if (scalarFallback) str = scalarFallback(str);
- return new Scalar(str);
- }
- var FOLD_FLOW = "flow";
- var FOLD_BLOCK = "block";
- var FOLD_QUOTED = "quoted";
- var consumeMoreIndentedLines = (text, i) => {
- let ch = text[i + 1];
- while (ch === " " || ch === " ") {
- do {
- ch = text[i += 1];
- } while (ch && ch !== "\n");
- ch = text[i + 1];
- }
- return i;
- };
- function foldFlowLines(text, indent, mode, {
- indentAtStart,
- lineWidth = 80,
- minContentWidth = 20,
- onFold,
- onOverflow
- }) {
- if (!lineWidth || lineWidth < 0) return text;
- const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);
- if (text.length <= endStep) return text;
- const folds = [];
- const escapedFolds = {};
- let end = lineWidth - indent.length;
- if (typeof indentAtStart === "number") {
- if (indentAtStart > lineWidth - Math.max(2, minContentWidth)) folds.push(0);
- else end = lineWidth - indentAtStart;
- }
- let split = void 0;
- let prev = void 0;
- let overflow = false;
- let i = -1;
- let escStart = -1;
- let escEnd = -1;
- if (mode === FOLD_BLOCK) {
- i = consumeMoreIndentedLines(text, i);
- if (i !== -1) end = i + endStep;
- }
- for (let ch; ch = text[i += 1]; ) {
- if (mode === FOLD_QUOTED && ch === "\\") {
- escStart = i;
- switch (text[i + 1]) {
- case "x":
- i += 3;
- break;
- case "u":
- i += 5;
- break;
- case "U":
- i += 9;
- break;
- default:
- i += 1;
- }
- escEnd = i;
- }
- if (ch === "\n") {
- if (mode === FOLD_BLOCK) i = consumeMoreIndentedLines(text, i);
- end = i + endStep;
- split = void 0;
- } else {
- if (ch === " " && prev && prev !== " " && prev !== "\n" && prev !== " ") {
- const next = text[i + 1];
- if (next && next !== " " && next !== "\n" && next !== " ") split = i;
- }
- if (i >= end) {
- if (split) {
- folds.push(split);
- end = split + endStep;
- split = void 0;
- } else if (mode === FOLD_QUOTED) {
- while (prev === " " || prev === " ") {
- prev = ch;
- ch = text[i += 1];
- overflow = true;
- }
- const j = i > escEnd + 1 ? i - 2 : escStart - 1;
- if (escapedFolds[j]) return text;
- folds.push(j);
- escapedFolds[j] = true;
- end = j + endStep;
- split = void 0;
- } else {
- overflow = true;
- }
- }
- }
- prev = ch;
- }
- if (overflow && onOverflow) onOverflow();
- if (folds.length === 0) return text;
- if (onFold) onFold();
- let res = text.slice(0, folds[0]);
- for (let i2 = 0; i2 < folds.length; ++i2) {
- const fold = folds[i2];
- const end2 = folds[i2 + 1] || text.length;
- if (fold === 0) res = `
-${indent}${text.slice(0, end2)}`;
- else {
- if (mode === FOLD_QUOTED && escapedFolds[fold]) res += `${text[fold]}\\`;
- res += `
-${indent}${text.slice(fold + 1, end2)}`;
- }
- }
- return res;
- }
- var getFoldOptions = ({
- indentAtStart
- }) => indentAtStart ? Object.assign({
- indentAtStart
- }, strOptions.fold) : strOptions.fold;
- var containsDocumentMarker = (str) => /^(%|---|\.\.\.)/m.test(str);
- function lineLengthOverLimit(str, lineWidth, indentLength) {
- if (!lineWidth || lineWidth < 0) return false;
- const limit = lineWidth - indentLength;
- const strLen = str.length;
- if (strLen <= limit) return false;
- for (let i = 0, start = 0; i < strLen; ++i) {
- if (str[i] === "\n") {
- if (i - start > limit) return true;
- start = i + 1;
- if (strLen - start <= limit) return false;
- }
- }
- return true;
- }
- function doubleQuotedString(value, ctx) {
- const {
- implicitKey
- } = ctx;
- const {
- jsonEncoding,
- minMultiLineLength
- } = strOptions.doubleQuoted;
- const json = JSON.stringify(value);
- if (jsonEncoding) return json;
- const indent = ctx.indent || (containsDocumentMarker(value) ? " " : "");
- let str = "";
- let start = 0;
- for (let i = 0, ch = json[i]; ch; ch = json[++i]) {
- if (ch === " " && json[i + 1] === "\\" && json[i + 2] === "n") {
- str += json.slice(start, i) + "\\ ";
- i += 1;
- start = i;
- ch = "\\";
- }
- if (ch === "\\") switch (json[i + 1]) {
- case "u":
- {
- str += json.slice(start, i);
- const code = json.substr(i + 2, 4);
- switch (code) {
- case "0000":
- str += "\\0";
- break;
- case "0007":
- str += "\\a";
- break;
- case "000b":
- str += "\\v";
- break;
- case "001b":
- str += "\\e";
- break;
- case "0085":
- str += "\\N";
- break;
- case "00a0":
- str += "\\_";
- break;
- case "2028":
- str += "\\L";
- break;
- case "2029":
- str += "\\P";
- break;
- default:
- if (code.substr(0, 2) === "00") str += "\\x" + code.substr(2);
- else str += json.substr(i, 6);
- }
- i += 5;
- start = i + 1;
- }
- break;
- case "n":
- if (implicitKey || json[i + 2] === '"' || json.length < minMultiLineLength) {
- i += 1;
- } else {
- str += json.slice(start, i) + "\n\n";
- while (json[i + 2] === "\\" && json[i + 3] === "n" && json[i + 4] !== '"') {
- str += "\n";
- i += 2;
- }
- str += indent;
- if (json[i + 2] === " ") str += "\\";
- i += 1;
- start = i + 1;
- }
- break;
- default:
- i += 1;
- }
- }
- str = start ? str + json.slice(start) : json;
- return implicitKey ? str : foldFlowLines(str, indent, FOLD_QUOTED, getFoldOptions(ctx));
- }
- function singleQuotedString(value, ctx) {
- if (ctx.implicitKey) {
- if (/\n/.test(value)) return doubleQuotedString(value, ctx);
- } else {
- if (/[ \t]\n|\n[ \t]/.test(value)) return doubleQuotedString(value, ctx);
- }
- const indent = ctx.indent || (containsDocumentMarker(value) ? " " : "");
- const res = "'" + value.replace(/'/g, "''").replace(/\n+/g, `$&
-${indent}`) + "'";
- return ctx.implicitKey ? res : foldFlowLines(res, indent, FOLD_FLOW, getFoldOptions(ctx));
- }
- function blockString({
- comment,
- type,
- value
- }, ctx, onComment, onChompKeep) {
- if (/\n[\t ]+$/.test(value) || /^\s*$/.test(value)) {
- return doubleQuotedString(value, ctx);
- }
- const indent = ctx.indent || (ctx.forceBlockIndent || containsDocumentMarker(value) ? " " : "");
- const indentSize = indent ? "2" : "1";
- const literal = type === PlainValue.Type.BLOCK_FOLDED ? false : type === PlainValue.Type.BLOCK_LITERAL ? true : !lineLengthOverLimit(value, strOptions.fold.lineWidth, indent.length);
- let header = literal ? "|" : ">";
- if (!value) return header + "\n";
- let wsStart = "";
- let wsEnd = "";
- value = value.replace(/[\n\t ]*$/, (ws) => {
- const n = ws.indexOf("\n");
- if (n === -1) {
- header += "-";
- } else if (value === ws || n !== ws.length - 1) {
- header += "+";
- if (onChompKeep) onChompKeep();
- }
- wsEnd = ws.replace(/\n$/, "");
- return "";
- }).replace(/^[\n ]*/, (ws) => {
- if (ws.indexOf(" ") !== -1) header += indentSize;
- const m = ws.match(/ +$/);
- if (m) {
- wsStart = ws.slice(0, -m[0].length);
- return m[0];
- } else {
- wsStart = ws;
- return "";
- }
- });
- if (wsEnd) wsEnd = wsEnd.replace(/\n+(?!\n|$)/g, `$&${indent}`);
- if (wsStart) wsStart = wsStart.replace(/\n+/g, `$&${indent}`);
- if (comment) {
- header += " #" + comment.replace(/ ?[\r\n]+/g, " ");
- if (onComment) onComment();
- }
- if (!value) return `${header}${indentSize}
-${indent}${wsEnd}`;
- if (literal) {
- value = value.replace(/\n+/g, `$&${indent}`);
- return `${header}
-${indent}${wsStart}${value}${wsEnd}`;
- }
- value = value.replace(/\n+/g, "\n$&").replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${indent}`);
- const body = foldFlowLines(`${wsStart}${value}${wsEnd}`, indent, FOLD_BLOCK, strOptions.fold);
- return `${header}
-${indent}${body}`;
- }
- function plainString(item, ctx, onComment, onChompKeep) {
- const {
- comment,
- type,
- value
- } = item;
- const {
- actualString,
- implicitKey,
- indent,
- inFlow
- } = ctx;
- if (implicitKey && /[\n[\]{},]/.test(value) || inFlow && /[[\]{},]/.test(value)) {
- return doubleQuotedString(value, ctx);
- }
- if (!value || /^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
- return implicitKey || inFlow || value.indexOf("\n") === -1 ? value.indexOf('"') !== -1 && value.indexOf("'") === -1 ? singleQuotedString(value, ctx) : doubleQuotedString(value, ctx) : blockString(item, ctx, onComment, onChompKeep);
- }
- if (!implicitKey && !inFlow && type !== PlainValue.Type.PLAIN && value.indexOf("\n") !== -1) {
- return blockString(item, ctx, onComment, onChompKeep);
- }
- if (indent === "" && containsDocumentMarker(value)) {
- ctx.forceBlockIndent = true;
- return blockString(item, ctx, onComment, onChompKeep);
- }
- const str = value.replace(/\n+/g, `$&
-${indent}`);
- if (actualString) {
- const {
- tags
- } = ctx.doc.schema;
- const resolved = resolveScalar(str, tags, tags.scalarFallback).value;
- if (typeof resolved !== "string") return doubleQuotedString(value, ctx);
- }
- const body = implicitKey ? str : foldFlowLines(str, indent, FOLD_FLOW, getFoldOptions(ctx));
- if (comment && !inFlow && (body.indexOf("\n") !== -1 || comment.indexOf("\n") !== -1)) {
- if (onComment) onComment();
- return addCommentBefore(body, indent, comment);
- }
- return body;
- }
- function stringifyString(item, ctx, onComment, onChompKeep) {
- const {
- defaultType
- } = strOptions;
- const {
- implicitKey,
- inFlow
- } = ctx;
- let {
- type,
- value
- } = item;
- if (typeof value !== "string") {
- value = String(value);
- item = Object.assign({}, item, {
- value
- });
- }
- const _stringify = (_type) => {
- switch (_type) {
- case PlainValue.Type.BLOCK_FOLDED:
- case PlainValue.Type.BLOCK_LITERAL:
- return blockString(item, ctx, onComment, onChompKeep);
- case PlainValue.Type.QUOTE_DOUBLE:
- return doubleQuotedString(value, ctx);
- case PlainValue.Type.QUOTE_SINGLE:
- return singleQuotedString(value, ctx);
- case PlainValue.Type.PLAIN:
- return plainString(item, ctx, onComment, onChompKeep);
- default:
- return null;
- }
- };
- if (type !== PlainValue.Type.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f]/.test(value)) {
- type = PlainValue.Type.QUOTE_DOUBLE;
- } else if ((implicitKey || inFlow) && (type === PlainValue.Type.BLOCK_FOLDED || type === PlainValue.Type.BLOCK_LITERAL)) {
- type = PlainValue.Type.QUOTE_DOUBLE;
- }
- let res = _stringify(type);
- if (res === null) {
- res = _stringify(defaultType);
- if (res === null) throw new Error(`Unsupported default string type ${defaultType}`);
- }
- return res;
- }
- function stringifyNumber({
- format,
- minFractionDigits,
- tag,
- value
- }) {
- if (typeof value === "bigint") return String(value);
- if (!isFinite(value)) return isNaN(value) ? ".nan" : value < 0 ? "-.inf" : ".inf";
- let n = JSON.stringify(value);
- if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^\d/.test(n)) {
- let i = n.indexOf(".");
- if (i < 0) {
- i = n.length;
- n += ".";
- }
- let d = minFractionDigits - (n.length - i - 1);
- while (d-- > 0) n += "0";
- }
- return n;
- }
- function checkFlowCollectionEnd(errors, cst) {
- let char, name;
- switch (cst.type) {
- case PlainValue.Type.FLOW_MAP:
- char = "}";
- name = "flow map";
- break;
- case PlainValue.Type.FLOW_SEQ:
- char = "]";
- name = "flow sequence";
- break;
- default:
- errors.push(new PlainValue.YAMLSemanticError(cst, "Not a flow collection!?"));
- return;
- }
- let lastItem;
- for (let i = cst.items.length - 1; i >= 0; --i) {
- const item = cst.items[i];
- if (!item || item.type !== PlainValue.Type.COMMENT) {
- lastItem = item;
- break;
- }
- }
- if (lastItem && lastItem.char !== char) {
- const msg = `Expected ${name} to end with ${char}`;
- let err;
- if (typeof lastItem.offset === "number") {
- err = new PlainValue.YAMLSemanticError(cst, msg);
- err.offset = lastItem.offset + 1;
- } else {
- err = new PlainValue.YAMLSemanticError(lastItem, msg);
- if (lastItem.range && lastItem.range.end) err.offset = lastItem.range.end - lastItem.range.start;
- }
- errors.push(err);
- }
- }
- function checkFlowCommentSpace(errors, comment) {
- const prev = comment.context.src[comment.range.start - 1];
- if (prev !== "\n" && prev !== " " && prev !== " ") {
- const msg = "Comments must be separated from other tokens by white space characters";
- errors.push(new PlainValue.YAMLSemanticError(comment, msg));
- }
- }
- function getLongKeyError(source, key) {
- const sk = String(key);
- const k = sk.substr(0, 8) + "..." + sk.substr(-8);
- return new PlainValue.YAMLSemanticError(source, `The "${k}" key is too long`);
- }
- function resolveComments(collection, comments) {
- for (const {
- afterKey,
- before,
- comment
- } of comments) {
- let item = collection.items[before];
- if (!item) {
- if (comment !== void 0) {
- if (collection.comment) collection.comment += "\n" + comment;
- else collection.comment = comment;
- }
- } else {
- if (afterKey && item.value) item = item.value;
- if (comment === void 0) {
- if (afterKey || !item.commentBefore) item.spaceBefore = true;
- } else {
- if (item.commentBefore) item.commentBefore += "\n" + comment;
- else item.commentBefore = comment;
- }
- }
- }
- }
- function resolveString(doc, node) {
- const res = node.strValue;
- if (!res) return "";
- if (typeof res === "string") return res;
- res.errors.forEach((error) => {
- if (!error.source) error.source = node;
- doc.errors.push(error);
- });
- return res.str;
- }
- function resolveTagHandle(doc, node) {
- const {
- handle,
- suffix
- } = node.tag;
- let prefix = doc.tagPrefixes.find((p) => p.handle === handle);
- if (!prefix) {
- const dtp = doc.getDefaults().tagPrefixes;
- if (dtp) prefix = dtp.find((p) => p.handle === handle);
- if (!prefix) throw new PlainValue.YAMLSemanticError(node, `The ${handle} tag handle is non-default and was not declared.`);
- }
- if (!suffix) throw new PlainValue.YAMLSemanticError(node, `The ${handle} tag has no suffix.`);
- if (handle === "!" && (doc.version || doc.options.version) === "1.0") {
- if (suffix[0] === "^") {
- doc.warnings.push(new PlainValue.YAMLWarning(node, "YAML 1.0 ^ tag expansion is not supported"));
- return suffix;
- }
- if (/[:/]/.test(suffix)) {
- const vocab = suffix.match(/^([a-z0-9-]+)\/(.*)/i);
- return vocab ? `tag:${vocab[1]}.yaml.org,2002:${vocab[2]}` : `tag:${suffix}`;
- }
- }
- return prefix.prefix + decodeURIComponent(suffix);
- }
- function resolveTagName(doc, node) {
- const {
- tag,
- type
- } = node;
- let nonSpecific = false;
- if (tag) {
- const {
- handle,
- suffix,
- verbatim
- } = tag;
- if (verbatim) {
- if (verbatim !== "!" && verbatim !== "!!") return verbatim;
- const msg = `Verbatim tags aren't resolved, so ${verbatim} is invalid.`;
- doc.errors.push(new PlainValue.YAMLSemanticError(node, msg));
- } else if (handle === "!" && !suffix) {
- nonSpecific = true;
- } else {
- try {
- return resolveTagHandle(doc, node);
- } catch (error) {
- doc.errors.push(error);
- }
- }
- }
- switch (type) {
- case PlainValue.Type.BLOCK_FOLDED:
- case PlainValue.Type.BLOCK_LITERAL:
- case PlainValue.Type.QUOTE_DOUBLE:
- case PlainValue.Type.QUOTE_SINGLE:
- return PlainValue.defaultTags.STR;
- case PlainValue.Type.FLOW_MAP:
- case PlainValue.Type.MAP:
- return PlainValue.defaultTags.MAP;
- case PlainValue.Type.FLOW_SEQ:
- case PlainValue.Type.SEQ:
- return PlainValue.defaultTags.SEQ;
- case PlainValue.Type.PLAIN:
- return nonSpecific ? PlainValue.defaultTags.STR : null;
- default:
- return null;
- }
- }
- function resolveByTagName(doc, node, tagName) {
- const {
- tags
- } = doc.schema;
- const matchWithTest = [];
- for (const tag of tags) {
- if (tag.tag === tagName) {
- if (tag.test) matchWithTest.push(tag);
- else {
- const res = tag.resolve(doc, node);
- return res instanceof Collection ? res : new Scalar(res);
- }
- }
- }
- const str = resolveString(doc, node);
- if (typeof str === "string" && matchWithTest.length > 0) return resolveScalar(str, matchWithTest, tags.scalarFallback);
- return null;
- }
- function getFallbackTagName({
- type
- }) {
- switch (type) {
- case PlainValue.Type.FLOW_MAP:
- case PlainValue.Type.MAP:
- return PlainValue.defaultTags.MAP;
- case PlainValue.Type.FLOW_SEQ:
- case PlainValue.Type.SEQ:
- return PlainValue.defaultTags.SEQ;
- default:
- return PlainValue.defaultTags.STR;
- }
- }
- function resolveTag(doc, node, tagName) {
- try {
- const res = resolveByTagName(doc, node, tagName);
- if (res) {
- if (tagName && node.tag) res.tag = tagName;
- return res;
- }
- } catch (error) {
- if (!error.source) error.source = node;
- doc.errors.push(error);
- return null;
- }
- try {
- const fallback = getFallbackTagName(node);
- if (!fallback) throw new Error(`The tag ${tagName} is unavailable`);
- const msg = `The tag ${tagName} is unavailable, falling back to ${fallback}`;
- doc.warnings.push(new PlainValue.YAMLWarning(node, msg));
- const res = resolveByTagName(doc, node, fallback);
- res.tag = tagName;
- return res;
- } catch (error) {
- const refError = new PlainValue.YAMLReferenceError(node, error.message);
- refError.stack = error.stack;
- doc.errors.push(refError);
- return null;
- }
- }
- var isCollectionItem = (node) => {
- if (!node) return false;
- const {
- type
- } = node;
- return type === PlainValue.Type.MAP_KEY || type === PlainValue.Type.MAP_VALUE || type === PlainValue.Type.SEQ_ITEM;
- };
- function resolveNodeProps(errors, node) {
- const comments = {
- before: [],
- after: []
- };
- let hasAnchor = false;
- let hasTag = false;
- const props = isCollectionItem(node.context.parent) ? node.context.parent.props.concat(node.props) : node.props;
- for (const {
- start,
- end
- } of props) {
- switch (node.context.src[start]) {
- case PlainValue.Char.COMMENT: {
- if (!node.commentHasRequiredWhitespace(start)) {
- const msg = "Comments must be separated from other tokens by white space characters";
- errors.push(new PlainValue.YAMLSemanticError(node, msg));
- }
- const {
- header,
- valueRange
- } = node;
- const cc = valueRange && (start > valueRange.start || header && start > header.start) ? comments.after : comments.before;
- cc.push(node.context.src.slice(start + 1, end));
- break;
- }
- case PlainValue.Char.ANCHOR:
- if (hasAnchor) {
- const msg = "A node can have at most one anchor";
- errors.push(new PlainValue.YAMLSemanticError(node, msg));
- }
- hasAnchor = true;
- break;
- case PlainValue.Char.TAG:
- if (hasTag) {
- const msg = "A node can have at most one tag";
- errors.push(new PlainValue.YAMLSemanticError(node, msg));
- }
- hasTag = true;
- break;
- }
- }
- return {
- comments,
- hasAnchor,
- hasTag
- };
- }
- function resolveNodeValue(doc, node) {
- const {
- anchors,
- errors,
- schema: schema2
- } = doc;
- if (node.type === PlainValue.Type.ALIAS) {
- const name = node.rawValue;
- const src = anchors.getNode(name);
- if (!src) {
- const msg = `Aliased anchor not found: ${name}`;
- errors.push(new PlainValue.YAMLReferenceError(node, msg));
- return null;
- }
- const res = new Alias(src);
- anchors._cstAliases.push(res);
- return res;
- }
- const tagName = resolveTagName(doc, node);
- if (tagName) return resolveTag(doc, node, tagName);
- if (node.type !== PlainValue.Type.PLAIN) {
- const msg = `Failed to resolve ${node.type} node here`;
- errors.push(new PlainValue.YAMLSyntaxError(node, msg));
- return null;
- }
- try {
- const str = resolveString(doc, node);
- return resolveScalar(str, schema2.tags, schema2.tags.scalarFallback);
- } catch (error) {
- if (!error.source) error.source = node;
- errors.push(error);
- return null;
- }
- }
- function resolveNode(doc, node) {
- if (!node) return null;
- if (node.error) doc.errors.push(node.error);
- const {
- comments,
- hasAnchor,
- hasTag
- } = resolveNodeProps(doc.errors, node);
- if (hasAnchor) {
- const {
- anchors
- } = doc;
- const name = node.anchor;
- const prev = anchors.getNode(name);
- if (prev) anchors.map[anchors.newName(name)] = prev;
- anchors.map[name] = node;
- }
- if (node.type === PlainValue.Type.ALIAS && (hasAnchor || hasTag)) {
- const msg = "An alias node must not specify any properties";
- doc.errors.push(new PlainValue.YAMLSemanticError(node, msg));
- }
- const res = resolveNodeValue(doc, node);
- if (res) {
- res.range = [node.range.start, node.range.end];
- if (doc.options.keepCstNodes) res.cstNode = node;
- if (doc.options.keepNodeTypes) res.type = node.type;
- const cb = comments.before.join("\n");
- if (cb) {
- res.commentBefore = res.commentBefore ? `${res.commentBefore}
-${cb}` : cb;
- }
- const ca = comments.after.join("\n");
- if (ca) res.comment = res.comment ? `${res.comment}
-${ca}` : ca;
- }
- return node.resolved = res;
- }
- function resolveMap(doc, cst) {
- if (cst.type !== PlainValue.Type.MAP && cst.type !== PlainValue.Type.FLOW_MAP) {
- const msg = `A ${cst.type} node cannot be resolved as a mapping`;
- doc.errors.push(new PlainValue.YAMLSyntaxError(cst, msg));
- return null;
- }
- const {
- comments,
- items
- } = cst.type === PlainValue.Type.FLOW_MAP ? resolveFlowMapItems(doc, cst) : resolveBlockMapItems(doc, cst);
- const map = new YAMLMap();
- map.items = items;
- resolveComments(map, comments);
- let hasCollectionKey = false;
- for (let i = 0; i < items.length; ++i) {
- const {
- key: iKey
- } = items[i];
- if (iKey instanceof Collection) hasCollectionKey = true;
- if (doc.schema.merge && iKey && iKey.value === MERGE_KEY) {
- items[i] = new Merge(items[i]);
- const sources = items[i].value.items;
- let error = null;
- sources.some((node) => {
- if (node instanceof Alias) {
- const {
- type
- } = node.source;
- if (type === PlainValue.Type.MAP || type === PlainValue.Type.FLOW_MAP) return false;
- return error = "Merge nodes aliases can only point to maps";
- }
- return error = "Merge nodes can only have Alias nodes as values";
- });
- if (error) doc.errors.push(new PlainValue.YAMLSemanticError(cst, error));
- } else {
- for (let j = i + 1; j < items.length; ++j) {
- const {
- key: jKey
- } = items[j];
- if (iKey === jKey || iKey && jKey && Object.prototype.hasOwnProperty.call(iKey, "value") && iKey.value === jKey.value) {
- const msg = `Map keys must be unique; "${iKey}" is repeated`;
- doc.errors.push(new PlainValue.YAMLSemanticError(cst, msg));
- break;
- }
- }
- }
- }
- if (hasCollectionKey && !doc.options.mapAsMap) {
- const warn = "Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this.";
- doc.warnings.push(new PlainValue.YAMLWarning(cst, warn));
- }
- cst.resolved = map;
- return map;
- }
- var valueHasPairComment = ({
- context: {
- lineStart,
- node,
- src
- },
- props
- }) => {
- if (props.length === 0) return false;
- const {
- start
- } = props[0];
- if (node && start > node.valueRange.start) return false;
- if (src[start] !== PlainValue.Char.COMMENT) return false;
- for (let i = lineStart; i < start; ++i) if (src[i] === "\n") return false;
- return true;
- };
- function resolvePairComment(item, pair) {
- if (!valueHasPairComment(item)) return;
- const comment = item.getPropValue(0, PlainValue.Char.COMMENT, true);
- let found = false;
- const cb = pair.value.commentBefore;
- if (cb && cb.startsWith(comment)) {
- pair.value.commentBefore = cb.substr(comment.length + 1);
- found = true;
- } else {
- const cc = pair.value.comment;
- if (!item.node && cc && cc.startsWith(comment)) {
- pair.value.comment = cc.substr(comment.length + 1);
- found = true;
- }
- }
- if (found) pair.comment = comment;
- }
- function resolveBlockMapItems(doc, cst) {
- const comments = [];
- const items = [];
- let key = void 0;
- let keyStart = null;
- for (let i = 0; i < cst.items.length; ++i) {
- const item = cst.items[i];
- switch (item.type) {
- case PlainValue.Type.BLANK_LINE:
- comments.push({
- afterKey: !!key,
- before: items.length
- });
- break;
- case PlainValue.Type.COMMENT:
- comments.push({
- afterKey: !!key,
- before: items.length,
- comment: item.comment
- });
- break;
- case PlainValue.Type.MAP_KEY:
- if (key !== void 0) items.push(new Pair(key));
- if (item.error) doc.errors.push(item.error);
- key = resolveNode(doc, item.node);
- keyStart = null;
- break;
- case PlainValue.Type.MAP_VALUE:
- {
- if (key === void 0) key = null;
- if (item.error) doc.errors.push(item.error);
- if (!item.context.atLineStart && item.node && item.node.type === PlainValue.Type.MAP && !item.node.context.atLineStart) {
- const msg = "Nested mappings are not allowed in compact mappings";
- doc.errors.push(new PlainValue.YAMLSemanticError(item.node, msg));
- }
- let valueNode = item.node;
- if (!valueNode && item.props.length > 0) {
- valueNode = new PlainValue.PlainValue(PlainValue.Type.PLAIN, []);
- valueNode.context = {
- parent: item,
- src: item.context.src
- };
- const pos = item.range.start + 1;
- valueNode.range = {
- start: pos,
- end: pos
- };
- valueNode.valueRange = {
- start: pos,
- end: pos
- };
- if (typeof item.range.origStart === "number") {
- const origPos = item.range.origStart + 1;
- valueNode.range.origStart = valueNode.range.origEnd = origPos;
- valueNode.valueRange.origStart = valueNode.valueRange.origEnd = origPos;
- }
- }
- const pair = new Pair(key, resolveNode(doc, valueNode));
- resolvePairComment(item, pair);
- items.push(pair);
- if (key && typeof keyStart === "number") {
- if (item.range.start > keyStart + 1024) doc.errors.push(getLongKeyError(cst, key));
- }
- key = void 0;
- keyStart = null;
- }
- break;
- default:
- if (key !== void 0) items.push(new Pair(key));
- key = resolveNode(doc, item);
- keyStart = item.range.start;
- if (item.error) doc.errors.push(item.error);
- next: for (let j = i + 1; ; ++j) {
- const nextItem = cst.items[j];
- switch (nextItem && nextItem.type) {
- case PlainValue.Type.BLANK_LINE:
- case PlainValue.Type.COMMENT:
- continue next;
- case PlainValue.Type.MAP_VALUE:
- break next;
- default: {
- const msg = "Implicit map keys need to be followed by map values";
- doc.errors.push(new PlainValue.YAMLSemanticError(item, msg));
- break next;
- }
- }
- }
- if (item.valueRangeContainsNewline) {
- const msg = "Implicit map keys need to be on a single line";
- doc.errors.push(new PlainValue.YAMLSemanticError(item, msg));
- }
- }
- }
- if (key !== void 0) items.push(new Pair(key));
- return {
- comments,
- items
- };
- }
- function resolveFlowMapItems(doc, cst) {
- const comments = [];
- const items = [];
- let key = void 0;
- let explicitKey = false;
- let next = "{";
- for (let i = 0; i < cst.items.length; ++i) {
- const item = cst.items[i];
- if (typeof item.char === "string") {
- const {
- char,
- offset
- } = item;
- if (char === "?" && key === void 0 && !explicitKey) {
- explicitKey = true;
- next = ":";
- continue;
- }
- if (char === ":") {
- if (key === void 0) key = null;
- if (next === ":") {
- next = ",";
- continue;
- }
- } else {
- if (explicitKey) {
- if (key === void 0 && char !== ",") key = null;
- explicitKey = false;
- }
- if (key !== void 0) {
- items.push(new Pair(key));
- key = void 0;
- if (char === ",") {
- next = ":";
- continue;
- }
- }
- }
- if (char === "}") {
- if (i === cst.items.length - 1) continue;
- } else if (char === next) {
- next = ":";
- continue;
- }
- const msg = `Flow map contains an unexpected ${char}`;
- const err = new PlainValue.YAMLSyntaxError(cst, msg);
- err.offset = offset;
- doc.errors.push(err);
- } else if (item.type === PlainValue.Type.BLANK_LINE) {
- comments.push({
- afterKey: !!key,
- before: items.length
- });
- } else if (item.type === PlainValue.Type.COMMENT) {
- checkFlowCommentSpace(doc.errors, item);
- comments.push({
- afterKey: !!key,
- before: items.length,
- comment: item.comment
- });
- } else if (key === void 0) {
- if (next === ",") doc.errors.push(new PlainValue.YAMLSemanticError(item, "Separator , missing in flow map"));
- key = resolveNode(doc, item);
- } else {
- if (next !== ",") doc.errors.push(new PlainValue.YAMLSemanticError(item, "Indicator : missing in flow map entry"));
- items.push(new Pair(key, resolveNode(doc, item)));
- key = void 0;
- explicitKey = false;
- }
- }
- checkFlowCollectionEnd(doc.errors, cst);
- if (key !== void 0) items.push(new Pair(key));
- return {
- comments,
- items
- };
- }
- function resolveSeq(doc, cst) {
- if (cst.type !== PlainValue.Type.SEQ && cst.type !== PlainValue.Type.FLOW_SEQ) {
- const msg = `A ${cst.type} node cannot be resolved as a sequence`;
- doc.errors.push(new PlainValue.YAMLSyntaxError(cst, msg));
- return null;
- }
- const {
- comments,
- items
- } = cst.type === PlainValue.Type.FLOW_SEQ ? resolveFlowSeqItems(doc, cst) : resolveBlockSeqItems(doc, cst);
- const seq = new YAMLSeq();
- seq.items = items;
- resolveComments(seq, comments);
- if (!doc.options.mapAsMap && items.some((it) => it instanceof Pair && it.key instanceof Collection)) {
- const warn = "Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this.";
- doc.warnings.push(new PlainValue.YAMLWarning(cst, warn));
- }
- cst.resolved = seq;
- return seq;
- }
- function resolveBlockSeqItems(doc, cst) {
- const comments = [];
- const items = [];
- for (let i = 0; i < cst.items.length; ++i) {
- const item = cst.items[i];
- switch (item.type) {
- case PlainValue.Type.BLANK_LINE:
- comments.push({
- before: items.length
- });
- break;
- case PlainValue.Type.COMMENT:
- comments.push({
- comment: item.comment,
- before: items.length
- });
- break;
- case PlainValue.Type.SEQ_ITEM:
- if (item.error) doc.errors.push(item.error);
- items.push(resolveNode(doc, item.node));
- if (item.hasProps) {
- const msg = "Sequence items cannot have tags or anchors before the - indicator";
- doc.errors.push(new PlainValue.YAMLSemanticError(item, msg));
- }
- break;
- default:
- if (item.error) doc.errors.push(item.error);
- doc.errors.push(new PlainValue.YAMLSyntaxError(item, `Unexpected ${item.type} node in sequence`));
- }
- }
- return {
- comments,
- items
- };
- }
- function resolveFlowSeqItems(doc, cst) {
- const comments = [];
- const items = [];
- let explicitKey = false;
- let key = void 0;
- let keyStart = null;
- let next = "[";
- let prevItem = null;
- for (let i = 0; i < cst.items.length; ++i) {
- const item = cst.items[i];
- if (typeof item.char === "string") {
- const {
- char,
- offset
- } = item;
- if (char !== ":" && (explicitKey || key !== void 0)) {
- if (explicitKey && key === void 0) key = next ? items.pop() : null;
- items.push(new Pair(key));
- explicitKey = false;
- key = void 0;
- keyStart = null;
- }
- if (char === next) {
- next = null;
- } else if (!next && char === "?") {
- explicitKey = true;
- } else if (next !== "[" && char === ":" && key === void 0) {
- if (next === ",") {
- key = items.pop();
- if (key instanceof Pair) {
- const msg = "Chaining flow sequence pairs is invalid";
- const err = new PlainValue.YAMLSemanticError(cst, msg);
- err.offset = offset;
- doc.errors.push(err);
- }
- if (!explicitKey && typeof keyStart === "number") {
- const keyEnd = item.range ? item.range.start : item.offset;
- if (keyEnd > keyStart + 1024) doc.errors.push(getLongKeyError(cst, key));
- const {
- src
- } = prevItem.context;
- for (let i2 = keyStart; i2 < keyEnd; ++i2) if (src[i2] === "\n") {
- const msg = "Implicit keys of flow sequence pairs need to be on a single line";
- doc.errors.push(new PlainValue.YAMLSemanticError(prevItem, msg));
- break;
- }
- }
- } else {
- key = null;
- }
- keyStart = null;
- explicitKey = false;
- next = null;
- } else if (next === "[" || char !== "]" || i < cst.items.length - 1) {
- const msg = `Flow sequence contains an unexpected ${char}`;
- const err = new PlainValue.YAMLSyntaxError(cst, msg);
- err.offset = offset;
- doc.errors.push(err);
- }
- } else if (item.type === PlainValue.Type.BLANK_LINE) {
- comments.push({
- before: items.length
- });
- } else if (item.type === PlainValue.Type.COMMENT) {
- checkFlowCommentSpace(doc.errors, item);
- comments.push({
- comment: item.comment,
- before: items.length
- });
- } else {
- if (next) {
- const msg = `Expected a ${next} in flow sequence`;
- doc.errors.push(new PlainValue.YAMLSemanticError(item, msg));
- }
- const value = resolveNode(doc, item);
- if (key === void 0) {
- items.push(value);
- prevItem = item;
- } else {
- items.push(new Pair(key, value));
- key = void 0;
- }
- keyStart = item.range.start;
- next = ",";
- }
- }
- checkFlowCollectionEnd(doc.errors, cst);
- if (key !== void 0) items.push(new Pair(key));
- return {
- comments,
- items
- };
- }
- exports2.Alias = Alias;
- exports2.Collection = Collection;
- exports2.Merge = Merge;
- exports2.Node = Node;
- exports2.Pair = Pair;
- exports2.Scalar = Scalar;
- exports2.YAMLMap = YAMLMap;
- exports2.YAMLSeq = YAMLSeq;
- exports2.addComment = addComment;
- exports2.binaryOptions = binaryOptions;
- exports2.boolOptions = boolOptions;
- exports2.findPair = findPair;
- exports2.intOptions = intOptions;
- exports2.isEmptyPath = isEmptyPath;
- exports2.nullOptions = nullOptions;
- exports2.resolveMap = resolveMap;
- exports2.resolveNode = resolveNode;
- exports2.resolveSeq = resolveSeq;
- exports2.resolveString = resolveString;
- exports2.strOptions = strOptions;
- exports2.stringifyNumber = stringifyNumber;
- exports2.stringifyString = stringifyString;
- exports2.toJSON = toJSON;
- }
-});
-
-// ../../node_modules/oas-resolver-browser/node_modules/yaml/dist/warnings-1000a372.js
-var require_warnings_1000a372 = __commonJS({
- "../../node_modules/oas-resolver-browser/node_modules/yaml/dist/warnings-1000a372.js"(exports2) {
- "use strict";
- var PlainValue = require_PlainValue_ec8e588e();
- var resolveSeq = require_resolveSeq_d03cb037();
- var binary = {
- identify: (value) => value instanceof Uint8Array,
- // Buffer inherits from Uint8Array
- default: false,
- tag: "tag:yaml.org,2002:binary",
- /**
- * Returns a Buffer in node and an Uint8Array in browsers
- *
- * To use the resulting buffer as an image, you'll want to do something like:
- *
- * const blob = new Blob([buffer], { type: 'image/jpeg' })
- * document.querySelector('#photo').src = URL.createObjectURL(blob)
- */
- resolve: (doc, node) => {
- const src = resolveSeq.resolveString(doc, node);
- if (typeof Buffer === "function") {
- return Buffer.from(src, "base64");
- } else if (typeof atob === "function") {
- const str = atob(src.replace(/[\n\r]/g, ""));
- const buffer = new Uint8Array(str.length);
- for (let i = 0; i < str.length; ++i) buffer[i] = str.charCodeAt(i);
- return buffer;
- } else {
- const msg = "This environment does not support reading binary tags; either Buffer or atob is required";
- doc.errors.push(new PlainValue.YAMLReferenceError(node, msg));
- return null;
- }
- },
- options: resolveSeq.binaryOptions,
- stringify: ({
- comment,
- type,
- value
- }, ctx, onComment, onChompKeep) => {
- let src;
- if (typeof Buffer === "function") {
- src = value instanceof Buffer ? value.toString("base64") : Buffer.from(value.buffer).toString("base64");
- } else if (typeof btoa === "function") {
- let s = "";
- for (let i = 0; i < value.length; ++i) s += String.fromCharCode(value[i]);
- src = btoa(s);
- } else {
- throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
- }
- if (!type) type = resolveSeq.binaryOptions.defaultType;
- if (type === PlainValue.Type.QUOTE_DOUBLE) {
- value = src;
- } else {
- const {
- lineWidth
- } = resolveSeq.binaryOptions;
- const n = Math.ceil(src.length / lineWidth);
- const lines = new Array(n);
- for (let i = 0, o = 0; i < n; ++i, o += lineWidth) {
- lines[i] = src.substr(o, lineWidth);
- }
- value = lines.join(type === PlainValue.Type.BLOCK_LITERAL ? "\n" : " ");
- }
- return resolveSeq.stringifyString({
- comment,
- type,
- value
- }, ctx, onComment, onChompKeep);
- }
- };
- function parsePairs(doc, cst) {
- const seq = resolveSeq.resolveSeq(doc, cst);
- for (let i = 0; i < seq.items.length; ++i) {
- let item = seq.items[i];
- if (item instanceof resolveSeq.Pair) continue;
- else if (item instanceof resolveSeq.YAMLMap) {
- if (item.items.length > 1) {
- const msg = "Each pair must have its own sequence indicator";
- throw new PlainValue.YAMLSemanticError(cst, msg);
- }
- const pair = item.items[0] || new resolveSeq.Pair();
- if (item.commentBefore) pair.commentBefore = pair.commentBefore ? `${item.commentBefore}
-${pair.commentBefore}` : item.commentBefore;
- if (item.comment) pair.comment = pair.comment ? `${item.comment}
-${pair.comment}` : item.comment;
- item = pair;
- }
- seq.items[i] = item instanceof resolveSeq.Pair ? item : new resolveSeq.Pair(item);
- }
- return seq;
- }
- function createPairs(schema2, iterable, ctx) {
- const pairs2 = new resolveSeq.YAMLSeq(schema2);
- pairs2.tag = "tag:yaml.org,2002:pairs";
- for (const it of iterable) {
- let key, value;
- if (Array.isArray(it)) {
- if (it.length === 2) {
- key = it[0];
- value = it[1];
- } else throw new TypeError(`Expected [key, value] tuple: ${it}`);
- } else if (it && it instanceof Object) {
- const keys = Object.keys(it);
- if (keys.length === 1) {
- key = keys[0];
- value = it[key];
- } else throw new TypeError(`Expected { key: value } tuple: ${it}`);
- } else {
- key = it;
- }
- const pair = schema2.createPair(key, value, ctx);
- pairs2.items.push(pair);
- }
- return pairs2;
- }
- var pairs = {
- default: false,
- tag: "tag:yaml.org,2002:pairs",
- resolve: parsePairs,
- createNode: createPairs
- };
- var YAMLOMap = class _YAMLOMap extends resolveSeq.YAMLSeq {
- constructor() {
- super();
- PlainValue._defineProperty(this, "add", resolveSeq.YAMLMap.prototype.add.bind(this));
- PlainValue._defineProperty(this, "delete", resolveSeq.YAMLMap.prototype.delete.bind(this));
- PlainValue._defineProperty(this, "get", resolveSeq.YAMLMap.prototype.get.bind(this));
- PlainValue._defineProperty(this, "has", resolveSeq.YAMLMap.prototype.has.bind(this));
- PlainValue._defineProperty(this, "set", resolveSeq.YAMLMap.prototype.set.bind(this));
- this.tag = _YAMLOMap.tag;
- }
- toJSON(_2, ctx) {
- const map = /* @__PURE__ */ new Map();
- if (ctx && ctx.onCreate) ctx.onCreate(map);
- for (const pair of this.items) {
- let key, value;
- if (pair instanceof resolveSeq.Pair) {
- key = resolveSeq.toJSON(pair.key, "", ctx);
- value = resolveSeq.toJSON(pair.value, key, ctx);
- } else {
- key = resolveSeq.toJSON(pair, "", ctx);
- }
- if (map.has(key)) throw new Error("Ordered maps must not include duplicate keys");
- map.set(key, value);
- }
- return map;
- }
- };
- PlainValue._defineProperty(YAMLOMap, "tag", "tag:yaml.org,2002:omap");
- function parseOMap(doc, cst) {
- const pairs2 = parsePairs(doc, cst);
- const seenKeys = [];
- for (const {
- key
- } of pairs2.items) {
- if (key instanceof resolveSeq.Scalar) {
- if (seenKeys.includes(key.value)) {
- const msg = "Ordered maps must not include duplicate keys";
- throw new PlainValue.YAMLSemanticError(cst, msg);
- } else {
- seenKeys.push(key.value);
- }
- }
- }
- return Object.assign(new YAMLOMap(), pairs2);
- }
- function createOMap(schema2, iterable, ctx) {
- const pairs2 = createPairs(schema2, iterable, ctx);
- const omap2 = new YAMLOMap();
- omap2.items = pairs2.items;
- return omap2;
- }
- var omap = {
- identify: (value) => value instanceof Map,
- nodeClass: YAMLOMap,
- default: false,
- tag: "tag:yaml.org,2002:omap",
- resolve: parseOMap,
- createNode: createOMap
- };
- var YAMLSet = class _YAMLSet extends resolveSeq.YAMLMap {
- constructor() {
- super();
- this.tag = _YAMLSet.tag;
- }
- add(key) {
- const pair = key instanceof resolveSeq.Pair ? key : new resolveSeq.Pair(key);
- const prev = resolveSeq.findPair(this.items, pair.key);
- if (!prev) this.items.push(pair);
- }
- get(key, keepPair) {
- const pair = resolveSeq.findPair(this.items, key);
- return !keepPair && pair instanceof resolveSeq.Pair ? pair.key instanceof resolveSeq.Scalar ? pair.key.value : pair.key : pair;
- }
- set(key, value) {
- if (typeof value !== "boolean") throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof value}`);
- const prev = resolveSeq.findPair(this.items, key);
- if (prev && !value) {
- this.items.splice(this.items.indexOf(prev), 1);
- } else if (!prev && value) {
- this.items.push(new resolveSeq.Pair(key));
- }
- }
- toJSON(_2, ctx) {
- return super.toJSON(_2, ctx, Set);
- }
- toString(ctx, onComment, onChompKeep) {
- if (!ctx) return JSON.stringify(this);
- if (this.hasAllNullValues()) return super.toString(ctx, onComment, onChompKeep);
- else throw new Error("Set items must all have null values");
- }
- };
- PlainValue._defineProperty(YAMLSet, "tag", "tag:yaml.org,2002:set");
- function parseSet(doc, cst) {
- const map = resolveSeq.resolveMap(doc, cst);
- if (!map.hasAllNullValues()) throw new PlainValue.YAMLSemanticError(cst, "Set items must all have null values");
- return Object.assign(new YAMLSet(), map);
- }
- function createSet(schema2, iterable, ctx) {
- const set2 = new YAMLSet();
- for (const value of iterable) set2.items.push(schema2.createPair(value, null, ctx));
- return set2;
- }
- var set = {
- identify: (value) => value instanceof Set,
- nodeClass: YAMLSet,
- default: false,
- tag: "tag:yaml.org,2002:set",
- resolve: parseSet,
- createNode: createSet
- };
- var parseSexagesimal = (sign, parts) => {
- const n = parts.split(":").reduce((n2, p) => n2 * 60 + Number(p), 0);
- return sign === "-" ? -n : n;
- };
- var stringifySexagesimal = ({
- value
- }) => {
- if (isNaN(value) || !isFinite(value)) return resolveSeq.stringifyNumber(value);
- let sign = "";
- if (value < 0) {
- sign = "-";
- value = Math.abs(value);
- }
- const parts = [value % 60];
- if (value < 60) {
- parts.unshift(0);
- } else {
- value = Math.round((value - parts[0]) / 60);
- parts.unshift(value % 60);
- if (value >= 60) {
- value = Math.round((value - parts[0]) / 60);
- parts.unshift(value);
- }
- }
- return sign + parts.map((n) => n < 10 ? "0" + String(n) : String(n)).join(":").replace(/000000\d*$/, "");
- };
- var intTime = {
- identify: (value) => typeof value === "number",
- default: true,
- tag: "tag:yaml.org,2002:int",
- format: "TIME",
- test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+)$/,
- resolve: (str, sign, parts) => parseSexagesimal(sign, parts.replace(/_/g, "")),
- stringify: stringifySexagesimal
- };
- var floatTime = {
- identify: (value) => typeof value === "number",
- default: true,
- tag: "tag:yaml.org,2002:float",
- format: "TIME",
- test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*)$/,
- resolve: (str, sign, parts) => parseSexagesimal(sign, parts.replace(/_/g, "")),
- stringify: stringifySexagesimal
- };
- var timestamp = {
- identify: (value) => value instanceof Date,
- default: true,
- tag: "tag:yaml.org,2002:timestamp",
- // If the time zone is omitted, the timestamp is assumed to be specified in UTC. The time part
- // may be omitted altogether, resulting in a date format. In such a case, the time part is
- // assumed to be 00:00:00Z (start of day, UTC).
- test: RegExp("^(?:([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?)$"),
- resolve: (str, year, month, day, hour, minute, second, millisec, tz) => {
- if (millisec) millisec = (millisec + "00").substr(1, 3);
- let date = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec || 0);
- if (tz && tz !== "Z") {
- let d = parseSexagesimal(tz[0], tz.slice(1));
- if (Math.abs(d) < 30) d *= 60;
- date -= 6e4 * d;
- }
- return new Date(date);
- },
- stringify: ({
- value
- }) => value.toISOString().replace(/((T00:00)?:00)?\.000Z$/, "")
- };
- function shouldWarn(deprecation) {
- const env = typeof process !== "undefined" && process.env || {};
- if (deprecation) {
- if (typeof YAML_SILENCE_DEPRECATION_WARNINGS !== "undefined") return !YAML_SILENCE_DEPRECATION_WARNINGS;
- return !env.YAML_SILENCE_DEPRECATION_WARNINGS;
- }
- if (typeof YAML_SILENCE_WARNINGS !== "undefined") return !YAML_SILENCE_WARNINGS;
- return !env.YAML_SILENCE_WARNINGS;
- }
- function warn(warning, type) {
- if (shouldWarn(false)) {
- const emit = typeof process !== "undefined" && process.emitWarning;
- if (emit) emit(warning, type);
- else {
- console.warn(type ? `${type}: ${warning}` : warning);
- }
- }
- }
- function warnFileDeprecation(filename) {
- if (shouldWarn(true)) {
- const path = filename.replace(/.*yaml[/\\]/i, "").replace(/\.js$/, "").replace(/\\/g, "/");
- warn(`The endpoint 'yaml/${path}' will be removed in a future release.`, "DeprecationWarning");
- }
- }
- var warned = {};
- function warnOptionDeprecation(name, alternative) {
- if (!warned[name] && shouldWarn(true)) {
- warned[name] = true;
- let msg = `The option '${name}' will be removed in a future release`;
- msg += alternative ? `, use '${alternative}' instead.` : ".";
- warn(msg, "DeprecationWarning");
- }
- }
- exports2.binary = binary;
- exports2.floatTime = floatTime;
- exports2.intTime = intTime;
- exports2.omap = omap;
- exports2.pairs = pairs;
- exports2.set = set;
- exports2.timestamp = timestamp;
- exports2.warn = warn;
- exports2.warnFileDeprecation = warnFileDeprecation;
- exports2.warnOptionDeprecation = warnOptionDeprecation;
- }
-});
-
-// ../../node_modules/oas-resolver-browser/node_modules/yaml/dist/Schema-88e323a7.js
-var require_Schema_88e323a7 = __commonJS({
- "../../node_modules/oas-resolver-browser/node_modules/yaml/dist/Schema-88e323a7.js"(exports2) {
- "use strict";
- var PlainValue = require_PlainValue_ec8e588e();
- var resolveSeq = require_resolveSeq_d03cb037();
- var warnings = require_warnings_1000a372();
- function createMap(schema2, obj, ctx) {
- const map2 = new resolveSeq.YAMLMap(schema2);
- if (obj instanceof Map) {
- for (const [key, value] of obj) map2.items.push(schema2.createPair(key, value, ctx));
- } else if (obj && typeof obj === "object") {
- for (const key of Object.keys(obj)) map2.items.push(schema2.createPair(key, obj[key], ctx));
- }
- if (typeof schema2.sortMapEntries === "function") {
- map2.items.sort(schema2.sortMapEntries);
- }
- return map2;
- }
- var map = {
- createNode: createMap,
- default: true,
- nodeClass: resolveSeq.YAMLMap,
- tag: "tag:yaml.org,2002:map",
- resolve: resolveSeq.resolveMap
- };
- function createSeq(schema2, obj, ctx) {
- const seq2 = new resolveSeq.YAMLSeq(schema2);
- if (obj && obj[Symbol.iterator]) {
- for (const it of obj) {
- const v = schema2.createNode(it, ctx.wrapScalars, null, ctx);
- seq2.items.push(v);
- }
- }
- return seq2;
- }
- var seq = {
- createNode: createSeq,
- default: true,
- nodeClass: resolveSeq.YAMLSeq,
- tag: "tag:yaml.org,2002:seq",
- resolve: resolveSeq.resolveSeq
- };
- var string = {
- identify: (value) => typeof value === "string",
- default: true,
- tag: "tag:yaml.org,2002:str",
- resolve: resolveSeq.resolveString,
- stringify(item, ctx, onComment, onChompKeep) {
- ctx = Object.assign({
- actualString: true
- }, ctx);
- return resolveSeq.stringifyString(item, ctx, onComment, onChompKeep);
- },
- options: resolveSeq.strOptions
- };
- var failsafe = [map, seq, string];
- var intIdentify$2 = (value) => typeof value === "bigint" || Number.isInteger(value);
- var intResolve$1 = (src, part, radix) => resolveSeq.intOptions.asBigInt ? BigInt(src) : parseInt(part, radix);
- function intStringify$1(node, radix, prefix) {
- const {
- value
- } = node;
- if (intIdentify$2(value) && value >= 0) return prefix + value.toString(radix);
- return resolveSeq.stringifyNumber(node);
- }
- var nullObj = {
- identify: (value) => value == null,
- createNode: (schema2, value, ctx) => ctx.wrapScalars ? new resolveSeq.Scalar(null) : null,
- default: true,
- tag: "tag:yaml.org,2002:null",
- test: /^(?:~|[Nn]ull|NULL)?$/,
- resolve: () => null,
- options: resolveSeq.nullOptions,
- stringify: () => resolveSeq.nullOptions.nullStr
- };
- var boolObj = {
- identify: (value) => typeof value === "boolean",
- default: true,
- tag: "tag:yaml.org,2002:bool",
- test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
- resolve: (str) => str[0] === "t" || str[0] === "T",
- options: resolveSeq.boolOptions,
- stringify: ({
- value
- }) => value ? resolveSeq.boolOptions.trueStr : resolveSeq.boolOptions.falseStr
- };
- var octObj = {
- identify: (value) => intIdentify$2(value) && value >= 0,
- default: true,
- tag: "tag:yaml.org,2002:int",
- format: "OCT",
- test: /^0o([0-7]+)$/,
- resolve: (str, oct) => intResolve$1(str, oct, 8),
- options: resolveSeq.intOptions,
- stringify: (node) => intStringify$1(node, 8, "0o")
- };
- var intObj = {
- identify: intIdentify$2,
- default: true,
- tag: "tag:yaml.org,2002:int",
- test: /^[-+]?[0-9]+$/,
- resolve: (str) => intResolve$1(str, str, 10),
- options: resolveSeq.intOptions,
- stringify: resolveSeq.stringifyNumber
- };
- var hexObj = {
- identify: (value) => intIdentify$2(value) && value >= 0,
- default: true,
- tag: "tag:yaml.org,2002:int",
- format: "HEX",
- test: /^0x([0-9a-fA-F]+)$/,
- resolve: (str, hex) => intResolve$1(str, hex, 16),
- options: resolveSeq.intOptions,
- stringify: (node) => intStringify$1(node, 16, "0x")
- };
- var nanObj = {
- identify: (value) => typeof value === "number",
- default: true,
- tag: "tag:yaml.org,2002:float",
- test: /^(?:[-+]?\.inf|(\.nan))$/i,
- resolve: (str, nan) => nan ? NaN : str[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
- stringify: resolveSeq.stringifyNumber
- };
- var expObj = {
- identify: (value) => typeof value === "number",
- default: true,
- tag: "tag:yaml.org,2002:float",
- format: "EXP",
- test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
- resolve: (str) => parseFloat(str),
- stringify: ({
- value
- }) => Number(value).toExponential()
- };
- var floatObj = {
- identify: (value) => typeof value === "number",
- default: true,
- tag: "tag:yaml.org,2002:float",
- test: /^[-+]?(?:\.([0-9]+)|[0-9]+\.([0-9]*))$/,
- resolve(str, frac1, frac2) {
- const frac = frac1 || frac2;
- const node = new resolveSeq.Scalar(parseFloat(str));
- if (frac && frac[frac.length - 1] === "0") node.minFractionDigits = frac.length;
- return node;
- },
- stringify: resolveSeq.stringifyNumber
- };
- var core = failsafe.concat([nullObj, boolObj, octObj, intObj, hexObj, nanObj, expObj, floatObj]);
- var intIdentify$1 = (value) => typeof value === "bigint" || Number.isInteger(value);
- var stringifyJSON = ({
- value
- }) => JSON.stringify(value);
- var json = [map, seq, {
- identify: (value) => typeof value === "string",
- default: true,
- tag: "tag:yaml.org,2002:str",
- resolve: resolveSeq.resolveString,
- stringify: stringifyJSON
- }, {
- identify: (value) => value == null,
- createNode: (schema2, value, ctx) => ctx.wrapScalars ? new resolveSeq.Scalar(null) : null,
- default: true,
- tag: "tag:yaml.org,2002:null",
- test: /^null$/,
- resolve: () => null,
- stringify: stringifyJSON
- }, {
- identify: (value) => typeof value === "boolean",
- default: true,
- tag: "tag:yaml.org,2002:bool",
- test: /^true|false$/,
- resolve: (str) => str === "true",
- stringify: stringifyJSON
- }, {
- identify: intIdentify$1,
- default: true,
- tag: "tag:yaml.org,2002:int",
- test: /^-?(?:0|[1-9][0-9]*)$/,
- resolve: (str) => resolveSeq.intOptions.asBigInt ? BigInt(str) : parseInt(str, 10),
- stringify: ({
- value
- }) => intIdentify$1(value) ? value.toString() : JSON.stringify(value)
- }, {
- identify: (value) => typeof value === "number",
- default: true,
- tag: "tag:yaml.org,2002:float",
- test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
- resolve: (str) => parseFloat(str),
- stringify: stringifyJSON
- }];
- json.scalarFallback = (str) => {
- throw new SyntaxError(`Unresolved plain scalar ${JSON.stringify(str)}`);
- };
- var boolStringify = ({
- value
- }) => value ? resolveSeq.boolOptions.trueStr : resolveSeq.boolOptions.falseStr;
- var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
- function intResolve(sign, src, radix) {
- let str = src.replace(/_/g, "");
- if (resolveSeq.intOptions.asBigInt) {
- switch (radix) {
- case 2:
- str = `0b${str}`;
- break;
- case 8:
- str = `0o${str}`;
- break;
- case 16:
- str = `0x${str}`;
- break;
- }
- const n2 = BigInt(str);
- return sign === "-" ? BigInt(-1) * n2 : n2;
- }
- const n = parseInt(str, radix);
- return sign === "-" ? -1 * n : n;
- }
- function intStringify(node, radix, prefix) {
- const {
- value
- } = node;
- if (intIdentify(value)) {
- const str = value.toString(radix);
- return value < 0 ? "-" + prefix + str.substr(1) : prefix + str;
- }
- return resolveSeq.stringifyNumber(node);
- }
- var yaml11 = failsafe.concat([{
- identify: (value) => value == null,
- createNode: (schema2, value, ctx) => ctx.wrapScalars ? new resolveSeq.Scalar(null) : null,
- default: true,
- tag: "tag:yaml.org,2002:null",
- test: /^(?:~|[Nn]ull|NULL)?$/,
- resolve: () => null,
- options: resolveSeq.nullOptions,
- stringify: () => resolveSeq.nullOptions.nullStr
- }, {
- identify: (value) => typeof value === "boolean",
- default: true,
- tag: "tag:yaml.org,2002:bool",
- test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
- resolve: () => true,
- options: resolveSeq.boolOptions,
- stringify: boolStringify
- }, {
- identify: (value) => typeof value === "boolean",
- default: true,
- tag: "tag:yaml.org,2002:bool",
- test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,
- resolve: () => false,
- options: resolveSeq.boolOptions,
- stringify: boolStringify
- }, {
- identify: intIdentify,
- default: true,
- tag: "tag:yaml.org,2002:int",
- format: "BIN",
- test: /^([-+]?)0b([0-1_]+)$/,
- resolve: (str, sign, bin) => intResolve(sign, bin, 2),
- stringify: (node) => intStringify(node, 2, "0b")
- }, {
- identify: intIdentify,
- default: true,
- tag: "tag:yaml.org,2002:int",
- format: "OCT",
- test: /^([-+]?)0([0-7_]+)$/,
- resolve: (str, sign, oct) => intResolve(sign, oct, 8),
- stringify: (node) => intStringify(node, 8, "0")
- }, {
- identify: intIdentify,
- default: true,
- tag: "tag:yaml.org,2002:int",
- test: /^([-+]?)([0-9][0-9_]*)$/,
- resolve: (str, sign, abs) => intResolve(sign, abs, 10),
- stringify: resolveSeq.stringifyNumber
- }, {
- identify: intIdentify,
- default: true,
- tag: "tag:yaml.org,2002:int",
- format: "HEX",
- test: /^([-+]?)0x([0-9a-fA-F_]+)$/,
- resolve: (str, sign, hex) => intResolve(sign, hex, 16),
- stringify: (node) => intStringify(node, 16, "0x")
- }, {
- identify: (value) => typeof value === "number",
- default: true,
- tag: "tag:yaml.org,2002:float",
- test: /^(?:[-+]?\.inf|(\.nan))$/i,
- resolve: (str, nan) => nan ? NaN : str[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
- stringify: resolveSeq.stringifyNumber
- }, {
- identify: (value) => typeof value === "number",
- default: true,
- tag: "tag:yaml.org,2002:float",
- format: "EXP",
- test: /^[-+]?([0-9][0-9_]*)?(\.[0-9_]*)?[eE][-+]?[0-9]+$/,
- resolve: (str) => parseFloat(str.replace(/_/g, "")),
- stringify: ({
- value
- }) => Number(value).toExponential()
- }, {
- identify: (value) => typeof value === "number",
- default: true,
- tag: "tag:yaml.org,2002:float",
- test: /^[-+]?(?:[0-9][0-9_]*)?\.([0-9_]*)$/,
- resolve(str, frac) {
- const node = new resolveSeq.Scalar(parseFloat(str.replace(/_/g, "")));
- if (frac) {
- const f = frac.replace(/_/g, "");
- if (f[f.length - 1] === "0") node.minFractionDigits = f.length;
- }
- return node;
- },
- stringify: resolveSeq.stringifyNumber
- }], warnings.binary, warnings.omap, warnings.pairs, warnings.set, warnings.intTime, warnings.floatTime, warnings.timestamp);
- var schemas = {
- core,
- failsafe,
- json,
- yaml11
- };
- var tags = {
- binary: warnings.binary,
- bool: boolObj,
- float: floatObj,
- floatExp: expObj,
- floatNaN: nanObj,
- floatTime: warnings.floatTime,
- int: intObj,
- intHex: hexObj,
- intOct: octObj,
- intTime: warnings.intTime,
- map,
- null: nullObj,
- omap: warnings.omap,
- pairs: warnings.pairs,
- seq,
- set: warnings.set,
- timestamp: warnings.timestamp
- };
- function findTagObject(value, tagName, tags2) {
- if (tagName) {
- const match = tags2.filter((t) => t.tag === tagName);
- const tagObj = match.find((t) => !t.format) || match[0];
- if (!tagObj) throw new Error(`Tag ${tagName} not found`);
- return tagObj;
- }
- return tags2.find((t) => (t.identify && t.identify(value) || t.class && value instanceof t.class) && !t.format);
- }
- function createNode(value, tagName, ctx) {
- if (value instanceof resolveSeq.Node) return value;
- const {
- defaultPrefix,
- onTagObj,
- prevObjects,
- schema: schema2,
- wrapScalars
- } = ctx;
- if (tagName && tagName.startsWith("!!")) tagName = defaultPrefix + tagName.slice(2);
- let tagObj = findTagObject(value, tagName, schema2.tags);
- if (!tagObj) {
- if (typeof value.toJSON === "function") value = value.toJSON();
- if (!value || typeof value !== "object") return wrapScalars ? new resolveSeq.Scalar(value) : value;
- tagObj = value instanceof Map ? map : value[Symbol.iterator] ? seq : map;
- }
- if (onTagObj) {
- onTagObj(tagObj);
- delete ctx.onTagObj;
- }
- const obj = {
- value: void 0,
- node: void 0
- };
- if (value && typeof value === "object" && prevObjects) {
- const prev = prevObjects.get(value);
- if (prev) {
- const alias = new resolveSeq.Alias(prev);
- ctx.aliasNodes.push(alias);
- return alias;
- }
- obj.value = value;
- prevObjects.set(value, obj);
- }
- obj.node = tagObj.createNode ? tagObj.createNode(ctx.schema, value, ctx) : wrapScalars ? new resolveSeq.Scalar(value) : value;
- if (tagName && obj.node instanceof resolveSeq.Node) obj.node.tag = tagName;
- return obj.node;
- }
- function getSchemaTags(schemas2, knownTags, customTags, schemaId) {
- let tags2 = schemas2[schemaId.replace(/\W/g, "")];
- if (!tags2) {
- const keys = Object.keys(schemas2).map((key) => JSON.stringify(key)).join(", ");
- throw new Error(`Unknown schema "${schemaId}"; use one of ${keys}`);
- }
- if (Array.isArray(customTags)) {
- for (const tag of customTags) tags2 = tags2.concat(tag);
- } else if (typeof customTags === "function") {
- tags2 = customTags(tags2.slice());
- }
- for (let i = 0; i < tags2.length; ++i) {
- const tag = tags2[i];
- if (typeof tag === "string") {
- const tagObj = knownTags[tag];
- if (!tagObj) {
- const keys = Object.keys(knownTags).map((key) => JSON.stringify(key)).join(", ");
- throw new Error(`Unknown custom tag "${tag}"; use one of ${keys}`);
- }
- tags2[i] = tagObj;
- }
- }
- return tags2;
- }
- var sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
- var Schema = class _Schema {
- // TODO: remove in v2
- // TODO: remove in v2
- constructor({
- customTags,
- merge,
- schema: schema2,
- sortMapEntries,
- tags: deprecatedCustomTags
- }) {
- this.merge = !!merge;
- this.name = schema2;
- this.sortMapEntries = sortMapEntries === true ? sortMapEntriesByKey : sortMapEntries || null;
- if (!customTags && deprecatedCustomTags) warnings.warnOptionDeprecation("tags", "customTags");
- this.tags = getSchemaTags(schemas, tags, customTags || deprecatedCustomTags, schema2);
- }
- createNode(value, wrapScalars, tagName, ctx) {
- const baseCtx = {
- defaultPrefix: _Schema.defaultPrefix,
- schema: this,
- wrapScalars
- };
- const createCtx = ctx ? Object.assign(ctx, baseCtx) : baseCtx;
- return createNode(value, tagName, createCtx);
- }
- createPair(key, value, ctx) {
- if (!ctx) ctx = {
- wrapScalars: true
- };
- const k = this.createNode(key, ctx.wrapScalars, null, ctx);
- const v = this.createNode(value, ctx.wrapScalars, null, ctx);
- return new resolveSeq.Pair(k, v);
- }
- };
- PlainValue._defineProperty(Schema, "defaultPrefix", PlainValue.defaultTagPrefix);
- PlainValue._defineProperty(Schema, "defaultTags", PlainValue.defaultTags);
- exports2.Schema = Schema;
- }
-});
-
-// ../../node_modules/oas-resolver-browser/node_modules/yaml/dist/Document-9b4560a1.js
-var require_Document_9b4560a1 = __commonJS({
- "../../node_modules/oas-resolver-browser/node_modules/yaml/dist/Document-9b4560a1.js"(exports2) {
- "use strict";
- var PlainValue = require_PlainValue_ec8e588e();
- var resolveSeq = require_resolveSeq_d03cb037();
- var Schema = require_Schema_88e323a7();
- var defaultOptions = {
- anchorPrefix: "a",
- customTags: null,
- indent: 2,
- indentSeq: true,
- keepCstNodes: false,
- keepNodeTypes: true,
- keepBlobsInJSON: true,
- mapAsMap: false,
- maxAliasCount: 100,
- prettyErrors: false,
- // TODO Set true in v2
- simpleKeys: false,
- version: "1.2"
- };
- var scalarOptions = {
- get binary() {
- return resolveSeq.binaryOptions;
- },
- set binary(opt) {
- Object.assign(resolveSeq.binaryOptions, opt);
- },
- get bool() {
- return resolveSeq.boolOptions;
- },
- set bool(opt) {
- Object.assign(resolveSeq.boolOptions, opt);
- },
- get int() {
- return resolveSeq.intOptions;
- },
- set int(opt) {
- Object.assign(resolveSeq.intOptions, opt);
- },
- get null() {
- return resolveSeq.nullOptions;
- },
- set null(opt) {
- Object.assign(resolveSeq.nullOptions, opt);
- },
- get str() {
- return resolveSeq.strOptions;
- },
- set str(opt) {
- Object.assign(resolveSeq.strOptions, opt);
- }
- };
- var documentOptions = {
- "1.0": {
- schema: "yaml-1.1",
- merge: true,
- tagPrefixes: [{
- handle: "!",
- prefix: PlainValue.defaultTagPrefix
- }, {
- handle: "!!",
- prefix: "tag:private.yaml.org,2002:"
- }]
- },
- 1.1: {
- schema: "yaml-1.1",
- merge: true,
- tagPrefixes: [{
- handle: "!",
- prefix: "!"
- }, {
- handle: "!!",
- prefix: PlainValue.defaultTagPrefix
- }]
- },
- 1.2: {
- schema: "core",
- merge: false,
- tagPrefixes: [{
- handle: "!",
- prefix: "!"
- }, {
- handle: "!!",
- prefix: PlainValue.defaultTagPrefix
- }]
- }
- };
- function stringifyTag(doc, tag) {
- if ((doc.version || doc.options.version) === "1.0") {
- const priv = tag.match(/^tag:private\.yaml\.org,2002:([^:/]+)$/);
- if (priv) return "!" + priv[1];
- const vocab = tag.match(/^tag:([a-zA-Z0-9-]+)\.yaml\.org,2002:(.*)/);
- return vocab ? `!${vocab[1]}/${vocab[2]}` : `!${tag.replace(/^tag:/, "")}`;
- }
- let p = doc.tagPrefixes.find((p2) => tag.indexOf(p2.prefix) === 0);
- if (!p) {
- const dtp = doc.getDefaults().tagPrefixes;
- p = dtp && dtp.find((p2) => tag.indexOf(p2.prefix) === 0);
- }
- if (!p) return tag[0] === "!" ? tag : `!<${tag}>`;
- const suffix = tag.substr(p.prefix.length).replace(/[!,[\]{}]/g, (ch) => ({
- "!": "%21",
- ",": "%2C",
- "[": "%5B",
- "]": "%5D",
- "{": "%7B",
- "}": "%7D"
- })[ch]);
- return p.handle + suffix;
- }
- function getTagObject(tags, item) {
- if (item instanceof resolveSeq.Alias) return resolveSeq.Alias;
- if (item.tag) {
- const match = tags.filter((t) => t.tag === item.tag);
- if (match.length > 0) return match.find((t) => t.format === item.format) || match[0];
- }
- let tagObj, obj;
- if (item instanceof resolveSeq.Scalar) {
- obj = item.value;
- const match = tags.filter((t) => t.identify && t.identify(obj) || t.class && obj instanceof t.class);
- tagObj = match.find((t) => t.format === item.format) || match.find((t) => !t.format);
- } else {
- obj = item;
- tagObj = tags.find((t) => t.nodeClass && obj instanceof t.nodeClass);
- }
- if (!tagObj) {
- const name = obj && obj.constructor ? obj.constructor.name : typeof obj;
- throw new Error(`Tag not resolved for ${name} value`);
- }
- return tagObj;
- }
- function stringifyProps(node, tagObj, {
- anchors,
- doc
- }) {
- const props = [];
- const anchor = doc.anchors.getName(node);
- if (anchor) {
- anchors[anchor] = node;
- props.push(`&${anchor}`);
- }
- if (node.tag) {
- props.push(stringifyTag(doc, node.tag));
- } else if (!tagObj.default) {
- props.push(stringifyTag(doc, tagObj.tag));
- }
- return props.join(" ");
- }
- function stringify2(item, ctx, onComment, onChompKeep) {
- const {
- anchors,
- schema: schema2
- } = ctx.doc;
- let tagObj;
- if (!(item instanceof resolveSeq.Node)) {
- const createCtx = {
- aliasNodes: [],
- onTagObj: (o) => tagObj = o,
- prevObjects: /* @__PURE__ */ new Map()
- };
- item = schema2.createNode(item, true, null, createCtx);
- for (const alias of createCtx.aliasNodes) {
- alias.source = alias.source.node;
- let name = anchors.getName(alias.source);
- if (!name) {
- name = anchors.newName();
- anchors.map[name] = alias.source;
- }
- }
- }
- if (item instanceof resolveSeq.Pair) return item.toString(ctx, onComment, onChompKeep);
- if (!tagObj) tagObj = getTagObject(schema2.tags, item);
- const props = stringifyProps(item, tagObj, ctx);
- if (props.length > 0) ctx.indentAtStart = (ctx.indentAtStart || 0) + props.length + 1;
- const str = typeof tagObj.stringify === "function" ? tagObj.stringify(item, ctx, onComment, onChompKeep) : item instanceof resolveSeq.Scalar ? resolveSeq.stringifyString(item, ctx, onComment, onChompKeep) : item.toString(ctx, onComment, onChompKeep);
- if (!props) return str;
- return item instanceof resolveSeq.Scalar || str[0] === "{" || str[0] === "[" ? `${props} ${str}` : `${props}
-${ctx.indent}${str}`;
- }
- var Anchors = class _Anchors {
- static validAnchorNode(node) {
- return node instanceof resolveSeq.Scalar || node instanceof resolveSeq.YAMLSeq || node instanceof resolveSeq.YAMLMap;
- }
- constructor(prefix) {
- PlainValue._defineProperty(this, "map", /* @__PURE__ */ Object.create(null));
- this.prefix = prefix;
- }
- createAlias(node, name) {
- this.setAnchor(node, name);
- return new resolveSeq.Alias(node);
- }
- createMergePair(...sources) {
- const merge = new resolveSeq.Merge();
- merge.value.items = sources.map((s) => {
- if (s instanceof resolveSeq.Alias) {
- if (s.source instanceof resolveSeq.YAMLMap) return s;
- } else if (s instanceof resolveSeq.YAMLMap) {
- return this.createAlias(s);
- }
- throw new Error("Merge sources must be Map nodes or their Aliases");
- });
- return merge;
- }
- getName(node) {
- const {
- map
- } = this;
- return Object.keys(map).find((a) => map[a] === node);
- }
- getNames() {
- return Object.keys(this.map);
- }
- getNode(name) {
- return this.map[name];
- }
- newName(prefix) {
- if (!prefix) prefix = this.prefix;
- const names = Object.keys(this.map);
- for (let i = 1; true; ++i) {
- const name = `${prefix}${i}`;
- if (!names.includes(name)) return name;
- }
- }
- // During parsing, map & aliases contain CST nodes
- resolveNodes() {
- const {
- map,
- _cstAliases
- } = this;
- Object.keys(map).forEach((a) => {
- map[a] = map[a].resolved;
- });
- _cstAliases.forEach((a) => {
- a.source = a.source.resolved;
- });
- delete this._cstAliases;
- }
- setAnchor(node, name) {
- if (node != null && !_Anchors.validAnchorNode(node)) {
- throw new Error("Anchors may only be set for Scalar, Seq and Map nodes");
- }
- if (name && /[\x00-\x19\s,[\]{}]/.test(name)) {
- throw new Error("Anchor names must not contain whitespace or control characters");
- }
- const {
- map
- } = this;
- const prev = node && Object.keys(map).find((a) => map[a] === node);
- if (prev) {
- if (!name) {
- return prev;
- } else if (prev !== name) {
- delete map[prev];
- map[name] = node;
- }
- } else {
- if (!name) {
- if (!node) return null;
- name = this.newName();
- }
- map[name] = node;
- }
- return name;
- }
- };
- var visit = (node, tags) => {
- if (node && typeof node === "object") {
- const {
- tag
- } = node;
- if (node instanceof resolveSeq.Collection) {
- if (tag) tags[tag] = true;
- node.items.forEach((n) => visit(n, tags));
- } else if (node instanceof resolveSeq.Pair) {
- visit(node.key, tags);
- visit(node.value, tags);
- } else if (node instanceof resolveSeq.Scalar) {
- if (tag) tags[tag] = true;
- }
- }
- return tags;
- };
- var listTagNames = (node) => Object.keys(visit(node, {}));
- function parseContents(doc, contents) {
- const comments = {
- before: [],
- after: []
- };
- let body = void 0;
- let spaceBefore = false;
- for (const node of contents) {
- if (node.valueRange) {
- if (body !== void 0) {
- const msg = "Document contains trailing content not separated by a ... or --- line";
- doc.errors.push(new PlainValue.YAMLSyntaxError(node, msg));
- break;
- }
- const res = resolveSeq.resolveNode(doc, node);
- if (spaceBefore) {
- res.spaceBefore = true;
- spaceBefore = false;
- }
- body = res;
- } else if (node.comment !== null) {
- const cc = body === void 0 ? comments.before : comments.after;
- cc.push(node.comment);
- } else if (node.type === PlainValue.Type.BLANK_LINE) {
- spaceBefore = true;
- if (body === void 0 && comments.before.length > 0 && !doc.commentBefore) {
- doc.commentBefore = comments.before.join("\n");
- comments.before = [];
- }
- }
- }
- doc.contents = body || null;
- if (!body) {
- doc.comment = comments.before.concat(comments.after).join("\n") || null;
- } else {
- const cb = comments.before.join("\n");
- if (cb) {
- const cbNode = body instanceof resolveSeq.Collection && body.items[0] ? body.items[0] : body;
- cbNode.commentBefore = cbNode.commentBefore ? `${cb}
-${cbNode.commentBefore}` : cb;
- }
- doc.comment = comments.after.join("\n") || null;
- }
- }
- function resolveTagDirective({
- tagPrefixes
- }, directive) {
- const [handle, prefix] = directive.parameters;
- if (!handle || !prefix) {
- const msg = "Insufficient parameters given for %TAG directive";
- throw new PlainValue.YAMLSemanticError(directive, msg);
- }
- if (tagPrefixes.some((p) => p.handle === handle)) {
- const msg = "The %TAG directive must only be given at most once per handle in the same document.";
- throw new PlainValue.YAMLSemanticError(directive, msg);
- }
- return {
- handle,
- prefix
- };
- }
- function resolveYamlDirective(doc, directive) {
- let [version2] = directive.parameters;
- if (directive.name === "YAML:1.0") version2 = "1.0";
- if (!version2) {
- const msg = "Insufficient parameters given for %YAML directive";
- throw new PlainValue.YAMLSemanticError(directive, msg);
- }
- if (!documentOptions[version2]) {
- const v0 = doc.version || doc.options.version;
- const msg = `Document will be parsed as YAML ${v0} rather than YAML ${version2}`;
- doc.warnings.push(new PlainValue.YAMLWarning(directive, msg));
- }
- return version2;
- }
- function parseDirectives(doc, directives, prevDoc) {
- const directiveComments = [];
- let hasDirectives = false;
- for (const directive of directives) {
- const {
- comment,
- name
- } = directive;
- switch (name) {
- case "TAG":
- try {
- doc.tagPrefixes.push(resolveTagDirective(doc, directive));
- } catch (error) {
- doc.errors.push(error);
- }
- hasDirectives = true;
- break;
- case "YAML":
- case "YAML:1.0":
- if (doc.version) {
- const msg = "The %YAML directive must only be given at most once per document.";
- doc.errors.push(new PlainValue.YAMLSemanticError(directive, msg));
- }
- try {
- doc.version = resolveYamlDirective(doc, directive);
- } catch (error) {
- doc.errors.push(error);
- }
- hasDirectives = true;
- break;
- default:
- if (name) {
- const msg = `YAML only supports %TAG and %YAML directives, and not %${name}`;
- doc.warnings.push(new PlainValue.YAMLWarning(directive, msg));
- }
- }
- if (comment) directiveComments.push(comment);
- }
- if (prevDoc && !hasDirectives && "1.1" === (doc.version || prevDoc.version || doc.options.version)) {
- const copyTagPrefix = ({
- handle,
- prefix
- }) => ({
- handle,
- prefix
- });
- doc.tagPrefixes = prevDoc.tagPrefixes.map(copyTagPrefix);
- doc.version = prevDoc.version;
- }
- doc.commentBefore = directiveComments.join("\n") || null;
- }
- function assertCollection(contents) {
- if (contents instanceof resolveSeq.Collection) return true;
- throw new Error("Expected a YAML collection as document contents");
- }
- var Document = class _Document {
- constructor(options) {
- this.anchors = new Anchors(options.anchorPrefix);
- this.commentBefore = null;
- this.comment = null;
- this.contents = null;
- this.directivesEndMarker = null;
- this.errors = [];
- this.options = options;
- this.schema = null;
- this.tagPrefixes = [];
- this.version = null;
- this.warnings = [];
- }
- add(value) {
- assertCollection(this.contents);
- return this.contents.add(value);
- }
- addIn(path, value) {
- assertCollection(this.contents);
- this.contents.addIn(path, value);
- }
- delete(key) {
- assertCollection(this.contents);
- return this.contents.delete(key);
- }
- deleteIn(path) {
- if (resolveSeq.isEmptyPath(path)) {
- if (this.contents == null) return false;
- this.contents = null;
- return true;
- }
- assertCollection(this.contents);
- return this.contents.deleteIn(path);
- }
- getDefaults() {
- return _Document.defaults[this.version] || _Document.defaults[this.options.version] || {};
- }
- get(key, keepScalar) {
- return this.contents instanceof resolveSeq.Collection ? this.contents.get(key, keepScalar) : void 0;
- }
- getIn(path, keepScalar) {
- if (resolveSeq.isEmptyPath(path)) return !keepScalar && this.contents instanceof resolveSeq.Scalar ? this.contents.value : this.contents;
- return this.contents instanceof resolveSeq.Collection ? this.contents.getIn(path, keepScalar) : void 0;
- }
- has(key) {
- return this.contents instanceof resolveSeq.Collection ? this.contents.has(key) : false;
- }
- hasIn(path) {
- if (resolveSeq.isEmptyPath(path)) return this.contents !== void 0;
- return this.contents instanceof resolveSeq.Collection ? this.contents.hasIn(path) : false;
- }
- set(key, value) {
- assertCollection(this.contents);
- this.contents.set(key, value);
- }
- setIn(path, value) {
- if (resolveSeq.isEmptyPath(path)) this.contents = value;
- else {
- assertCollection(this.contents);
- this.contents.setIn(path, value);
- }
- }
- setSchema(id, customTags) {
- if (!id && !customTags && this.schema) return;
- if (typeof id === "number") id = id.toFixed(1);
- if (id === "1.0" || id === "1.1" || id === "1.2") {
- if (this.version) this.version = id;
- else this.options.version = id;
- delete this.options.schema;
- } else if (id && typeof id === "string") {
- this.options.schema = id;
- }
- if (Array.isArray(customTags)) this.options.customTags = customTags;
- const opt = Object.assign({}, this.getDefaults(), this.options);
- this.schema = new Schema.Schema(opt);
- }
- parse(node, prevDoc) {
- if (this.options.keepCstNodes) this.cstNode = node;
- if (this.options.keepNodeTypes) this.type = "DOCUMENT";
- const {
- directives = [],
- contents = [],
- directivesEndMarker,
- error,
- valueRange
- } = node;
- if (error) {
- if (!error.source) error.source = this;
- this.errors.push(error);
- }
- parseDirectives(this, directives, prevDoc);
- if (directivesEndMarker) this.directivesEndMarker = true;
- this.range = valueRange ? [valueRange.start, valueRange.end] : null;
- this.setSchema();
- this.anchors._cstAliases = [];
- parseContents(this, contents);
- this.anchors.resolveNodes();
- if (this.options.prettyErrors) {
- for (const error2 of this.errors) if (error2 instanceof PlainValue.YAMLError) error2.makePretty();
- for (const warn of this.warnings) if (warn instanceof PlainValue.YAMLError) warn.makePretty();
- }
- return this;
- }
- listNonDefaultTags() {
- return listTagNames(this.contents).filter((t) => t.indexOf(Schema.Schema.defaultPrefix) !== 0);
- }
- setTagPrefix(handle, prefix) {
- if (handle[0] !== "!" || handle[handle.length - 1] !== "!") throw new Error("Handle must start and end with !");
- if (prefix) {
- const prev = this.tagPrefixes.find((p) => p.handle === handle);
- if (prev) prev.prefix = prefix;
- else this.tagPrefixes.push({
- handle,
- prefix
- });
- } else {
- this.tagPrefixes = this.tagPrefixes.filter((p) => p.handle !== handle);
- }
- }
- toJSON(arg, onAnchor) {
- const {
- keepBlobsInJSON,
- mapAsMap,
- maxAliasCount
- } = this.options;
- const keep = keepBlobsInJSON && (typeof arg !== "string" || !(this.contents instanceof resolveSeq.Scalar));
- const ctx = {
- doc: this,
- indentStep: " ",
- keep,
- mapAsMap: keep && !!mapAsMap,
- maxAliasCount,
- stringify: stringify2
- // Requiring directly in Pair would create circular dependencies
- };
- const anchorNames = Object.keys(this.anchors.map);
- if (anchorNames.length > 0) ctx.anchors = new Map(anchorNames.map((name) => [this.anchors.map[name], {
- alias: [],
- aliasCount: 0,
- count: 1
- }]));
- const res = resolveSeq.toJSON(this.contents, arg, ctx);
- if (typeof onAnchor === "function" && ctx.anchors) for (const {
- count,
- res: res2
- } of ctx.anchors.values()) onAnchor(res2, count);
- return res;
- }
- toString() {
- if (this.errors.length > 0) throw new Error("Document with errors cannot be stringified");
- const indentSize = this.options.indent;
- if (!Number.isInteger(indentSize) || indentSize <= 0) {
- const s = JSON.stringify(indentSize);
- throw new Error(`"indent" option must be a positive integer, not ${s}`);
- }
- this.setSchema();
- const lines = [];
- let hasDirectives = false;
- if (this.version) {
- let vd = "%YAML 1.2";
- if (this.schema.name === "yaml-1.1") {
- if (this.version === "1.0") vd = "%YAML:1.0";
- else if (this.version === "1.1") vd = "%YAML 1.1";
- }
- lines.push(vd);
- hasDirectives = true;
- }
- const tagNames = this.listNonDefaultTags();
- this.tagPrefixes.forEach(({
- handle,
- prefix
- }) => {
- if (tagNames.some((t) => t.indexOf(prefix) === 0)) {
- lines.push(`%TAG ${handle} ${prefix}`);
- hasDirectives = true;
- }
- });
- if (hasDirectives || this.directivesEndMarker) lines.push("---");
- if (this.commentBefore) {
- if (hasDirectives || !this.directivesEndMarker) lines.unshift("");
- lines.unshift(this.commentBefore.replace(/^/gm, "#"));
- }
- const ctx = {
- anchors: /* @__PURE__ */ Object.create(null),
- doc: this,
- indent: "",
- indentStep: " ".repeat(indentSize),
- stringify: stringify2
- // Requiring directly in nodes would create circular dependencies
- };
- let chompKeep = false;
- let contentComment = null;
- if (this.contents) {
- if (this.contents instanceof resolveSeq.Node) {
- if (this.contents.spaceBefore && (hasDirectives || this.directivesEndMarker)) lines.push("");
- if (this.contents.commentBefore) lines.push(this.contents.commentBefore.replace(/^/gm, "#"));
- ctx.forceBlockIndent = !!this.comment;
- contentComment = this.contents.comment;
- }
- const onChompKeep = contentComment ? null : () => chompKeep = true;
- const body = stringify2(this.contents, ctx, () => contentComment = null, onChompKeep);
- lines.push(resolveSeq.addComment(body, "", contentComment));
- } else if (this.contents !== void 0) {
- lines.push(stringify2(this.contents, ctx));
- }
- if (this.comment) {
- if ((!chompKeep || contentComment) && lines[lines.length - 1] !== "") lines.push("");
- lines.push(this.comment.replace(/^/gm, "#"));
- }
- return lines.join("\n") + "\n";
- }
- };
- PlainValue._defineProperty(Document, "defaults", documentOptions);
- exports2.Document = Document;
- exports2.defaultOptions = defaultOptions;
- exports2.scalarOptions = scalarOptions;
- }
-});
-
-// ../../node_modules/oas-resolver-browser/node_modules/yaml/dist/index.js
-var require_dist = __commonJS({
- "../../node_modules/oas-resolver-browser/node_modules/yaml/dist/index.js"(exports2) {
- "use strict";
- var parseCst = require_parse_cst();
- var Document$1 = require_Document_9b4560a1();
- var Schema = require_Schema_88e323a7();
- var PlainValue = require_PlainValue_ec8e588e();
- var warnings = require_warnings_1000a372();
- require_resolveSeq_d03cb037();
- function createNode(value, wrapScalars = true, tag) {
- if (tag === void 0 && typeof wrapScalars === "string") {
- tag = wrapScalars;
- wrapScalars = true;
- }
- const options = Object.assign({}, Document$1.Document.defaults[Document$1.defaultOptions.version], Document$1.defaultOptions);
- const schema2 = new Schema.Schema(options);
- return schema2.createNode(value, wrapScalars, tag);
- }
- var Document = class extends Document$1.Document {
- constructor(options) {
- super(Object.assign({}, Document$1.defaultOptions, options));
- }
- };
- function parseAllDocuments(src, options) {
- const stream = [];
- let prev;
- for (const cstDoc of parseCst.parse(src)) {
- const doc = new Document(options);
- doc.parse(cstDoc, prev);
- stream.push(doc);
- prev = doc;
- }
- return stream;
- }
- function parseDocument(src, options) {
- const cst = parseCst.parse(src);
- const doc = new Document(options).parse(cst[0]);
- if (cst.length > 1) {
- const errMsg = "Source contains multiple documents; please use YAML.parseAllDocuments()";
- doc.errors.unshift(new PlainValue.YAMLSemanticError(cst[1], errMsg));
- }
- return doc;
- }
- function parse2(src, options) {
- const doc = parseDocument(src, options);
- doc.warnings.forEach((warning) => warnings.warn(warning));
- if (doc.errors.length > 0) throw doc.errors[0];
- return doc.toJSON();
- }
- function stringify2(value, options) {
- const doc = new Document(options);
- doc.contents = value;
- return String(doc);
- }
- var YAML = {
- createNode,
- defaultOptions: Document$1.defaultOptions,
- Document,
- parse: parse2,
- parseAllDocuments,
- parseCST: parseCst.parse,
- parseDocument,
- scalarOptions: Document$1.scalarOptions,
- stringify: stringify2
- };
- exports2.YAML = YAML;
- }
-});
-
-// ../../node_modules/oas-resolver-browser/node_modules/yaml/index.js
-var require_yaml = __commonJS({
- "../../node_modules/oas-resolver-browser/node_modules/yaml/index.js"(exports2, module2) {
- module2.exports = require_dist().YAML;
- }
-});
-
-// ../../node_modules/reftools/lib/jptr.js
-var require_jptr = __commonJS({
- "../../node_modules/reftools/lib/jptr.js"(exports2, module2) {
- "use strict";
- function jpescape(s) {
- return s.replace(/\~/g, "~0").replace(/\//g, "~1");
- }
- function jpunescape(s) {
- return s.replace(/\~1/g, "/").replace(/~0/g, "~");
- }
- function jptr(obj, prop, newValue) {
- if (typeof obj === "undefined") return false;
- if (!prop || typeof prop !== "string" || prop === "#") return typeof newValue !== "undefined" ? newValue : obj;
- if (prop.indexOf("#") >= 0) {
- let parts = prop.split("#");
- let uri = parts[0];
- if (uri) return false;
- prop = parts[1];
- prop = decodeURIComponent(prop.slice(1).split("+").join(" "));
- }
- if (prop.startsWith("/")) prop = prop.slice(1);
- let components = prop.split("/");
- for (let i = 0; i < components.length; i++) {
- components[i] = jpunescape(components[i]);
- let setAndLast = typeof newValue !== "undefined" && i == components.length - 1;
- let index = parseInt(components[i], 10);
- if (!Array.isArray(obj) || isNaN(index) || index.toString() !== components[i]) {
- index = Array.isArray(obj) && components[i] === "-" ? -2 : -1;
- } else {
- components[i] = i > 0 ? components[i - 1] : "";
- }
- if (index != -1 || obj && obj.hasOwnProperty(components[i])) {
- if (index >= 0) {
- if (setAndLast) {
- obj[index] = newValue;
- }
- obj = obj[index];
- } else if (index === -2) {
- if (setAndLast) {
- if (Array.isArray(obj)) {
- obj.push(newValue);
- }
- return newValue;
- } else return void 0;
- } else {
- if (setAndLast) {
- obj[components[i]] = newValue;
- }
- obj = obj[components[i]];
- }
- } else {
- if (typeof newValue !== "undefined" && typeof obj === "object" && !Array.isArray(obj)) {
- obj[components[i]] = setAndLast ? newValue : components[i + 1] === "0" || components[i + 1] === "-" ? [] : {};
- obj = obj[components[i]];
- } else return false;
- }
- }
- return obj;
- }
- module2.exports = {
- jptr,
- jpescape,
- jpunescape
- };
- }
-});
-
-// ../../node_modules/reftools/lib/recurse.js
-var require_recurse = __commonJS({
- "../../node_modules/reftools/lib/recurse.js"(exports2, module2) {
- "use strict";
- var jpescape = require_jptr().jpescape;
- function defaultState() {
- return {
- path: "#",
- depth: 0,
- pkey: "",
- parent: {},
- payload: {},
- seen: /* @__PURE__ */ new WeakMap(),
- identity: false,
- identityDetection: false
- };
- }
- function recurse(object, state, callback) {
- if (!state) state = { depth: 0 };
- if (!state.depth) {
- state = Object.assign({}, defaultState(), state);
- }
- if (typeof object !== "object") return;
- let oPath = state.path;
- for (let key in object) {
- state.key = key;
- state.path = state.path + "/" + encodeURIComponent(jpescape(key));
- state.identityPath = state.seen.get(object[key]);
- state.identity = typeof state.identityPath !== "undefined";
- if (object.hasOwnProperty(key)) {
- callback(object, key, state);
- }
- if (typeof object[key] === "object" && !state.identity) {
- if (state.identityDetection && !Array.isArray(object[key]) && object[key] !== null) {
- state.seen.set(object[key], state.path);
- }
- let newState = {};
- newState.parent = object;
- newState.path = state.path;
- newState.depth = state.depth ? state.depth + 1 : 1;
- newState.pkey = key;
- newState.payload = state.payload;
- newState.seen = state.seen;
- newState.identity = false;
- newState.identityDetection = state.identityDetection;
- recurse(object[key], newState, callback);
- }
- state.path = oPath;
- }
- }
- module2.exports = {
- recurse
- };
- }
-});
-
-// ../../node_modules/reftools/lib/clone.js
-var require_clone = __commonJS({
- "../../node_modules/reftools/lib/clone.js"(exports2, module2) {
- "use strict";
- function nop(obj) {
- return obj;
- }
- function clone(obj) {
- return JSON.parse(JSON.stringify(obj));
- }
- function shallowClone(obj) {
- let result = {};
- for (let p in obj) {
- if (obj.hasOwnProperty(p)) {
- result[p] = obj[p];
- }
- }
- return result;
- }
- function deepClone(obj) {
- let result = Array.isArray(obj) ? [] : {};
- for (let p in obj) {
- if (obj.hasOwnProperty(p) || Array.isArray(obj)) {
- result[p] = typeof obj[p] === "object" ? deepClone(obj[p]) : obj[p];
- }
- }
- return result;
- }
- function fastClone(obj) {
- return Object.assign({}, obj);
- }
- function circularClone(obj, hash) {
- if (!hash) hash = /* @__PURE__ */ new WeakMap();
- if (Object(obj) !== obj || obj instanceof Function) return obj;
- if (hash.has(obj)) return hash.get(obj);
- try {
- var result = new obj.constructor();
- } catch (e) {
- result = Object.create(Object.getPrototypeOf(obj));
- }
- hash.set(obj, result);
- return Object.assign(result, ...Object.keys(obj).map(
- (key) => ({ [key]: circularClone(obj[key], hash) })
- ));
- }
- module2.exports = {
- nop,
- clone,
- shallowClone,
- deepClone,
- fastClone,
- circularClone
- };
- }
-});
-
-// ../../node_modules/reftools/lib/isref.js
-var require_isref = __commonJS({
- "../../node_modules/reftools/lib/isref.js"(exports2, module2) {
- "use strict";
- function isRef(obj, key) {
- return key === "$ref" && (!!obj && typeof obj[key] === "string");
- }
- module2.exports = {
- isRef
- };
- }
-});
-
-// ../../node_modules/reftools/lib/dereference.js
-var require_dereference = __commonJS({
- "../../node_modules/reftools/lib/dereference.js"(exports2, module2) {
- "use strict";
- var recurse = require_recurse().recurse;
- var clone = require_clone().shallowClone;
- var jptr = require_jptr().jptr;
- var isRef = require_isref().isRef;
- var getLogger = function(options) {
- if (options && options.verbose) {
- return {
- warn: function() {
- var args = Array.prototype.slice.call(arguments);
- console.warn.apply(console, args);
- }
- };
- } else {
- return {
- warn: function() {
- }
- };
- }
- };
- function dereference(o, definitions, options) {
- if (!options) options = {};
- if (!options.cache) options.cache = {};
- if (!options.state) options.state = {};
- options.state.identityDetection = true;
- options.depth = options.depth ? options.depth + 1 : 1;
- let obj = options.depth > 1 ? o : clone(o);
- let container = { data: obj };
- let defs = options.depth > 1 ? definitions : clone(definitions);
- if (!options.master) options.master = obj;
- let logger = getLogger(options);
- let changes = 1;
- while (changes > 0) {
- changes = 0;
- recurse(container, options.state, function(obj2, key, state) {
- if (isRef(obj2, key)) {
- let $ref = obj2[key];
- changes++;
- if (!options.cache[$ref]) {
- let entry = {};
- entry.path = state.path.split("/$ref")[0];
- entry.key = $ref;
- logger.warn("Dereffing %s at %s", $ref, entry.path);
- entry.source = defs;
- entry.data = jptr(entry.source, entry.key);
- if (entry.data === false) {
- entry.data = jptr(options.master, entry.key);
- entry.source = options.master;
- }
- if (entry.data === false) {
- logger.warn("Missing $ref target", entry.key);
- }
- options.cache[$ref] = entry;
- entry.data = state.parent[state.pkey] = dereference(jptr(entry.source, entry.key), entry.source, options);
- if (options.$ref && typeof state.parent[state.pkey] === "object" && state.parent[state.pkey] !== null) state.parent[state.pkey][options.$ref] = $ref;
- entry.resolved = true;
- } else {
- let entry = options.cache[$ref];
- if (entry.resolved) {
- logger.warn("Patching %s for %s", $ref, entry.path);
- state.parent[state.pkey] = entry.data;
- if (options.$ref && typeof state.parent[state.pkey] === "object" && state.parent[state.pkey] !== null) state.parent[state.pkey][options.$ref] = $ref;
- } else if ($ref === entry.path) {
- throw new Error(`Tight circle at ${entry.path}`);
- } else {
- logger.warn("Unresolved ref");
- state.parent[state.pkey] = jptr(entry.source, entry.path);
- if (state.parent[state.pkey] === false) {
- state.parent[state.pkey] = jptr(entry.source, entry.key);
- }
- if (options.$ref && typeof state.parent[state.pkey] === "object" && state.parent[state.pkey] !== null) state.parent[options.$ref] = $ref;
- }
- }
- }
- });
- }
- return container.data;
- }
- module2.exports = {
- dereference
- };
- }
-});
-
-// ../../node_modules/fast-safe-stringify/index.js
-var require_fast_safe_stringify = __commonJS({
- "../../node_modules/fast-safe-stringify/index.js"(exports2, module2) {
- module2.exports = stringify2;
- stringify2.default = stringify2;
- stringify2.stable = deterministicStringify;
- stringify2.stableStringify = deterministicStringify;
- var LIMIT_REPLACE_NODE = "[...]";
- var CIRCULAR_REPLACE_NODE = "[Circular]";
- var arr = [];
- var replacerStack = [];
- function defaultOptions() {
- return {
- depthLimit: Number.MAX_SAFE_INTEGER,
- edgesLimit: Number.MAX_SAFE_INTEGER
- };
- }
- function stringify2(obj, replacer, spacer, options) {
- if (typeof options === "undefined") {
- options = defaultOptions();
- }
- decirc(obj, "", 0, [], void 0, 0, options);
- var res;
- try {
- if (replacerStack.length === 0) {
- res = JSON.stringify(obj, replacer, spacer);
- } else {
- res = JSON.stringify(obj, replaceGetterValues(replacer), spacer);
- }
- } catch (_2) {
- return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]");
- } finally {
- while (arr.length !== 0) {
- var part = arr.pop();
- if (part.length === 4) {
- Object.defineProperty(part[0], part[1], part[3]);
- } else {
- part[0][part[1]] = part[2];
- }
- }
- }
- return res;
- }
- function setReplace(replace, val, k, parent) {
- var propertyDescriptor = Object.getOwnPropertyDescriptor(parent, k);
- if (propertyDescriptor.get !== void 0) {
- if (propertyDescriptor.configurable) {
- Object.defineProperty(parent, k, { value: replace });
- arr.push([parent, k, val, propertyDescriptor]);
- } else {
- replacerStack.push([val, k, replace]);
- }
- } else {
- parent[k] = replace;
- arr.push([parent, k, val]);
- }
- }
- function decirc(val, k, edgeIndex, stack, parent, depth, options) {
- depth += 1;
- var i;
- if (typeof val === "object" && val !== null) {
- for (i = 0; i < stack.length; i++) {
- if (stack[i] === val) {
- setReplace(CIRCULAR_REPLACE_NODE, val, k, parent);
- return;
- }
- }
- if (typeof options.depthLimit !== "undefined" && depth > options.depthLimit) {
- setReplace(LIMIT_REPLACE_NODE, val, k, parent);
- return;
- }
- if (typeof options.edgesLimit !== "undefined" && edgeIndex + 1 > options.edgesLimit) {
- setReplace(LIMIT_REPLACE_NODE, val, k, parent);
- return;
- }
- stack.push(val);
- if (Array.isArray(val)) {
- for (i = 0; i < val.length; i++) {
- decirc(val[i], i, i, stack, val, depth, options);
- }
- } else {
- var keys = Object.keys(val);
- for (i = 0; i < keys.length; i++) {
- var key = keys[i];
- decirc(val[key], key, i, stack, val, depth, options);
- }
- }
- stack.pop();
- }
- }
- function compareFunction(a, b) {
- if (a < b) {
- return -1;
- }
- if (a > b) {
- return 1;
- }
- return 0;
- }
- function deterministicStringify(obj, replacer, spacer, options) {
- if (typeof options === "undefined") {
- options = defaultOptions();
- }
- var tmp = deterministicDecirc(obj, "", 0, [], void 0, 0, options) || obj;
- var res;
- try {
- if (replacerStack.length === 0) {
- res = JSON.stringify(tmp, replacer, spacer);
- } else {
- res = JSON.stringify(tmp, replaceGetterValues(replacer), spacer);
- }
- } catch (_2) {
- return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]");
- } finally {
- while (arr.length !== 0) {
- var part = arr.pop();
- if (part.length === 4) {
- Object.defineProperty(part[0], part[1], part[3]);
- } else {
- part[0][part[1]] = part[2];
- }
- }
- }
- return res;
- }
- function deterministicDecirc(val, k, edgeIndex, stack, parent, depth, options) {
- depth += 1;
- var i;
- if (typeof val === "object" && val !== null) {
- for (i = 0; i < stack.length; i++) {
- if (stack[i] === val) {
- setReplace(CIRCULAR_REPLACE_NODE, val, k, parent);
- return;
- }
- }
- try {
- if (typeof val.toJSON === "function") {
- return;
- }
- } catch (_2) {
- return;
- }
- if (typeof options.depthLimit !== "undefined" && depth > options.depthLimit) {
- setReplace(LIMIT_REPLACE_NODE, val, k, parent);
- return;
- }
- if (typeof options.edgesLimit !== "undefined" && edgeIndex + 1 > options.edgesLimit) {
- setReplace(LIMIT_REPLACE_NODE, val, k, parent);
- return;
- }
- stack.push(val);
- if (Array.isArray(val)) {
- for (i = 0; i < val.length; i++) {
- deterministicDecirc(val[i], i, i, stack, val, depth, options);
- }
- } else {
- var tmp = {};
- var keys = Object.keys(val).sort(compareFunction);
- for (i = 0; i < keys.length; i++) {
- var key = keys[i];
- deterministicDecirc(val[key], key, i, stack, val, depth, options);
- tmp[key] = val[key];
- }
- if (typeof parent !== "undefined") {
- arr.push([parent, k, val]);
- parent[k] = tmp;
- } else {
- return tmp;
- }
- }
- stack.pop();
- }
- }
- function replaceGetterValues(replacer) {
- replacer = typeof replacer !== "undefined" ? replacer : function(k, v) {
- return v;
- };
- return function(key, val) {
- if (replacerStack.length > 0) {
- for (var i = 0; i < replacerStack.length; i++) {
- var part = replacerStack[i];
- if (part[1] === key && part[0] === val) {
- val = part[2];
- replacerStack.splice(i, 1);
- break;
- }
- }
- }
- return replacer.call(this, key, val);
- };
- }
- }
-});
-
-// ../../node_modules/oas-kit-common/index.js
-var require_oas_kit_common = __commonJS({
- "../../node_modules/oas-kit-common/index.js"(exports2, module2) {
- "use strict";
- var sjs = require_fast_safe_stringify();
- var colour = process.env.NODE_DISABLE_COLORS ? { red: "", yellow: "", green: "", normal: "" } : { red: "\x1B[31m", yellow: "\x1B[33;1m", green: "\x1B[32m", normal: "\x1B[0m" };
- function uniqueOnly(value, index, self2) {
- return self2.indexOf(value) === index;
- }
- function hasDuplicates(array) {
- return new Set(array).size !== array.length;
- }
- function allSame(array) {
- return new Set(array).size <= 1;
- }
- function deepEquals(obj1, obj2) {
- function _equals(obj12, obj22) {
- return sjs.stringify(obj12) === sjs.stringify(Object.assign({}, obj12, obj22));
- }
- return _equals(obj1, obj2) && _equals(obj2, obj1);
- }
- function compressArray(arr) {
- let result = [];
- for (let candidate of arr) {
- let dupe = result.find(function(e, i, a) {
- return deepEquals(e, candidate);
- });
- if (!dupe) result.push(candidate);
- }
- return result;
- }
- function distinctArray(arr) {
- return arr.length === compressArray(arr).length;
- }
- function firstDupe(arr) {
- return arr.find(function(e, i, a) {
- return arr.indexOf(e) < i;
- });
- }
- function hash(s) {
- let hash2 = 0;
- let chr;
- if (s.length === 0) return hash2;
- for (let i = 0; i < s.length; i++) {
- chr = s.charCodeAt(i);
- hash2 = (hash2 << 5) - hash2 + chr;
- hash2 |= 0;
- }
- return hash2;
- }
- String.prototype.toCamelCase = function camelize() {
- return this.toLowerCase().replace(/[-_ \/\.](.)/g, function(match, group1) {
- return group1.toUpperCase();
- });
- };
- var parameterTypeProperties = [
- "format",
- "minimum",
- "maximum",
- "exclusiveMinimum",
- "exclusiveMaximum",
- "minLength",
- "maxLength",
- "multipleOf",
- "minItems",
- "maxItems",
- "uniqueItems",
- "minProperties",
- "maxProperties",
- "additionalProperties",
- "pattern",
- "enum",
- "default"
- ];
- var arrayProperties = [
- "items",
- "minItems",
- "maxItems",
- "uniqueItems"
- ];
- var httpMethods = [
- "get",
- "post",
- "put",
- "delete",
- "patch",
- "head",
- "options",
- "trace"
- ];
- function sanitise(s) {
- s = s.replace("[]", "Array");
- let components = s.split("/");
- components[0] = components[0].replace(/[^A-Za-z0-9_\-\.]+|\s+/gm, "_");
- return components.join("/");
- }
- function sanitiseAll(s) {
- return sanitise(s.split("/").join("_"));
- }
- module2.exports = {
- colour,
- uniqueOnly,
- hasDuplicates,
- allSame,
- distinctArray,
- firstDupe,
- hash,
- parameterTypeProperties,
- arrayProperties,
- httpMethods,
- sanitise,
- sanitiseAll
- };
- }
-});
-
-// ../../node_modules/oas-resolver-browser/index.js
-var require_oas_resolver_browser = __commonJS({
- "../../node_modules/oas-resolver-browser/index.js"(exports2, module2) {
- "use strict";
- var fs = require("fs");
- var path = typeof process === "object" ? require("path") : require_path_browserify();
- var url = require("url");
- var fetch = require_lib2();
- var yaml = require_yaml();
- var jptr = require_jptr().jptr;
- var recurse = require_recurse().recurse;
- var clone = require_clone().clone;
- var deRef = require_dereference().dereference;
- var isRef = require_isref().isRef;
- var common = require_oas_kit_common();
- function unique(arr) {
- return [...new Set(arr)];
- }
- function readFileAsync(filename, encoding, options, pointer, def) {
- return new Promise(function(resolve2, reject) {
- let files = options.files || null;
- filename = decodeURI(filename);
- if (files) {
- if (files[filename]) {
- resolve2(files[filename]);
- } else {
- if (options.ignoreIOErrors && def) {
- if (options.verbose) console.warn("FAILED", pointer);
- options.externalRefs[pointer].failed = true;
- resolve2(def);
- } else {
- reject("Could not read file: " + filename);
- }
- }
- } else {
- fs.readFile(filename, encoding, function(err, data) {
- if (err) {
- if (options.ignoreIOErrors && def) {
- options.externalRefs[pointer].failed = true;
- resolve2(def);
- } else {
- reject(err);
- }
- } else {
- resolve2(data);
- }
- });
- }
- });
- }
- function resolveAllFragment(obj, context, src, parentPath, base, options) {
- let attachPoint = options.externalRefs[src + parentPath].paths[0];
- let baseUrl = url.parse(base);
- let seen = {};
- let changes = 1;
- while (changes) {
- changes = 0;
- recurse(obj, { identityDetection: true }, function(obj2, key, state) {
- if (isRef(obj2, key)) {
- if (obj2[key].startsWith("#")) {
- if (!seen[obj2[key]] && !obj2.$fixed) {
- let target = clone(jptr(context, obj2[key]));
- if (options.verbose > 1) console.warn((target === false ? common.colour.red : common.colour.green) + "Fragment resolution", obj2[key], common.colour.normal);
- if (target === false) {
- state.parent[state.pkey] = {};
- if (options.fatal) {
- let ex = new Error("Fragment $ref resolution failed " + obj2[key]);
- if (options.promise) options.promise.reject(ex);
- else throw ex;
- }
- } else {
- changes++;
- state.parent[state.pkey] = target;
- seen[obj2[key]] = state.path.replace("/%24ref", "");
- }
- } else {
- if (!obj2.$fixed) {
- let newRef = (attachPoint + "/" + seen[obj2[key]]).split("/#/").join("/");
- state.parent[state.pkey] = { $ref: newRef, "x-miro": obj2[key], $fixed: true };
- if (options.verbose > 1) console.warn("Replacing with", newRef);
- changes++;
- }
- }
- } else if (baseUrl.protocol) {
- let newRef = url.resolve(base, obj2[key]).toString();
- if (options.verbose > 1) console.warn(common.colour.yellow + "Rewriting external url ref", obj2[key], "as", newRef, common.colour.normal);
- obj2["x-miro"] = obj2[key];
- if (options.externalRefs[obj2[key]]) {
- if (!options.externalRefs[newRef]) {
- options.externalRefs[newRef] = options.externalRefs[obj2[key]];
- }
- options.externalRefs[newRef].failed = options.externalRefs[obj2[key]].failed;
- }
- obj2[key] = newRef;
- } else if (!obj2["x-miro"]) {
- let newRef = url.resolve(base, obj2[key]).toString();
- let failed = false;
- if (options.externalRefs[obj2[key]]) {
- failed = options.externalRefs[obj2[key]].failed;
- }
- if (!failed) {
- if (options.verbose > 1) console.warn(common.colour.yellow + "Rewriting external ref", obj2[key], "as", newRef, common.colour.normal);
- obj2["x-miro"] = obj2[key];
- obj2[key] = newRef;
- }
- }
- }
- });
- }
- recurse(obj, {}, function(obj2, key, state) {
- if (isRef(obj2, key)) {
- if (typeof obj2.$fixed !== "undefined") delete obj2.$fixed;
- }
- });
- if (options.verbose > 1) console.warn("Finished fragment resolution");
- return obj;
- }
- function filterData(data, options) {
- if (!options.filters || !options.filters.length) return data;
- for (let filter of options.filters) {
- data = filter(data, options);
- }
- return data;
- }
- function testProtocol(input, backup) {
- if (input && input.length > 2) return input;
- if (backup && backup.length > 2) return backup;
- return "file:";
- }
- function resolveExternal(root, pointer, options, callback) {
- var u = url.parse(options.source);
- var base = options.source.split("\\").join("/").split("/");
- let doc = base.pop();
- if (!doc) base.pop();
- let fragment = "";
- let fnComponents = pointer.split("#");
- if (fnComponents.length > 1) {
- fragment = "#" + fnComponents[1];
- pointer = fnComponents[0];
- }
- base = base.join("/");
- let u2 = url.parse(pointer);
- let effectiveProtocol = testProtocol(u2.protocol, u.protocol);
- let target;
- if (effectiveProtocol === "file:") {
- target = path.resolve(base ? base + "/" : "", pointer);
- } else {
- target = url.resolve(base ? base + "/" : "", pointer);
- }
- if (options.cache[target]) {
- if (options.verbose) console.warn("CACHED", target, fragment);
- let context = clone(options.cache[target]);
- let data = options.externalRef = context;
- if (fragment) {
- data = jptr(data, fragment);
- if (data === false) {
- data = {};
- if (options.fatal) {
- let ex = new Error("Cached $ref resolution failed " + target + fragment);
- if (options.promise) options.promise.reject(ex);
- else throw ex;
- }
- }
- }
- data = resolveAllFragment(data, context, pointer, fragment, target, options);
- data = filterData(data, options);
- callback(clone(data), target, options);
- return Promise.resolve(data);
- }
- if (options.verbose) console.warn("GET", target, fragment);
- if (options.handlers && options.handlers[effectiveProtocol]) {
- return options.handlers[effectiveProtocol](base, pointer, fragment, options).then(function(data) {
- options.externalRef = data;
- data = filterData(data, options);
- options.cache[target] = data;
- callback(data, target, options);
- return data;
- }).catch(function(ex) {
- if (options.verbose) console.warn(ex);
- throw ex;
- });
- } else if (effectiveProtocol && effectiveProtocol.startsWith("http")) {
- const fetchOptions = Object.assign({}, options.fetchOptions, { agent: options.agent });
- return options.fetch(target, fetchOptions).then(function(res) {
- if (res.status !== 200) {
- if (options.ignoreIOErrors) {
- if (options.verbose) console.warn("FAILED", pointer);
- options.externalRefs[pointer].failed = true;
- return '{"$ref":"' + pointer + '"}';
- } else {
- throw new Error(`Received status code ${res.status}: ${target}`);
- }
- }
- return res.text();
- }).then(function(data) {
- try {
- let context = yaml.parse(data, { schema: "core", prettyErrors: true });
- data = options.externalRef = context;
- options.cache[target] = clone(data);
- if (fragment) {
- data = jptr(data, fragment);
- if (data === false) {
- data = {};
- if (options.fatal) {
- let ex = new Error("Remote $ref resolution failed " + target + fragment);
- if (options.promise) options.promise.reject(ex);
- else throw ex;
- }
- }
- }
- data = resolveAllFragment(data, context, pointer, fragment, target, options);
- data = filterData(data, options);
- } catch (ex) {
- if (options.verbose) console.warn(ex);
- if (options.promise && options.fatal) options.promise.reject(ex);
- else throw ex;
- }
- callback(data, target, options);
- return data;
- }).catch(function(err) {
- if (options.verbose) console.warn(err);
- options.cache[target] = {};
- if (options.promise && options.fatal) options.promise.reject(err);
- else throw err;
- });
- } else {
- const def = '{"$ref":"' + pointer + '"}';
- return readFileAsync(target, options.encoding || "utf8", options, pointer, def).then(function(data) {
- try {
- let context = yaml.parse(data, { schema: "core", prettyErrors: true });
- data = options.externalRef = context;
- options.cache[target] = clone(data);
- if (fragment) {
- data = jptr(data, fragment);
- if (data === false) {
- data = {};
- if (options.fatal) {
- let ex = new Error("File $ref resolution failed " + target + fragment);
- if (options.promise) options.promise.reject(ex);
- else throw ex;
- }
- }
- }
- data = resolveAllFragment(data, context, pointer, fragment, target, options);
- data = filterData(data, options);
- } catch (ex) {
- if (options.verbose) console.warn(ex);
- if (options.promise && options.fatal) options.promise.reject(ex);
- else throw ex;
- }
- callback(data, target, options);
- return data;
- }).catch(function(err) {
- if (options.verbose) console.warn(err);
- if (options.promise && options.fatal) options.promise.reject(err);
- else throw err;
- });
- }
- }
- function scanExternalRefs(options) {
- return new Promise(function(res, rej) {
- function inner(obj, key, state) {
- if (obj[key] && isRef(obj[key], "$ref")) {
- let $ref = obj[key].$ref;
- if (!$ref.startsWith("#")) {
- let $extra = "";
- if (!refs[$ref]) {
- let potential = Object.keys(refs).find(function(e, i, a) {
- return $ref.startsWith(e + "/");
- });
- if (potential) {
- if (options.verbose) console.warn("Found potential subschema at", potential);
- $extra = "/" + ($ref.split("#")[1] || "").replace(potential.split("#")[1] || "");
- $extra = $extra.split("/undefined").join("");
- $ref = potential;
- }
- }
- if (!refs[$ref]) {
- refs[$ref] = { resolved: false, paths: [], extras: {}, description: obj[key].description };
- }
- if (refs[$ref].resolved) {
- if (refs[$ref].failed) {
- } else if (options.rewriteRefs) {
- let newRef = refs[$ref].resolvedAt;
- if (options.verbose > 1) console.warn("Rewriting ref", $ref, newRef);
- obj[key]["x-miro"] = $ref;
- obj[key].$ref = newRef + $extra;
- } else {
- obj[key] = clone(refs[$ref].data);
- }
- } else {
- refs[$ref].paths.push(state.path);
- refs[$ref].extras[state.path] = $extra;
- }
- }
- }
- }
- let refs = options.externalRefs;
- if (options.resolver.depth > 0 && options.source === options.resolver.base) {
- return res(refs);
- }
- recurse(options.openapi.definitions, { identityDetection: true, path: "#/definitions" }, inner);
- recurse(options.openapi.components, { identityDetection: true, path: "#/components" }, inner);
- recurse(options.openapi, { identityDetection: true }, inner);
- res(refs);
- });
- }
- function findExternalRefs(options) {
- return new Promise(function(res, rej) {
- scanExternalRefs(options).then(function(refs) {
- for (let ref in refs) {
- if (!refs[ref].resolved) {
- let depth = options.resolver.depth;
- if (depth > 0) depth++;
- options.resolver.actions[depth].push(function() {
- return resolveExternal(options.openapi, ref, options, function(data, source, options2) {
- if (!refs[ref].resolved) {
- let external = {};
- external.context = refs[ref];
- external.$ref = ref;
- external.original = clone(data);
- external.updated = data;
- external.source = source;
- options2.externals.push(external);
- refs[ref].resolved = true;
- }
- let localOptions = Object.assign({}, options2, {
- source: "",
- resolver: {
- actions: options2.resolver.actions,
- depth: options2.resolver.actions.length - 1,
- base: options2.resolver.base
- }
- });
- if (options2.patch && refs[ref].description && !data.description && typeof data === "object") {
- data.description = refs[ref].description;
- }
- refs[ref].data = data;
- let pointers = unique(refs[ref].paths);
- pointers = pointers.sort(function(a, b) {
- const aComp = a.startsWith("#/components/") || a.startsWith("#/definitions/");
- const bComp = b.startsWith("#/components/") || b.startsWith("#/definitions/");
- if (aComp && !bComp) return -1;
- if (bComp && !aComp) return 1;
- return 0;
- });
- for (let ptr of pointers) {
- if (refs[ref].resolvedAt && ptr !== refs[ref].resolvedAt && ptr.indexOf("x-ms-examples/") < 0) {
- if (options2.verbose > 1) console.warn("Creating pointer to data at", ptr);
- jptr(options2.openapi, ptr, { $ref: refs[ref].resolvedAt + refs[ref].extras[ptr], "x-miro": ref + refs[ref].extras[ptr] });
- } else {
- if (refs[ref].resolvedAt) {
- if (options2.verbose > 1) console.warn("Avoiding circular reference");
- } else {
- refs[ref].resolvedAt = ptr;
- if (options2.verbose > 1) console.warn("Creating initial clone of data at", ptr);
- }
- let cdata = clone(data);
- jptr(options2.openapi, ptr, cdata);
- }
- }
- if (options2.resolver.actions[localOptions.resolver.depth].length === 0) {
- options2.resolver.actions[localOptions.resolver.depth].push(function() {
- return findExternalRefs(localOptions);
- });
- }
- });
- });
- }
- }
- }).catch(function(ex) {
- if (options.verbose) console.warn(ex);
- rej(ex);
- });
- let result = { options };
- result.actions = options.resolver.actions[options.resolver.depth];
- res(result);
- });
- }
- var serial = (funcs) => funcs.reduce((promise, func) => promise.then((result) => func().then(Array.prototype.concat.bind(result))), Promise.resolve([]));
- function loopReferences(options, res, rej) {
- options.resolver.actions.push([]);
- findExternalRefs(options).then(function(data) {
- serial(data.actions).then(function() {
- if (options.resolver.depth >= options.resolver.actions.length) {
- console.warn("Ran off the end of resolver actions");
- return res(true);
- } else {
- options.resolver.depth++;
- if (options.resolver.actions[options.resolver.depth].length) {
- setTimeout(function() {
- loopReferences(data.options, res, rej);
- }, 0);
- } else {
- if (options.verbose > 1) console.warn(common.colour.yellow + "Finished external resolution!", common.colour.normal);
- if (options.resolveInternal) {
- if (options.verbose > 1) console.warn(common.colour.yellow + "Starting internal resolution!", common.colour.normal);
- options.openapi = deRef(options.openapi, options.original, { verbose: options.verbose - 1 });
- if (options.verbose > 1) console.warn(common.colour.yellow + "Finished internal resolution!", common.colour.normal);
- }
- recurse(options.openapi, {}, function(obj, key, state) {
- if (isRef(obj, key)) {
- if (!options.preserveMiro) delete obj["x-miro"];
- }
- });
- res(options);
- }
- }
- }).catch(function(ex) {
- if (options.verbose) console.warn(ex);
- rej(ex);
- });
- }).catch(function(ex) {
- if (options.verbose) console.warn(ex);
- rej(ex);
- });
- }
- function setupOptions(options) {
- if (!options.cache) options.cache = {};
- if (!options.fetch) options.fetch = fetch;
- if (options.source) {
- let srcUrl = url.parse(options.source);
- if (!srcUrl.protocol || srcUrl.protocol.length <= 2) {
- options.source = path.resolve(options.source);
- }
- }
- options.externals = [];
- options.externalRefs = {};
- options.rewriteRefs = true;
- options.resolver = {};
- options.resolver.depth = 0;
- options.resolver.base = options.source;
- options.resolver.actions = [[]];
- }
- function optionalResolve(options) {
- setupOptions(options);
- return new Promise(function(res, rej) {
- if (options.resolve)
- loopReferences(options, res, rej);
- else
- res(options);
- });
- }
- function resolve(openapi, source, options) {
- if (!options) options = {};
- options.openapi = openapi;
- options.source = source;
- options.resolve = true;
- setupOptions(options);
- return new Promise(function(res, rej) {
- loopReferences(options, res, rej);
- });
- }
- module2.exports = {
- optionalResolve,
- resolve
- };
- }
-});
-
-// ../../node_modules/openapi-to-postmanv2/node_modules/yaml/dist/PlainValue-ec8e588e.js
-var require_PlainValue_ec8e588e2 = __commonJS({
- "../../node_modules/openapi-to-postmanv2/node_modules/yaml/dist/PlainValue-ec8e588e.js"(exports2) {
- "use strict";
- var Char = {
- ANCHOR: "&",
- COMMENT: "#",
- TAG: "!",
- DIRECTIVES_END: "-",
- DOCUMENT_END: "."
- };
- var Type = {
- ALIAS: "ALIAS",
- BLANK_LINE: "BLANK_LINE",
- BLOCK_FOLDED: "BLOCK_FOLDED",
- BLOCK_LITERAL: "BLOCK_LITERAL",
- COMMENT: "COMMENT",
- DIRECTIVE: "DIRECTIVE",
- DOCUMENT: "DOCUMENT",
- FLOW_MAP: "FLOW_MAP",
- FLOW_SEQ: "FLOW_SEQ",
- MAP: "MAP",
- MAP_KEY: "MAP_KEY",
- MAP_VALUE: "MAP_VALUE",
- PLAIN: "PLAIN",
- QUOTE_DOUBLE: "QUOTE_DOUBLE",
- QUOTE_SINGLE: "QUOTE_SINGLE",
- SEQ: "SEQ",
- SEQ_ITEM: "SEQ_ITEM"
- };
- var defaultTagPrefix = "tag:yaml.org,2002:";
- var defaultTags = {
- MAP: "tag:yaml.org,2002:map",
- SEQ: "tag:yaml.org,2002:seq",
- STR: "tag:yaml.org,2002:str"
- };
- function findLineStarts(src) {
- const ls = [0];
- let offset = src.indexOf("\n");
- while (offset !== -1) {
- offset += 1;
- ls.push(offset);
- offset = src.indexOf("\n", offset);
- }
- return ls;
- }
- function getSrcInfo(cst) {
- let lineStarts, src;
- if (typeof cst === "string") {
- lineStarts = findLineStarts(cst);
- src = cst;
- } else {
- if (Array.isArray(cst)) cst = cst[0];
- if (cst && cst.context) {
- if (!cst.lineStarts) cst.lineStarts = findLineStarts(cst.context.src);
- lineStarts = cst.lineStarts;
- src = cst.context.src;
- }
- }
- return {
- lineStarts,
- src
- };
- }
- function getLinePos(offset, cst) {
- if (typeof offset !== "number" || offset < 0) return null;
- const {
- lineStarts,
- src
- } = getSrcInfo(cst);
- if (!lineStarts || !src || offset > src.length) return null;
- for (let i = 0; i < lineStarts.length; ++i) {
- const start = lineStarts[i];
- if (offset < start) {
- return {
- line: i,
- col: offset - lineStarts[i - 1] + 1
- };
- }
- if (offset === start) return {
- line: i + 1,
- col: 1
- };
- }
- const line = lineStarts.length;
- return {
- line,
- col: offset - lineStarts[line - 1] + 1
- };
- }
- function getLine(line, cst) {
- const {
- lineStarts,
- src
- } = getSrcInfo(cst);
- if (!lineStarts || !(line >= 1) || line > lineStarts.length) return null;
- const start = lineStarts[line - 1];
- let end = lineStarts[line];
- while (end && end > start && src[end - 1] === "\n") --end;
- return src.slice(start, end);
- }
- function getPrettyContext({
- start,
- end
- }, cst, maxWidth = 80) {
- let src = getLine(start.line, cst);
- if (!src) return null;
- let {
- col
- } = start;
- if (src.length > maxWidth) {
- if (col <= maxWidth - 10) {
- src = src.substr(0, maxWidth - 1) + "\u2026";
- } else {
- const halfWidth = Math.round(maxWidth / 2);
- if (src.length > col + halfWidth) src = src.substr(0, col + halfWidth - 1) + "\u2026";
- col -= src.length - maxWidth;
- src = "\u2026" + src.substr(1 - maxWidth);
- }
- }
- let errLen = 1;
- let errEnd = "";
- if (end) {
- if (end.line === start.line && col + (end.col - start.col) <= maxWidth + 1) {
- errLen = end.col - start.col;
- } else {
- errLen = Math.min(src.length + 1, maxWidth) - col;
- errEnd = "\u2026";
- }
- }
- const offset = col > 1 ? " ".repeat(col - 1) : "";
- const err = "^".repeat(errLen);
- return `${src}
-${offset}${err}${errEnd}`;
- }
- var Range = class _Range {
- static copy(orig) {
- return new _Range(orig.start, orig.end);
- }
- constructor(start, end) {
- this.start = start;
- this.end = end || start;
- }
- isEmpty() {
- return typeof this.start !== "number" || !this.end || this.end <= this.start;
- }
- /**
- * Set `origStart` and `origEnd` to point to the original source range for
- * this node, which may differ due to dropped CR characters.
- *
- * @param {number[]} cr - Positions of dropped CR characters
- * @param {number} offset - Starting index of `cr` from the last call
- * @returns {number} - The next offset, matching the one found for `origStart`
- */
- setOrigRange(cr, offset) {
- const {
- start,
- end
- } = this;
- if (cr.length === 0 || end <= cr[0]) {
- this.origStart = start;
- this.origEnd = end;
- return offset;
- }
- let i = offset;
- while (i < cr.length) {
- if (cr[i] > start) break;
- else ++i;
- }
- this.origStart = start + i;
- const nextOffset = i;
- while (i < cr.length) {
- if (cr[i] >= end) break;
- else ++i;
- }
- this.origEnd = end + i;
- return nextOffset;
- }
- };
- var Node = class _Node {
- static addStringTerminator(src, offset, str) {
- if (str[str.length - 1] === "\n") return str;
- const next = _Node.endOfWhiteSpace(src, offset);
- return next >= src.length || src[next] === "\n" ? str + "\n" : str;
- }
- // ^(---|...)
- static atDocumentBoundary(src, offset, sep) {
- const ch0 = src[offset];
- if (!ch0) return true;
- const prev = src[offset - 1];
- if (prev && prev !== "\n") return false;
- if (sep) {
- if (ch0 !== sep) return false;
- } else {
- if (ch0 !== Char.DIRECTIVES_END && ch0 !== Char.DOCUMENT_END) return false;
- }
- const ch1 = src[offset + 1];
- const ch2 = src[offset + 2];
- if (ch1 !== ch0 || ch2 !== ch0) return false;
- const ch3 = src[offset + 3];
- return !ch3 || ch3 === "\n" || ch3 === " " || ch3 === " ";
- }
- static endOfIdentifier(src, offset) {
- let ch = src[offset];
- const isVerbatim = ch === "<";
- const notOk = isVerbatim ? ["\n", " ", " ", ">"] : ["\n", " ", " ", "[", "]", "{", "}", ","];
- while (ch && notOk.indexOf(ch) === -1) ch = src[offset += 1];
- if (isVerbatim && ch === ">") offset += 1;
- return offset;
- }
- static endOfIndent(src, offset) {
- let ch = src[offset];
- while (ch === " ") ch = src[offset += 1];
- return offset;
- }
- static endOfLine(src, offset) {
- let ch = src[offset];
- while (ch && ch !== "\n") ch = src[offset += 1];
- return offset;
- }
- static endOfWhiteSpace(src, offset) {
- let ch = src[offset];
- while (ch === " " || ch === " ") ch = src[offset += 1];
- return offset;
- }
- static startOfLine(src, offset) {
- let ch = src[offset - 1];
- if (ch === "\n") return offset;
- while (ch && ch !== "\n") ch = src[offset -= 1];
- return offset + 1;
- }
- /**
- * End of indentation, or null if the line's indent level is not more
- * than `indent`
- *
- * @param {string} src
- * @param {number} indent
- * @param {number} lineStart
- * @returns {?number}
- */
- static endOfBlockIndent(src, indent, lineStart) {
- const inEnd = _Node.endOfIndent(src, lineStart);
- if (inEnd > lineStart + indent) {
- return inEnd;
- } else {
- const wsEnd = _Node.endOfWhiteSpace(src, inEnd);
- const ch = src[wsEnd];
- if (!ch || ch === "\n") return wsEnd;
- }
- return null;
- }
- static atBlank(src, offset, endAsBlank) {
- const ch = src[offset];
- return ch === "\n" || ch === " " || ch === " " || endAsBlank && !ch;
- }
- static nextNodeIsIndented(ch, indentDiff, indicatorAsIndent) {
- if (!ch || indentDiff < 0) return false;
- if (indentDiff > 0) return true;
- return indicatorAsIndent && ch === "-";
- }
- // should be at line or string end, or at next non-whitespace char
- static normalizeOffset(src, offset) {
- const ch = src[offset];
- return !ch ? offset : ch !== "\n" && src[offset - 1] === "\n" ? offset - 1 : _Node.endOfWhiteSpace(src, offset);
- }
- // fold single newline into space, multiple newlines to N - 1 newlines
- // presumes src[offset] === '\n'
- static foldNewline(src, offset, indent) {
- let inCount = 0;
- let error = false;
- let fold = "";
- let ch = src[offset + 1];
- while (ch === " " || ch === " " || ch === "\n") {
- switch (ch) {
- case "\n":
- inCount = 0;
- offset += 1;
- fold += "\n";
- break;
- case " ":
- if (inCount <= indent) error = true;
- offset = _Node.endOfWhiteSpace(src, offset + 2) - 1;
- break;
- case " ":
- inCount += 1;
- offset += 1;
- break;
- }
- ch = src[offset + 1];
- }
- if (!fold) fold = " ";
- if (ch && inCount <= indent) error = true;
- return {
- fold,
- offset,
- error
- };
- }
- constructor(type, props, context) {
- Object.defineProperty(this, "context", {
- value: context || null,
- writable: true
- });
- this.error = null;
- this.range = null;
- this.valueRange = null;
- this.props = props || [];
- this.type = type;
- this.value = null;
- }
- getPropValue(idx, key, skipKey) {
- if (!this.context) return null;
- const {
- src
- } = this.context;
- const prop = this.props[idx];
- return prop && src[prop.start] === key ? src.slice(prop.start + (skipKey ? 1 : 0), prop.end) : null;
- }
- get anchor() {
- for (let i = 0; i < this.props.length; ++i) {
- const anchor = this.getPropValue(i, Char.ANCHOR, true);
- if (anchor != null) return anchor;
- }
- return null;
- }
- get comment() {
- const comments = [];
- for (let i = 0; i < this.props.length; ++i) {
- const comment = this.getPropValue(i, Char.COMMENT, true);
- if (comment != null) comments.push(comment);
- }
- return comments.length > 0 ? comments.join("\n") : null;
- }
- commentHasRequiredWhitespace(start) {
- const {
- src
- } = this.context;
- if (this.header && start === this.header.end) return false;
- if (!this.valueRange) return false;
- const {
- end
- } = this.valueRange;
- return start !== end || _Node.atBlank(src, end - 1);
- }
- get hasComment() {
- if (this.context) {
- const {
- src
- } = this.context;
- for (let i = 0; i < this.props.length; ++i) {
- if (src[this.props[i].start] === Char.COMMENT) return true;
- }
- }
- return false;
- }
- get hasProps() {
- if (this.context) {
- const {
- src
- } = this.context;
- for (let i = 0; i < this.props.length; ++i) {
- if (src[this.props[i].start] !== Char.COMMENT) return true;
- }
- }
- return false;
- }
- get includesTrailingLines() {
- return false;
- }
- get jsonLike() {
- const jsonLikeTypes = [Type.FLOW_MAP, Type.FLOW_SEQ, Type.QUOTE_DOUBLE, Type.QUOTE_SINGLE];
- return jsonLikeTypes.indexOf(this.type) !== -1;
- }
- get rangeAsLinePos() {
- if (!this.range || !this.context) return void 0;
- const start = getLinePos(this.range.start, this.context.root);
- if (!start) return void 0;
- const end = getLinePos(this.range.end, this.context.root);
- return {
- start,
- end
- };
- }
- get rawValue() {
- if (!this.valueRange || !this.context) return null;
- const {
- start,
- end
- } = this.valueRange;
- return this.context.src.slice(start, end);
- }
- get tag() {
- for (let i = 0; i < this.props.length; ++i) {
- const tag = this.getPropValue(i, Char.TAG, false);
- if (tag != null) {
- if (tag[1] === "<") {
- return {
- verbatim: tag.slice(2, -1)
- };
- } else {
- const [_2, handle, suffix] = tag.match(/^(.*!)([^!]*)$/);
- return {
- handle,
- suffix
- };
- }
- }
- }
- return null;
- }
- get valueRangeContainsNewline() {
- if (!this.valueRange || !this.context) return false;
- const {
- start,
- end
- } = this.valueRange;
- const {
- src
- } = this.context;
- for (let i = start; i < end; ++i) {
- if (src[i] === "\n") return true;
- }
- return false;
- }
- parseComment(start) {
- const {
- src
- } = this.context;
- if (src[start] === Char.COMMENT) {
- const end = _Node.endOfLine(src, start + 1);
- const commentRange = new Range(start, end);
- this.props.push(commentRange);
- return end;
- }
- return start;
- }
- /**
- * Populates the `origStart` and `origEnd` values of all ranges for this
- * node. Extended by child classes to handle descendant nodes.
- *
- * @param {number[]} cr - Positions of dropped CR characters
- * @param {number} offset - Starting index of `cr` from the last call
- * @returns {number} - The next offset, matching the one found for `origStart`
- */
- setOrigRanges(cr, offset) {
- if (this.range) offset = this.range.setOrigRange(cr, offset);
- if (this.valueRange) this.valueRange.setOrigRange(cr, offset);
- this.props.forEach((prop) => prop.setOrigRange(cr, offset));
- return offset;
- }
- toString() {
- const {
- context: {
- src
- },
- range,
- value
- } = this;
- if (value != null) return value;
- const str = src.slice(range.start, range.end);
- return _Node.addStringTerminator(src, range.end, str);
- }
- };
- var YAMLError = class extends Error {
- constructor(name, source, message) {
- if (!message || !(source instanceof Node)) throw new Error(`Invalid arguments for new ${name}`);
- super();
- this.name = name;
- this.message = message;
- this.source = source;
- }
- makePretty() {
- if (!this.source) return;
- this.nodeType = this.source.type;
- const cst = this.source.context && this.source.context.root;
- if (typeof this.offset === "number") {
- this.range = new Range(this.offset, this.offset + 1);
- const start = cst && getLinePos(this.offset, cst);
- if (start) {
- const end = {
- line: start.line,
- col: start.col + 1
- };
- this.linePos = {
- start,
- end
- };
- }
- delete this.offset;
- } else {
- this.range = this.source.range;
- this.linePos = this.source.rangeAsLinePos;
- }
- if (this.linePos) {
- const {
- line,
- col
- } = this.linePos.start;
- this.message += ` at line ${line}, column ${col}`;
- const ctx = cst && getPrettyContext(this.linePos, cst);
- if (ctx) this.message += `:
-
-${ctx}
-`;
- }
- delete this.source;
- }
- };
- var YAMLReferenceError = class extends YAMLError {
- constructor(source, message) {
- super("YAMLReferenceError", source, message);
- }
- };
- var YAMLSemanticError = class extends YAMLError {
- constructor(source, message) {
- super("YAMLSemanticError", source, message);
- }
- };
- var YAMLSyntaxError = class extends YAMLError {
- constructor(source, message) {
- super("YAMLSyntaxError", source, message);
- }
- };
- var YAMLWarning = class extends YAMLError {
- constructor(source, message) {
- super("YAMLWarning", source, message);
- }
- };
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- var PlainValue = class _PlainValue extends Node {
- static endOfLine(src, start, inFlow) {
- let ch = src[start];
- let offset = start;
- while (ch && ch !== "\n") {
- if (inFlow && (ch === "[" || ch === "]" || ch === "{" || ch === "}" || ch === ",")) break;
- const next = src[offset + 1];
- if (ch === ":" && (!next || next === "\n" || next === " " || next === " " || inFlow && next === ",")) break;
- if ((ch === " " || ch === " ") && next === "#") break;
- offset += 1;
- ch = next;
- }
- return offset;
- }
- get strValue() {
- if (!this.valueRange || !this.context) return null;
- let {
- start,
- end
- } = this.valueRange;
- const {
- src
- } = this.context;
- let ch = src[end - 1];
- while (start < end && (ch === "\n" || ch === " " || ch === " ")) ch = src[--end - 1];
- let str = "";
- for (let i = start; i < end; ++i) {
- const ch2 = src[i];
- if (ch2 === "\n") {
- const {
- fold,
- offset
- } = Node.foldNewline(src, i, -1);
- str += fold;
- i = offset;
- } else if (ch2 === " " || ch2 === " ") {
- const wsStart = i;
- let next = src[i + 1];
- while (i < end && (next === " " || next === " ")) {
- i += 1;
- next = src[i + 1];
- }
- if (next !== "\n") str += i > wsStart ? src.slice(wsStart, i + 1) : ch2;
- } else {
- str += ch2;
- }
- }
- const ch0 = src[start];
- switch (ch0) {
- case " ": {
- const msg = "Plain value cannot start with a tab character";
- const errors = [new YAMLSemanticError(this, msg)];
- return {
- errors,
- str
- };
- }
- case "@":
- case "`": {
- const msg = `Plain value cannot start with reserved character ${ch0}`;
- const errors = [new YAMLSemanticError(this, msg)];
- return {
- errors,
- str
- };
- }
- default:
- return str;
- }
- }
- parseBlockValue(start) {
- const {
- indent,
- inFlow,
- src
- } = this.context;
- let offset = start;
- let valueEnd = start;
- for (let ch = src[offset]; ch === "\n"; ch = src[offset]) {
- if (Node.atDocumentBoundary(src, offset + 1)) break;
- const end = Node.endOfBlockIndent(src, indent, offset + 1);
- if (end === null || src[end] === "#") break;
- if (src[end] === "\n") {
- offset = end;
- } else {
- valueEnd = _PlainValue.endOfLine(src, end, inFlow);
- offset = valueEnd;
- }
- }
- if (this.valueRange.isEmpty()) this.valueRange.start = start;
- this.valueRange.end = valueEnd;
- return valueEnd;
- }
- /**
- * Parses a plain value from the source
- *
- * Accepted forms are:
- * ```
- * #comment
- *
- * first line
- *
- * first line #comment
- *
- * first line
- * block
- * lines
- *
- * #comment
- * block
- * lines
- * ```
- * where block lines are empty or have an indent level greater than `indent`.
- *
- * @param {ParseContext} context
- * @param {number} start - Index of first character
- * @returns {number} - Index of the character after this scalar, may be `\n`
- */
- parse(context, start) {
- this.context = context;
- const {
- inFlow,
- src
- } = context;
- let offset = start;
- const ch = src[offset];
- if (ch && ch !== "#" && ch !== "\n") {
- offset = _PlainValue.endOfLine(src, start, inFlow);
- }
- this.valueRange = new Range(start, offset);
- offset = Node.endOfWhiteSpace(src, offset);
- offset = this.parseComment(offset);
- if (!this.hasComment || this.valueRange.isEmpty()) {
- offset = this.parseBlockValue(offset);
- }
- return offset;
- }
- };
- exports2.Char = Char;
- exports2.Node = Node;
- exports2.PlainValue = PlainValue;
- exports2.Range = Range;
- exports2.Type = Type;
- exports2.YAMLError = YAMLError;
- exports2.YAMLReferenceError = YAMLReferenceError;
- exports2.YAMLSemanticError = YAMLSemanticError;
- exports2.YAMLSyntaxError = YAMLSyntaxError;
- exports2.YAMLWarning = YAMLWarning;
- exports2._defineProperty = _defineProperty;
- exports2.defaultTagPrefix = defaultTagPrefix;
- exports2.defaultTags = defaultTags;
- }
-});
-
-// ../../node_modules/openapi-to-postmanv2/node_modules/yaml/dist/parse-cst.js
-var require_parse_cst2 = __commonJS({
- "../../node_modules/openapi-to-postmanv2/node_modules/yaml/dist/parse-cst.js"(exports2) {
- "use strict";
- var PlainValue = require_PlainValue_ec8e588e2();
- var BlankLine = class extends PlainValue.Node {
- constructor() {
- super(PlainValue.Type.BLANK_LINE);
- }
- /* istanbul ignore next */
- get includesTrailingLines() {
- return true;
- }
- /**
- * Parses a blank line from the source
- *
- * @param {ParseContext} context
- * @param {number} start - Index of first \n character
- * @returns {number} - Index of the character after this
- */
- parse(context, start) {
- this.context = context;
- this.range = new PlainValue.Range(start, start + 1);
- return start + 1;
- }
- };
- var CollectionItem = class extends PlainValue.Node {
- constructor(type, props) {
- super(type, props);
- this.node = null;
- }
- get includesTrailingLines() {
- return !!this.node && this.node.includesTrailingLines;
- }
- /**
- * @param {ParseContext} context
- * @param {number} start - Index of first character
- * @returns {number} - Index of the character after this
- */
- parse(context, start) {
- this.context = context;
- const {
- parseNode,
- src
- } = context;
- let {
- atLineStart,
- lineStart
- } = context;
- if (!atLineStart && this.type === PlainValue.Type.SEQ_ITEM) this.error = new PlainValue.YAMLSemanticError(this, "Sequence items must not have preceding content on the same line");
- const indent = atLineStart ? start - lineStart : context.indent;
- let offset = PlainValue.Node.endOfWhiteSpace(src, start + 1);
- let ch = src[offset];
- const inlineComment = ch === "#";
- const comments = [];
- let blankLine = null;
- while (ch === "\n" || ch === "#") {
- if (ch === "#") {
- const end2 = PlainValue.Node.endOfLine(src, offset + 1);
- comments.push(new PlainValue.Range(offset, end2));
- offset = end2;
- } else {
- atLineStart = true;
- lineStart = offset + 1;
- const wsEnd = PlainValue.Node.endOfWhiteSpace(src, lineStart);
- if (src[wsEnd] === "\n" && comments.length === 0) {
- blankLine = new BlankLine();
- lineStart = blankLine.parse({
- src
- }, lineStart);
- }
- offset = PlainValue.Node.endOfIndent(src, lineStart);
- }
- ch = src[offset];
- }
- if (PlainValue.Node.nextNodeIsIndented(ch, offset - (lineStart + indent), this.type !== PlainValue.Type.SEQ_ITEM)) {
- this.node = parseNode({
- atLineStart,
- inCollection: false,
- indent,
- lineStart,
- parent: this
- }, offset);
- } else if (ch && lineStart > start + 1) {
- offset = lineStart - 1;
- }
- if (this.node) {
- if (blankLine) {
- const items = context.parent.items || context.parent.contents;
- if (items) items.push(blankLine);
- }
- if (comments.length) Array.prototype.push.apply(this.props, comments);
- offset = this.node.range.end;
- } else {
- if (inlineComment) {
- const c = comments[0];
- this.props.push(c);
- offset = c.end;
- } else {
- offset = PlainValue.Node.endOfLine(src, start + 1);
- }
- }
- const end = this.node ? this.node.valueRange.end : offset;
- this.valueRange = new PlainValue.Range(start, end);
- return offset;
- }
- setOrigRanges(cr, offset) {
- offset = super.setOrigRanges(cr, offset);
- return this.node ? this.node.setOrigRanges(cr, offset) : offset;
- }
- toString() {
- const {
- context: {
- src
- },
- node,
- range,
- value
- } = this;
- if (value != null) return value;
- const str = node ? src.slice(range.start, node.range.start) + String(node) : src.slice(range.start, range.end);
- return PlainValue.Node.addStringTerminator(src, range.end, str);
- }
- };
- var Comment = class extends PlainValue.Node {
- constructor() {
- super(PlainValue.Type.COMMENT);
- }
- /**
- * Parses a comment line from the source
- *
- * @param {ParseContext} context
- * @param {number} start - Index of first character
- * @returns {number} - Index of the character after this scalar
- */
- parse(context, start) {
- this.context = context;
- const offset = this.parseComment(start);
- this.range = new PlainValue.Range(start, offset);
- return offset;
- }
- };
- function grabCollectionEndComments(node) {
- let cnode = node;
- while (cnode instanceof CollectionItem) cnode = cnode.node;
- if (!(cnode instanceof Collection)) return null;
- const len = cnode.items.length;
- let ci = -1;
- for (let i = len - 1; i >= 0; --i) {
- const n = cnode.items[i];
- if (n.type === PlainValue.Type.COMMENT) {
- const {
- indent,
- lineStart
- } = n.context;
- if (indent > 0 && n.range.start >= lineStart + indent) break;
- ci = i;
- } else if (n.type === PlainValue.Type.BLANK_LINE) ci = i;
- else break;
- }
- if (ci === -1) return null;
- const ca = cnode.items.splice(ci, len - ci);
- const prevEnd = ca[0].range.start;
- while (true) {
- cnode.range.end = prevEnd;
- if (cnode.valueRange && cnode.valueRange.end > prevEnd) cnode.valueRange.end = prevEnd;
- if (cnode === node) break;
- cnode = cnode.context.parent;
- }
- return ca;
- }
- var Collection = class _Collection extends PlainValue.Node {
- static nextContentHasIndent(src, offset, indent) {
- const lineStart = PlainValue.Node.endOfLine(src, offset) + 1;
- offset = PlainValue.Node.endOfWhiteSpace(src, lineStart);
- const ch = src[offset];
- if (!ch) return false;
- if (offset >= lineStart + indent) return true;
- if (ch !== "#" && ch !== "\n") return false;
- return _Collection.nextContentHasIndent(src, offset, indent);
- }
- constructor(firstItem) {
- super(firstItem.type === PlainValue.Type.SEQ_ITEM ? PlainValue.Type.SEQ : PlainValue.Type.MAP);
- for (let i = firstItem.props.length - 1; i >= 0; --i) {
- if (firstItem.props[i].start < firstItem.context.lineStart) {
- this.props = firstItem.props.slice(0, i + 1);
- firstItem.props = firstItem.props.slice(i + 1);
- const itemRange = firstItem.props[0] || firstItem.valueRange;
- firstItem.range.start = itemRange.start;
- break;
- }
- }
- this.items = [firstItem];
- const ec = grabCollectionEndComments(firstItem);
- if (ec) Array.prototype.push.apply(this.items, ec);
- }
- get includesTrailingLines() {
- return this.items.length > 0;
- }
- /**
- * @param {ParseContext} context
- * @param {number} start - Index of first character
- * @returns {number} - Index of the character after this
- */
- parse(context, start) {
- this.context = context;
- const {
- parseNode,
- src
- } = context;
- let lineStart = PlainValue.Node.startOfLine(src, start);
- const firstItem = this.items[0];
- firstItem.context.parent = this;
- this.valueRange = PlainValue.Range.copy(firstItem.valueRange);
- const indent = firstItem.range.start - firstItem.context.lineStart;
- let offset = start;
- offset = PlainValue.Node.normalizeOffset(src, offset);
- let ch = src[offset];
- let atLineStart = PlainValue.Node.endOfWhiteSpace(src, lineStart) === offset;
- let prevIncludesTrailingLines = false;
- while (ch) {
- while (ch === "\n" || ch === "#") {
- if (atLineStart && ch === "\n" && !prevIncludesTrailingLines) {
- const blankLine = new BlankLine();
- offset = blankLine.parse({
- src
- }, offset);
- this.valueRange.end = offset;
- if (offset >= src.length) {
- ch = null;
- break;
- }
- this.items.push(blankLine);
- offset -= 1;
- } else if (ch === "#") {
- if (offset < lineStart + indent && !_Collection.nextContentHasIndent(src, offset, indent)) {
- return offset;
- }
- const comment = new Comment();
- offset = comment.parse({
- indent,
- lineStart,
- src
- }, offset);
- this.items.push(comment);
- this.valueRange.end = offset;
- if (offset >= src.length) {
- ch = null;
- break;
- }
- }
- lineStart = offset + 1;
- offset = PlainValue.Node.endOfIndent(src, lineStart);
- if (PlainValue.Node.atBlank(src, offset)) {
- const wsEnd = PlainValue.Node.endOfWhiteSpace(src, offset);
- const next = src[wsEnd];
- if (!next || next === "\n" || next === "#") {
- offset = wsEnd;
- }
- }
- ch = src[offset];
- atLineStart = true;
- }
- if (!ch) {
- break;
- }
- if (offset !== lineStart + indent && (atLineStart || ch !== ":")) {
- if (offset < lineStart + indent) {
- if (lineStart > start) offset = lineStart;
- break;
- } else if (!this.error) {
- const msg = "All collection items must start at the same column";
- this.error = new PlainValue.YAMLSyntaxError(this, msg);
- }
- }
- if (firstItem.type === PlainValue.Type.SEQ_ITEM) {
- if (ch !== "-") {
- if (lineStart > start) offset = lineStart;
- break;
- }
- } else if (ch === "-" && !this.error) {
- const next = src[offset + 1];
- if (!next || next === "\n" || next === " " || next === " ") {
- const msg = "A collection cannot be both a mapping and a sequence";
- this.error = new PlainValue.YAMLSyntaxError(this, msg);
- }
- }
- const node = parseNode({
- atLineStart,
- inCollection: true,
- indent,
- lineStart,
- parent: this
- }, offset);
- if (!node) return offset;
- this.items.push(node);
- this.valueRange.end = node.valueRange.end;
- offset = PlainValue.Node.normalizeOffset(src, node.range.end);
- ch = src[offset];
- atLineStart = false;
- prevIncludesTrailingLines = node.includesTrailingLines;
- if (ch) {
- let ls = offset - 1;
- let prev = src[ls];
- while (prev === " " || prev === " ") prev = src[--ls];
- if (prev === "\n") {
- lineStart = ls + 1;
- atLineStart = true;
- }
- }
- const ec = grabCollectionEndComments(node);
- if (ec) Array.prototype.push.apply(this.items, ec);
- }
- return offset;
- }
- setOrigRanges(cr, offset) {
- offset = super.setOrigRanges(cr, offset);
- this.items.forEach((node) => {
- offset = node.setOrigRanges(cr, offset);
- });
- return offset;
- }
- toString() {
- const {
- context: {
- src
- },
- items,
- range,
- value
- } = this;
- if (value != null) return value;
- let str = src.slice(range.start, items[0].range.start) + String(items[0]);
- for (let i = 1; i < items.length; ++i) {
- const item = items[i];
- const {
- atLineStart,
- indent
- } = item.context;
- if (atLineStart) for (let i2 = 0; i2 < indent; ++i2) str += " ";
- str += String(item);
- }
- return PlainValue.Node.addStringTerminator(src, range.end, str);
- }
- };
- var Directive = class extends PlainValue.Node {
- constructor() {
- super(PlainValue.Type.DIRECTIVE);
- this.name = null;
- }
- get parameters() {
- const raw = this.rawValue;
- return raw ? raw.trim().split(/[ \t]+/) : [];
- }
- parseName(start) {
- const {
- src
- } = this.context;
- let offset = start;
- let ch = src[offset];
- while (ch && ch !== "\n" && ch !== " " && ch !== " ") ch = src[offset += 1];
- this.name = src.slice(start, offset);
- return offset;
- }
- parseParameters(start) {
- const {
- src
- } = this.context;
- let offset = start;
- let ch = src[offset];
- while (ch && ch !== "\n" && ch !== "#") ch = src[offset += 1];
- this.valueRange = new PlainValue.Range(start, offset);
- return offset;
- }
- parse(context, start) {
- this.context = context;
- let offset = this.parseName(start + 1);
- offset = this.parseParameters(offset);
- offset = this.parseComment(offset);
- this.range = new PlainValue.Range(start, offset);
- return offset;
- }
- };
- var Document = class _Document extends PlainValue.Node {
- static startCommentOrEndBlankLine(src, start) {
- const offset = PlainValue.Node.endOfWhiteSpace(src, start);
- const ch = src[offset];
- return ch === "#" || ch === "\n" ? offset : start;
- }
- constructor() {
- super(PlainValue.Type.DOCUMENT);
- this.directives = null;
- this.contents = null;
- this.directivesEndMarker = null;
- this.documentEndMarker = null;
- }
- parseDirectives(start) {
- const {
- src
- } = this.context;
- this.directives = [];
- let atLineStart = true;
- let hasDirectives = false;
- let offset = start;
- while (!PlainValue.Node.atDocumentBoundary(src, offset, PlainValue.Char.DIRECTIVES_END)) {
- offset = _Document.startCommentOrEndBlankLine(src, offset);
- switch (src[offset]) {
- case "\n":
- if (atLineStart) {
- const blankLine = new BlankLine();
- offset = blankLine.parse({
- src
- }, offset);
- if (offset < src.length) {
- this.directives.push(blankLine);
- }
- } else {
- offset += 1;
- atLineStart = true;
- }
- break;
- case "#":
- {
- const comment = new Comment();
- offset = comment.parse({
- src
- }, offset);
- this.directives.push(comment);
- atLineStart = false;
- }
- break;
- case "%":
- {
- const directive = new Directive();
- offset = directive.parse({
- parent: this,
- src
- }, offset);
- this.directives.push(directive);
- hasDirectives = true;
- atLineStart = false;
- }
- break;
- default:
- if (hasDirectives) {
- this.error = new PlainValue.YAMLSemanticError(this, "Missing directives-end indicator line");
- } else if (this.directives.length > 0) {
- this.contents = this.directives;
- this.directives = [];
- }
- return offset;
- }
- }
- if (src[offset]) {
- this.directivesEndMarker = new PlainValue.Range(offset, offset + 3);
- return offset + 3;
- }
- if (hasDirectives) {
- this.error = new PlainValue.YAMLSemanticError(this, "Missing directives-end indicator line");
- } else if (this.directives.length > 0) {
- this.contents = this.directives;
- this.directives = [];
- }
- return offset;
- }
- parseContents(start) {
- const {
- parseNode,
- src
- } = this.context;
- if (!this.contents) this.contents = [];
- let lineStart = start;
- while (src[lineStart - 1] === "-") lineStart -= 1;
- let offset = PlainValue.Node.endOfWhiteSpace(src, start);
- let atLineStart = lineStart === start;
- this.valueRange = new PlainValue.Range(offset);
- while (!PlainValue.Node.atDocumentBoundary(src, offset, PlainValue.Char.DOCUMENT_END)) {
- switch (src[offset]) {
- case "\n":
- if (atLineStart) {
- const blankLine = new BlankLine();
- offset = blankLine.parse({
- src
- }, offset);
- if (offset < src.length) {
- this.contents.push(blankLine);
- }
- } else {
- offset += 1;
- atLineStart = true;
- }
- lineStart = offset;
- break;
- case "#":
- {
- const comment = new Comment();
- offset = comment.parse({
- src
- }, offset);
- this.contents.push(comment);
- atLineStart = false;
- }
- break;
- default: {
- const iEnd = PlainValue.Node.endOfIndent(src, offset);
- const context = {
- atLineStart,
- indent: -1,
- inFlow: false,
- inCollection: false,
- lineStart,
- parent: this
- };
- const node = parseNode(context, iEnd);
- if (!node) return this.valueRange.end = iEnd;
- this.contents.push(node);
- offset = node.range.end;
- atLineStart = false;
- const ec = grabCollectionEndComments(node);
- if (ec) Array.prototype.push.apply(this.contents, ec);
- }
- }
- offset = _Document.startCommentOrEndBlankLine(src, offset);
- }
- this.valueRange.end = offset;
- if (src[offset]) {
- this.documentEndMarker = new PlainValue.Range(offset, offset + 3);
- offset += 3;
- if (src[offset]) {
- offset = PlainValue.Node.endOfWhiteSpace(src, offset);
- if (src[offset] === "#") {
- const comment = new Comment();
- offset = comment.parse({
- src
- }, offset);
- this.contents.push(comment);
- }
- switch (src[offset]) {
- case "\n":
- offset += 1;
- break;
- case void 0:
- break;
- default:
- this.error = new PlainValue.YAMLSyntaxError(this, "Document end marker line cannot have a non-comment suffix");
- }
- }
- }
- return offset;
- }
- /**
- * @param {ParseContext} context
- * @param {number} start - Index of first character
- * @returns {number} - Index of the character after this
- */
- parse(context, start) {
- context.root = this;
- this.context = context;
- const {
- src
- } = context;
- let offset = src.charCodeAt(start) === 65279 ? start + 1 : start;
- offset = this.parseDirectives(offset);
- offset = this.parseContents(offset);
- return offset;
- }
- setOrigRanges(cr, offset) {
- offset = super.setOrigRanges(cr, offset);
- this.directives.forEach((node) => {
- offset = node.setOrigRanges(cr, offset);
- });
- if (this.directivesEndMarker) offset = this.directivesEndMarker.setOrigRange(cr, offset);
- this.contents.forEach((node) => {
- offset = node.setOrigRanges(cr, offset);
- });
- if (this.documentEndMarker) offset = this.documentEndMarker.setOrigRange(cr, offset);
- return offset;
- }
- toString() {
- const {
- contents,
- directives,
- value
- } = this;
- if (value != null) return value;
- let str = directives.join("");
- if (contents.length > 0) {
- if (directives.length > 0 || contents[0].type === PlainValue.Type.COMMENT) str += "---\n";
- str += contents.join("");
- }
- if (str[str.length - 1] !== "\n") str += "\n";
- return str;
- }
- };
- var Alias = class extends PlainValue.Node {
- /**
- * Parses an *alias from the source
- *
- * @param {ParseContext} context
- * @param {number} start - Index of first character
- * @returns {number} - Index of the character after this scalar
- */
- parse(context, start) {
- this.context = context;
- const {
- src
- } = context;
- let offset = PlainValue.Node.endOfIdentifier(src, start + 1);
- this.valueRange = new PlainValue.Range(start + 1, offset);
- offset = PlainValue.Node.endOfWhiteSpace(src, offset);
- offset = this.parseComment(offset);
- return offset;
- }
- };
- var Chomp = {
- CLIP: "CLIP",
- KEEP: "KEEP",
- STRIP: "STRIP"
- };
- var BlockValue = class extends PlainValue.Node {
- constructor(type, props) {
- super(type, props);
- this.blockIndent = null;
- this.chomping = Chomp.CLIP;
- this.header = null;
- }
- get includesTrailingLines() {
- return this.chomping === Chomp.KEEP;
- }
- get strValue() {
- if (!this.valueRange || !this.context) return null;
- let {
- start,
- end
- } = this.valueRange;
- const {
- indent,
- src
- } = this.context;
- if (this.valueRange.isEmpty()) return "";
- let lastNewLine = null;
- let ch = src[end - 1];
- while (ch === "\n" || ch === " " || ch === " ") {
- end -= 1;
- if (end <= start) {
- if (this.chomping === Chomp.KEEP) break;
- else return "";
- }
- if (ch === "\n") lastNewLine = end;
- ch = src[end - 1];
- }
- let keepStart = end + 1;
- if (lastNewLine) {
- if (this.chomping === Chomp.KEEP) {
- keepStart = lastNewLine;
- end = this.valueRange.end;
- } else {
- end = lastNewLine;
- }
- }
- const bi = indent + this.blockIndent;
- const folded = this.type === PlainValue.Type.BLOCK_FOLDED;
- let atStart = true;
- let str = "";
- let sep = "";
- let prevMoreIndented = false;
- for (let i = start; i < end; ++i) {
- for (let j = 0; j < bi; ++j) {
- if (src[i] !== " ") break;
- i += 1;
- }
- const ch2 = src[i];
- if (ch2 === "\n") {
- if (sep === "\n") str += "\n";
- else sep = "\n";
- } else {
- const lineEnd = PlainValue.Node.endOfLine(src, i);
- const line = src.slice(i, lineEnd);
- i = lineEnd;
- if (folded && (ch2 === " " || ch2 === " ") && i < keepStart) {
- if (sep === " ") sep = "\n";
- else if (!prevMoreIndented && !atStart && sep === "\n") sep = "\n\n";
- str += sep + line;
- sep = lineEnd < end && src[lineEnd] || "";
- prevMoreIndented = true;
- } else {
- str += sep + line;
- sep = folded && i < keepStart ? " " : "\n";
- prevMoreIndented = false;
- }
- if (atStart && line !== "") atStart = false;
- }
- }
- return this.chomping === Chomp.STRIP ? str : str + "\n";
- }
- parseBlockHeader(start) {
- const {
- src
- } = this.context;
- let offset = start + 1;
- let bi = "";
- while (true) {
- const ch = src[offset];
- switch (ch) {
- case "-":
- this.chomping = Chomp.STRIP;
- break;
- case "+":
- this.chomping = Chomp.KEEP;
- break;
- case "0":
- case "1":
- case "2":
- case "3":
- case "4":
- case "5":
- case "6":
- case "7":
- case "8":
- case "9":
- bi += ch;
- break;
- default:
- this.blockIndent = Number(bi) || null;
- this.header = new PlainValue.Range(start, offset);
- return offset;
- }
- offset += 1;
- }
- }
- parseBlockValue(start) {
- const {
- indent,
- src
- } = this.context;
- const explicit = !!this.blockIndent;
- let offset = start;
- let valueEnd = start;
- let minBlockIndent = 1;
- for (let ch = src[offset]; ch === "\n"; ch = src[offset]) {
- offset += 1;
- if (PlainValue.Node.atDocumentBoundary(src, offset)) break;
- const end = PlainValue.Node.endOfBlockIndent(src, indent, offset);
- if (end === null) break;
- const ch2 = src[end];
- const lineIndent = end - (offset + indent);
- if (!this.blockIndent) {
- if (src[end] !== "\n") {
- if (lineIndent < minBlockIndent) {
- const msg = "Block scalars with more-indented leading empty lines must use an explicit indentation indicator";
- this.error = new PlainValue.YAMLSemanticError(this, msg);
- }
- this.blockIndent = lineIndent;
- } else if (lineIndent > minBlockIndent) {
- minBlockIndent = lineIndent;
- }
- } else if (ch2 && ch2 !== "\n" && lineIndent < this.blockIndent) {
- if (src[end] === "#") break;
- if (!this.error) {
- const src2 = explicit ? "explicit indentation indicator" : "first line";
- const msg = `Block scalars must not be less indented than their ${src2}`;
- this.error = new PlainValue.YAMLSemanticError(this, msg);
- }
- }
- if (src[end] === "\n") {
- offset = end;
- } else {
- offset = valueEnd = PlainValue.Node.endOfLine(src, end);
- }
- }
- if (this.chomping !== Chomp.KEEP) {
- offset = src[valueEnd] ? valueEnd + 1 : valueEnd;
- }
- this.valueRange = new PlainValue.Range(start + 1, offset);
- return offset;
- }
- /**
- * Parses a block value from the source
- *
- * Accepted forms are:
- * ```
- * BS
- * block
- * lines
- *
- * BS #comment
- * block
- * lines
- * ```
- * where the block style BS matches the regexp `[|>][-+1-9]*` and block lines
- * are empty or have an indent level greater than `indent`.
- *
- * @param {ParseContext} context
- * @param {number} start - Index of first character
- * @returns {number} - Index of the character after this block
- */
- parse(context, start) {
- this.context = context;
- const {
- src
- } = context;
- let offset = this.parseBlockHeader(start);
- offset = PlainValue.Node.endOfWhiteSpace(src, offset);
- offset = this.parseComment(offset);
- offset = this.parseBlockValue(offset);
- return offset;
- }
- setOrigRanges(cr, offset) {
- offset = super.setOrigRanges(cr, offset);
- return this.header ? this.header.setOrigRange(cr, offset) : offset;
- }
- };
- var FlowCollection = class extends PlainValue.Node {
- constructor(type, props) {
- super(type, props);
- this.items = null;
- }
- prevNodeIsJsonLike(idx = this.items.length) {
- const node = this.items[idx - 1];
- return !!node && (node.jsonLike || node.type === PlainValue.Type.COMMENT && this.prevNodeIsJsonLike(idx - 1));
- }
- /**
- * @param {ParseContext} context
- * @param {number} start - Index of first character
- * @returns {number} - Index of the character after this
- */
- parse(context, start) {
- this.context = context;
- const {
- parseNode,
- src
- } = context;
- let {
- indent,
- lineStart
- } = context;
- let char = src[start];
- this.items = [{
- char,
- offset: start
- }];
- let offset = PlainValue.Node.endOfWhiteSpace(src, start + 1);
- char = src[offset];
- while (char && char !== "]" && char !== "}") {
- switch (char) {
- case "\n":
- {
- lineStart = offset + 1;
- const wsEnd = PlainValue.Node.endOfWhiteSpace(src, lineStart);
- if (src[wsEnd] === "\n") {
- const blankLine = new BlankLine();
- lineStart = blankLine.parse({
- src
- }, lineStart);
- this.items.push(blankLine);
- }
- offset = PlainValue.Node.endOfIndent(src, lineStart);
- if (offset <= lineStart + indent) {
- char = src[offset];
- if (offset < lineStart + indent || char !== "]" && char !== "}") {
- const msg = "Insufficient indentation in flow collection";
- this.error = new PlainValue.YAMLSemanticError(this, msg);
- }
- }
- }
- break;
- case ",":
- {
- this.items.push({
- char,
- offset
- });
- offset += 1;
- }
- break;
- case "#":
- {
- const comment = new Comment();
- offset = comment.parse({
- src
- }, offset);
- this.items.push(comment);
- }
- break;
- case "?":
- case ":": {
- const next = src[offset + 1];
- if (next === "\n" || next === " " || next === " " || next === "," || // in-flow : after JSON-like key does not need to be followed by whitespace
- char === ":" && this.prevNodeIsJsonLike()) {
- this.items.push({
- char,
- offset
- });
- offset += 1;
- break;
- }
- }
- default: {
- const node = parseNode({
- atLineStart: false,
- inCollection: false,
- inFlow: true,
- indent: -1,
- lineStart,
- parent: this
- }, offset);
- if (!node) {
- this.valueRange = new PlainValue.Range(start, offset);
- return offset;
- }
- this.items.push(node);
- offset = PlainValue.Node.normalizeOffset(src, node.range.end);
- }
- }
- offset = PlainValue.Node.endOfWhiteSpace(src, offset);
- char = src[offset];
- }
- this.valueRange = new PlainValue.Range(start, offset + 1);
- if (char) {
- this.items.push({
- char,
- offset
- });
- offset = PlainValue.Node.endOfWhiteSpace(src, offset + 1);
- offset = this.parseComment(offset);
- }
- return offset;
- }
- setOrigRanges(cr, offset) {
- offset = super.setOrigRanges(cr, offset);
- this.items.forEach((node) => {
- if (node instanceof PlainValue.Node) {
- offset = node.setOrigRanges(cr, offset);
- } else if (cr.length === 0) {
- node.origOffset = node.offset;
- } else {
- let i = offset;
- while (i < cr.length) {
- if (cr[i] > node.offset) break;
- else ++i;
- }
- node.origOffset = node.offset + i;
- offset = i;
- }
- });
- return offset;
- }
- toString() {
- const {
- context: {
- src
- },
- items,
- range,
- value
- } = this;
- if (value != null) return value;
- const nodes = items.filter((item) => item instanceof PlainValue.Node);
- let str = "";
- let prevEnd = range.start;
- nodes.forEach((node) => {
- const prefix = src.slice(prevEnd, node.range.start);
- prevEnd = node.range.end;
- str += prefix + String(node);
- if (str[str.length - 1] === "\n" && src[prevEnd - 1] !== "\n" && src[prevEnd] === "\n") {
- prevEnd += 1;
- }
- });
- str += src.slice(prevEnd, range.end);
- return PlainValue.Node.addStringTerminator(src, range.end, str);
- }
- };
- var QuoteDouble = class _QuoteDouble extends PlainValue.Node {
- static endOfQuote(src, offset) {
- let ch = src[offset];
- while (ch && ch !== '"') {
- offset += ch === "\\" ? 2 : 1;
- ch = src[offset];
- }
- return offset + 1;
- }
- /**
- * @returns {string | { str: string, errors: YAMLSyntaxError[] }}
- */
- get strValue() {
- if (!this.valueRange || !this.context) return null;
- const errors = [];
- const {
- start,
- end
- } = this.valueRange;
- const {
- indent,
- src
- } = this.context;
- if (src[end - 1] !== '"') errors.push(new PlainValue.YAMLSyntaxError(this, 'Missing closing "quote'));
- let str = "";
- for (let i = start + 1; i < end - 1; ++i) {
- const ch = src[i];
- if (ch === "\n") {
- if (PlainValue.Node.atDocumentBoundary(src, i + 1)) errors.push(new PlainValue.YAMLSemanticError(this, "Document boundary indicators are not allowed within string values"));
- const {
- fold,
- offset,
- error
- } = PlainValue.Node.foldNewline(src, i, indent);
- str += fold;
- i = offset;
- if (error) errors.push(new PlainValue.YAMLSemanticError(this, "Multi-line double-quoted string needs to be sufficiently indented"));
- } else if (ch === "\\") {
- i += 1;
- switch (src[i]) {
- case "0":
- str += "\0";
- break;
- case "a":
- str += "\x07";
- break;
- case "b":
- str += "\b";
- break;
- case "e":
- str += "\x1B";
- break;
- case "f":
- str += "\f";
- break;
- case "n":
- str += "\n";
- break;
- case "r":
- str += "\r";
- break;
- case "t":
- str += " ";
- break;
- case "v":
- str += "\v";
- break;
- case "N":
- str += "\x85";
- break;
- case "_":
- str += "\xA0";
- break;
- case "L":
- str += "\u2028";
- break;
- case "P":
- str += "\u2029";
- break;
- case " ":
- str += " ";
- break;
- case '"':
- str += '"';
- break;
- case "/":
- str += "/";
- break;
- case "\\":
- str += "\\";
- break;
- case " ":
- str += " ";
- break;
- case "x":
- str += this.parseCharCode(i + 1, 2, errors);
- i += 2;
- break;
- case "u":
- str += this.parseCharCode(i + 1, 4, errors);
- i += 4;
- break;
- case "U":
- str += this.parseCharCode(i + 1, 8, errors);
- i += 8;
- break;
- case "\n":
- while (src[i + 1] === " " || src[i + 1] === " ") i += 1;
- break;
- default:
- errors.push(new PlainValue.YAMLSyntaxError(this, `Invalid escape sequence ${src.substr(i - 1, 2)}`));
- str += "\\" + src[i];
- }
- } else if (ch === " " || ch === " ") {
- const wsStart = i;
- let next = src[i + 1];
- while (next === " " || next === " ") {
- i += 1;
- next = src[i + 1];
- }
- if (next !== "\n") str += i > wsStart ? src.slice(wsStart, i + 1) : ch;
- } else {
- str += ch;
- }
- }
- return errors.length > 0 ? {
- errors,
- str
- } : str;
- }
- parseCharCode(offset, length, errors) {
- const {
- src
- } = this.context;
- const cc = src.substr(offset, length);
- const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
- const code = ok ? parseInt(cc, 16) : NaN;
- if (isNaN(code)) {
- errors.push(new PlainValue.YAMLSyntaxError(this, `Invalid escape sequence ${src.substr(offset - 2, length + 2)}`));
- return src.substr(offset - 2, length + 2);
- }
- return String.fromCodePoint(code);
- }
- /**
- * Parses a "double quoted" value from the source
- *
- * @param {ParseContext} context
- * @param {number} start - Index of first character
- * @returns {number} - Index of the character after this scalar
- */
- parse(context, start) {
- this.context = context;
- const {
- src
- } = context;
- let offset = _QuoteDouble.endOfQuote(src, start + 1);
- this.valueRange = new PlainValue.Range(start, offset);
- offset = PlainValue.Node.endOfWhiteSpace(src, offset);
- offset = this.parseComment(offset);
- return offset;
- }
- };
- var QuoteSingle = class _QuoteSingle extends PlainValue.Node {
- static endOfQuote(src, offset) {
- let ch = src[offset];
- while (ch) {
- if (ch === "'") {
- if (src[offset + 1] !== "'") break;
- ch = src[offset += 2];
- } else {
- ch = src[offset += 1];
- }
- }
- return offset + 1;
- }
- /**
- * @returns {string | { str: string, errors: YAMLSyntaxError[] }}
- */
- get strValue() {
- if (!this.valueRange || !this.context) return null;
- const errors = [];
- const {
- start,
- end
- } = this.valueRange;
- const {
- indent,
- src
- } = this.context;
- if (src[end - 1] !== "'") errors.push(new PlainValue.YAMLSyntaxError(this, "Missing closing 'quote"));
- let str = "";
- for (let i = start + 1; i < end - 1; ++i) {
- const ch = src[i];
- if (ch === "\n") {
- if (PlainValue.Node.atDocumentBoundary(src, i + 1)) errors.push(new PlainValue.YAMLSemanticError(this, "Document boundary indicators are not allowed within string values"));
- const {
- fold,
- offset,
- error
- } = PlainValue.Node.foldNewline(src, i, indent);
- str += fold;
- i = offset;
- if (error) errors.push(new PlainValue.YAMLSemanticError(this, "Multi-line single-quoted string needs to be sufficiently indented"));
- } else if (ch === "'") {
- str += ch;
- i += 1;
- if (src[i] !== "'") errors.push(new PlainValue.YAMLSyntaxError(this, "Unescaped single quote? This should not happen."));
- } else if (ch === " " || ch === " ") {
- const wsStart = i;
- let next = src[i + 1];
- while (next === " " || next === " ") {
- i += 1;
- next = src[i + 1];
- }
- if (next !== "\n") str += i > wsStart ? src.slice(wsStart, i + 1) : ch;
- } else {
- str += ch;
- }
- }
- return errors.length > 0 ? {
- errors,
- str
- } : str;
- }
- /**
- * Parses a 'single quoted' value from the source
- *
- * @param {ParseContext} context
- * @param {number} start - Index of first character
- * @returns {number} - Index of the character after this scalar
- */
- parse(context, start) {
- this.context = context;
- const {
- src
- } = context;
- let offset = _QuoteSingle.endOfQuote(src, start + 1);
- this.valueRange = new PlainValue.Range(start, offset);
- offset = PlainValue.Node.endOfWhiteSpace(src, offset);
- offset = this.parseComment(offset);
- return offset;
- }
- };
- function createNewNode(type, props) {
- switch (type) {
- case PlainValue.Type.ALIAS:
- return new Alias(type, props);
- case PlainValue.Type.BLOCK_FOLDED:
- case PlainValue.Type.BLOCK_LITERAL:
- return new BlockValue(type, props);
- case PlainValue.Type.FLOW_MAP:
- case PlainValue.Type.FLOW_SEQ:
- return new FlowCollection(type, props);
- case PlainValue.Type.MAP_KEY:
- case PlainValue.Type.MAP_VALUE:
- case PlainValue.Type.SEQ_ITEM:
- return new CollectionItem(type, props);
- case PlainValue.Type.COMMENT:
- case PlainValue.Type.PLAIN:
- return new PlainValue.PlainValue(type, props);
- case PlainValue.Type.QUOTE_DOUBLE:
- return new QuoteDouble(type, props);
- case PlainValue.Type.QUOTE_SINGLE:
- return new QuoteSingle(type, props);
- default:
- return null;
- }
- }
- var ParseContext = class _ParseContext {
- static parseType(src, offset, inFlow) {
- switch (src[offset]) {
- case "*":
- return PlainValue.Type.ALIAS;
- case ">":
- return PlainValue.Type.BLOCK_FOLDED;
- case "|":
- return PlainValue.Type.BLOCK_LITERAL;
- case "{":
- return PlainValue.Type.FLOW_MAP;
- case "[":
- return PlainValue.Type.FLOW_SEQ;
- case "?":
- return !inFlow && PlainValue.Node.atBlank(src, offset + 1, true) ? PlainValue.Type.MAP_KEY : PlainValue.Type.PLAIN;
- case ":":
- return !inFlow && PlainValue.Node.atBlank(src, offset + 1, true) ? PlainValue.Type.MAP_VALUE : PlainValue.Type.PLAIN;
- case "-":
- return !inFlow && PlainValue.Node.atBlank(src, offset + 1, true) ? PlainValue.Type.SEQ_ITEM : PlainValue.Type.PLAIN;
- case '"':
- return PlainValue.Type.QUOTE_DOUBLE;
- case "'":
- return PlainValue.Type.QUOTE_SINGLE;
- default:
- return PlainValue.Type.PLAIN;
- }
- }
- constructor(orig = {}, {
- atLineStart,
- inCollection,
- inFlow,
- indent,
- lineStart,
- parent
- } = {}) {
- PlainValue._defineProperty(this, "parseNode", (overlay, start) => {
- if (PlainValue.Node.atDocumentBoundary(this.src, start)) return null;
- const context = new _ParseContext(this, overlay);
- const {
- props,
- type,
- valueStart
- } = context.parseProps(start);
- const node = createNewNode(type, props);
- let offset = node.parse(context, valueStart);
- node.range = new PlainValue.Range(start, offset);
- if (offset <= start) {
- node.error = new Error(`Node#parse consumed no characters`);
- node.error.parseEnd = offset;
- node.error.source = node;
- node.range.end = start + 1;
- }
- if (context.nodeStartsCollection(node)) {
- if (!node.error && !context.atLineStart && context.parent.type === PlainValue.Type.DOCUMENT) {
- node.error = new PlainValue.YAMLSyntaxError(node, "Block collection must not have preceding content here (e.g. directives-end indicator)");
- }
- const collection = new Collection(node);
- offset = collection.parse(new _ParseContext(context), offset);
- collection.range = new PlainValue.Range(start, offset);
- return collection;
- }
- return node;
- });
- this.atLineStart = atLineStart != null ? atLineStart : orig.atLineStart || false;
- this.inCollection = inCollection != null ? inCollection : orig.inCollection || false;
- this.inFlow = inFlow != null ? inFlow : orig.inFlow || false;
- this.indent = indent != null ? indent : orig.indent;
- this.lineStart = lineStart != null ? lineStart : orig.lineStart;
- this.parent = parent != null ? parent : orig.parent || {};
- this.root = orig.root;
- this.src = orig.src;
- }
- nodeStartsCollection(node) {
- const {
- inCollection,
- inFlow,
- src
- } = this;
- if (inCollection || inFlow) return false;
- if (node instanceof CollectionItem) return true;
- let offset = node.range.end;
- if (src[offset] === "\n" || src[offset - 1] === "\n") return false;
- offset = PlainValue.Node.endOfWhiteSpace(src, offset);
- return src[offset] === ":";
- }
- // Anchor and tag are before type, which determines the node implementation
- // class; hence this intermediate step.
- parseProps(offset) {
- const {
- inFlow,
- parent,
- src
- } = this;
- const props = [];
- let lineHasProps = false;
- offset = this.atLineStart ? PlainValue.Node.endOfIndent(src, offset) : PlainValue.Node.endOfWhiteSpace(src, offset);
- let ch = src[offset];
- while (ch === PlainValue.Char.ANCHOR || ch === PlainValue.Char.COMMENT || ch === PlainValue.Char.TAG || ch === "\n") {
- if (ch === "\n") {
- let inEnd = offset;
- let lineStart;
- do {
- lineStart = inEnd + 1;
- inEnd = PlainValue.Node.endOfIndent(src, lineStart);
- } while (src[inEnd] === "\n");
- const indentDiff = inEnd - (lineStart + this.indent);
- const noIndicatorAsIndent = parent.type === PlainValue.Type.SEQ_ITEM && parent.context.atLineStart;
- if (src[inEnd] !== "#" && !PlainValue.Node.nextNodeIsIndented(src[inEnd], indentDiff, !noIndicatorAsIndent)) break;
- this.atLineStart = true;
- this.lineStart = lineStart;
- lineHasProps = false;
- offset = inEnd;
- } else if (ch === PlainValue.Char.COMMENT) {
- const end = PlainValue.Node.endOfLine(src, offset + 1);
- props.push(new PlainValue.Range(offset, end));
- offset = end;
- } else {
- let end = PlainValue.Node.endOfIdentifier(src, offset + 1);
- if (ch === PlainValue.Char.TAG && src[end] === "," && /^[a-zA-Z0-9-]+\.[a-zA-Z0-9-]+,\d\d\d\d(-\d\d){0,2}\/\S/.test(src.slice(offset + 1, end + 13))) {
- end = PlainValue.Node.endOfIdentifier(src, end + 5);
- }
- props.push(new PlainValue.Range(offset, end));
- lineHasProps = true;
- offset = PlainValue.Node.endOfWhiteSpace(src, end);
- }
- ch = src[offset];
- }
- if (lineHasProps && ch === ":" && PlainValue.Node.atBlank(src, offset + 1, true)) offset -= 1;
- const type = _ParseContext.parseType(src, offset, inFlow);
- return {
- props,
- type,
- valueStart: offset
- };
- }
- /**
- * Parses a node from the source
- * @param {ParseContext} overlay
- * @param {number} start - Index of first non-whitespace character for the node
- * @returns {?Node} - null if at a document boundary
- */
- };
- function parse2(src) {
- const cr = [];
- if (src.indexOf("\r") !== -1) {
- src = src.replace(/\r\n?/g, (match, offset2) => {
- if (match.length > 1) cr.push(offset2);
- return "\n";
- });
- }
- const documents = [];
- let offset = 0;
- do {
- const doc = new Document();
- const context = new ParseContext({
- src
- });
- offset = doc.parse(context, offset);
- documents.push(doc);
- } while (offset < src.length);
- documents.setOrigRanges = () => {
- if (cr.length === 0) return false;
- for (let i = 1; i < cr.length; ++i) cr[i] -= i;
- let crOffset = 0;
- for (let i = 0; i < documents.length; ++i) {
- crOffset = documents[i].setOrigRanges(cr, crOffset);
- }
- cr.splice(0, cr.length);
- return true;
- };
- documents.toString = () => documents.join("...\n");
- return documents;
- }
- exports2.parse = parse2;
- }
-});
-
-// ../../node_modules/openapi-to-postmanv2/node_modules/yaml/dist/resolveSeq-d03cb037.js
-var require_resolveSeq_d03cb0372 = __commonJS({
- "../../node_modules/openapi-to-postmanv2/node_modules/yaml/dist/resolveSeq-d03cb037.js"(exports2) {
- "use strict";
- var PlainValue = require_PlainValue_ec8e588e2();
- function addCommentBefore(str, indent, comment) {
- if (!comment) return str;
- const cc = comment.replace(/[\s\S]^/gm, `$&${indent}#`);
- return `#${cc}
-${indent}${str}`;
- }
- function addComment(str, indent, comment) {
- return !comment ? str : comment.indexOf("\n") === -1 ? `${str} #${comment}` : `${str}
-` + comment.replace(/^/gm, `${indent || ""}#`);
- }
- var Node = class {
- };
- function toJSON(value, arg, ctx) {
- if (Array.isArray(value)) return value.map((v, i) => toJSON(v, String(i), ctx));
- if (value && typeof value.toJSON === "function") {
- const anchor = ctx && ctx.anchors && ctx.anchors.get(value);
- if (anchor) ctx.onCreate = (res2) => {
- anchor.res = res2;
- delete ctx.onCreate;
- };
- const res = value.toJSON(arg, ctx);
- if (anchor && ctx.onCreate) ctx.onCreate(res);
- return res;
- }
- if ((!ctx || !ctx.keep) && typeof value === "bigint") return Number(value);
- return value;
- }
- var Scalar = class extends Node {
- constructor(value) {
- super();
- this.value = value;
- }
- toJSON(arg, ctx) {
- return ctx && ctx.keep ? this.value : toJSON(this.value, arg, ctx);
- }
- toString() {
- return String(this.value);
- }
- };
- function collectionFromPath(schema2, path, value) {
- let v = value;
- for (let i = path.length - 1; i >= 0; --i) {
- const k = path[i];
- if (Number.isInteger(k) && k >= 0) {
- const a = [];
- a[k] = v;
- v = a;
- } else {
- const o = {};
- Object.defineProperty(o, k, {
- value: v,
- writable: true,
- enumerable: true,
- configurable: true
- });
- v = o;
- }
- }
- return schema2.createNode(v, false);
- }
- var isEmptyPath = (path) => path == null || typeof path === "object" && path[Symbol.iterator]().next().done;
- var Collection = class _Collection extends Node {
- constructor(schema2) {
- super();
- PlainValue._defineProperty(this, "items", []);
- this.schema = schema2;
- }
- addIn(path, value) {
- if (isEmptyPath(path)) this.add(value);
- else {
- const [key, ...rest] = path;
- const node = this.get(key, true);
- if (node instanceof _Collection) node.addIn(rest, value);
- else if (node === void 0 && this.schema) this.set(key, collectionFromPath(this.schema, rest, value));
- else throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
- }
- }
- deleteIn([key, ...rest]) {
- if (rest.length === 0) return this.delete(key);
- const node = this.get(key, true);
- if (node instanceof _Collection) return node.deleteIn(rest);
- else throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
- }
- getIn([key, ...rest], keepScalar) {
- const node = this.get(key, true);
- if (rest.length === 0) return !keepScalar && node instanceof Scalar ? node.value : node;
- else return node instanceof _Collection ? node.getIn(rest, keepScalar) : void 0;
- }
- hasAllNullValues() {
- return this.items.every((node) => {
- if (!node || node.type !== "PAIR") return false;
- const n = node.value;
- return n == null || n instanceof Scalar && n.value == null && !n.commentBefore && !n.comment && !n.tag;
- });
- }
- hasIn([key, ...rest]) {
- if (rest.length === 0) return this.has(key);
- const node = this.get(key, true);
- return node instanceof _Collection ? node.hasIn(rest) : false;
- }
- setIn([key, ...rest], value) {
- if (rest.length === 0) {
- this.set(key, value);
- } else {
- const node = this.get(key, true);
- if (node instanceof _Collection) node.setIn(rest, value);
- else if (node === void 0 && this.schema) this.set(key, collectionFromPath(this.schema, rest, value));
- else throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
- }
- }
- // overridden in implementations
- /* istanbul ignore next */
- toJSON() {
- return null;
- }
- toString(ctx, {
- blockItem,
- flowChars,
- isMap,
- itemIndent
- }, onComment, onChompKeep) {
- const {
- indent,
- indentStep,
- stringify: stringify2
- } = ctx;
- const inFlow = this.type === PlainValue.Type.FLOW_MAP || this.type === PlainValue.Type.FLOW_SEQ || ctx.inFlow;
- if (inFlow) itemIndent += indentStep;
- const allNullValues = isMap && this.hasAllNullValues();
- ctx = Object.assign({}, ctx, {
- allNullValues,
- indent: itemIndent,
- inFlow,
- type: null
- });
- let chompKeep = false;
- let hasItemWithNewLine = false;
- const nodes = this.items.reduce((nodes2, item, i) => {
- let comment;
- if (item) {
- if (!chompKeep && item.spaceBefore) nodes2.push({
- type: "comment",
- str: ""
- });
- if (item.commentBefore) item.commentBefore.match(/^.*$/gm).forEach((line) => {
- nodes2.push({
- type: "comment",
- str: `#${line}`
- });
- });
- if (item.comment) comment = item.comment;
- if (inFlow && (!chompKeep && item.spaceBefore || item.commentBefore || item.comment || item.key && (item.key.commentBefore || item.key.comment) || item.value && (item.value.commentBefore || item.value.comment))) hasItemWithNewLine = true;
- }
- chompKeep = false;
- let str2 = stringify2(item, ctx, () => comment = null, () => chompKeep = true);
- if (inFlow && !hasItemWithNewLine && str2.includes("\n")) hasItemWithNewLine = true;
- if (inFlow && i < this.items.length - 1) str2 += ",";
- str2 = addComment(str2, itemIndent, comment);
- if (chompKeep && (comment || inFlow)) chompKeep = false;
- nodes2.push({
- type: "item",
- str: str2
- });
- return nodes2;
- }, []);
- let str;
- if (nodes.length === 0) {
- str = flowChars.start + flowChars.end;
- } else if (inFlow) {
- const {
- start,
- end
- } = flowChars;
- const strings = nodes.map((n) => n.str);
- if (hasItemWithNewLine || strings.reduce((sum, str2) => sum + str2.length + 2, 2) > _Collection.maxFlowStringSingleLineLength) {
- str = start;
- for (const s of strings) {
- str += s ? `
-${indentStep}${indent}${s}` : "\n";
- }
- str += `
-${indent}${end}`;
- } else {
- str = `${start} ${strings.join(" ")} ${end}`;
- }
- } else {
- const strings = nodes.map(blockItem);
- str = strings.shift();
- for (const s of strings) str += s ? `
-${indent}${s}` : "\n";
- }
- if (this.comment) {
- str += "\n" + this.comment.replace(/^/gm, `${indent}#`);
- if (onComment) onComment();
- } else if (chompKeep && onChompKeep) onChompKeep();
- return str;
- }
- };
- PlainValue._defineProperty(Collection, "maxFlowStringSingleLineLength", 60);
- function asItemIndex(key) {
- let idx = key instanceof Scalar ? key.value : key;
- if (idx && typeof idx === "string") idx = Number(idx);
- return Number.isInteger(idx) && idx >= 0 ? idx : null;
- }
- var YAMLSeq = class extends Collection {
- add(value) {
- this.items.push(value);
- }
- delete(key) {
- const idx = asItemIndex(key);
- if (typeof idx !== "number") return false;
- const del = this.items.splice(idx, 1);
- return del.length > 0;
- }
- get(key, keepScalar) {
- const idx = asItemIndex(key);
- if (typeof idx !== "number") return void 0;
- const it = this.items[idx];
- return !keepScalar && it instanceof Scalar ? it.value : it;
- }
- has(key) {
- const idx = asItemIndex(key);
- return typeof idx === "number" && idx < this.items.length;
- }
- set(key, value) {
- const idx = asItemIndex(key);
- if (typeof idx !== "number") throw new Error(`Expected a valid index, not ${key}.`);
- this.items[idx] = value;
- }
- toJSON(_2, ctx) {
- const seq = [];
- if (ctx && ctx.onCreate) ctx.onCreate(seq);
- let i = 0;
- for (const item of this.items) seq.push(toJSON(item, String(i++), ctx));
- return seq;
- }
- toString(ctx, onComment, onChompKeep) {
- if (!ctx) return JSON.stringify(this);
- return super.toString(ctx, {
- blockItem: (n) => n.type === "comment" ? n.str : `- ${n.str}`,
- flowChars: {
- start: "[",
- end: "]"
- },
- isMap: false,
- itemIndent: (ctx.indent || "") + " "
- }, onComment, onChompKeep);
- }
- };
- var stringifyKey = (key, jsKey, ctx) => {
- if (jsKey === null) return "";
- if (typeof jsKey !== "object") return String(jsKey);
- if (key instanceof Node && ctx && ctx.doc) return key.toString({
- anchors: /* @__PURE__ */ Object.create(null),
- doc: ctx.doc,
- indent: "",
- indentStep: ctx.indentStep,
- inFlow: true,
- inStringifyKey: true,
- stringify: ctx.stringify
- });
- return JSON.stringify(jsKey);
- };
- var Pair = class _Pair extends Node {
- constructor(key, value = null) {
- super();
- this.key = key;
- this.value = value;
- this.type = _Pair.Type.PAIR;
- }
- get commentBefore() {
- return this.key instanceof Node ? this.key.commentBefore : void 0;
- }
- set commentBefore(cb) {
- if (this.key == null) this.key = new Scalar(null);
- if (this.key instanceof Node) this.key.commentBefore = cb;
- else {
- const msg = "Pair.commentBefore is an alias for Pair.key.commentBefore. To set it, the key must be a Node.";
- throw new Error(msg);
- }
- }
- addToJSMap(ctx, map) {
- const key = toJSON(this.key, "", ctx);
- if (map instanceof Map) {
- const value = toJSON(this.value, key, ctx);
- map.set(key, value);
- } else if (map instanceof Set) {
- map.add(key);
- } else {
- const stringKey = stringifyKey(this.key, key, ctx);
- const value = toJSON(this.value, stringKey, ctx);
- if (stringKey in map) Object.defineProperty(map, stringKey, {
- value,
- writable: true,
- enumerable: true,
- configurable: true
- });
- else map[stringKey] = value;
- }
- return map;
- }
- toJSON(_2, ctx) {
- const pair = ctx && ctx.mapAsMap ? /* @__PURE__ */ new Map() : {};
- return this.addToJSMap(ctx, pair);
- }
- toString(ctx, onComment, onChompKeep) {
- if (!ctx || !ctx.doc) return JSON.stringify(this);
- const {
- indent: indentSize,
- indentSeq,
- simpleKeys
- } = ctx.doc.options;
- let {
- key,
- value
- } = this;
- let keyComment = key instanceof Node && key.comment;
- if (simpleKeys) {
- if (keyComment) {
- throw new Error("With simple keys, key nodes cannot have comments");
- }
- if (key instanceof Collection) {
- const msg = "With simple keys, collection cannot be used as a key value";
- throw new Error(msg);
- }
- }
- let explicitKey = !simpleKeys && (!key || keyComment || (key instanceof Node ? key instanceof Collection || key.type === PlainValue.Type.BLOCK_FOLDED || key.type === PlainValue.Type.BLOCK_LITERAL : typeof key === "object"));
- const {
- doc,
- indent,
- indentStep,
- stringify: stringify2
- } = ctx;
- ctx = Object.assign({}, ctx, {
- implicitKey: !explicitKey,
- indent: indent + indentStep
- });
- let chompKeep = false;
- let str = stringify2(key, ctx, () => keyComment = null, () => chompKeep = true);
- str = addComment(str, ctx.indent, keyComment);
- if (!explicitKey && str.length > 1024) {
- if (simpleKeys) throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
- explicitKey = true;
- }
- if (ctx.allNullValues && !simpleKeys) {
- if (this.comment) {
- str = addComment(str, ctx.indent, this.comment);
- if (onComment) onComment();
- } else if (chompKeep && !keyComment && onChompKeep) onChompKeep();
- return ctx.inFlow && !explicitKey ? str : `? ${str}`;
- }
- str = explicitKey ? `? ${str}
-${indent}:` : `${str}:`;
- if (this.comment) {
- str = addComment(str, ctx.indent, this.comment);
- if (onComment) onComment();
- }
- let vcb = "";
- let valueComment = null;
- if (value instanceof Node) {
- if (value.spaceBefore) vcb = "\n";
- if (value.commentBefore) {
- const cs = value.commentBefore.replace(/^/gm, `${ctx.indent}#`);
- vcb += `
-${cs}`;
- }
- valueComment = value.comment;
- } else if (value && typeof value === "object") {
- value = doc.schema.createNode(value, true);
- }
- ctx.implicitKey = false;
- if (!explicitKey && !this.comment && value instanceof Scalar) ctx.indentAtStart = str.length + 1;
- chompKeep = false;
- if (!indentSeq && indentSize >= 2 && !ctx.inFlow && !explicitKey && value instanceof YAMLSeq && value.type !== PlainValue.Type.FLOW_SEQ && !value.tag && !doc.anchors.getName(value)) {
- ctx.indent = ctx.indent.substr(2);
- }
- const valueStr = stringify2(value, ctx, () => valueComment = null, () => chompKeep = true);
- let ws = " ";
- if (vcb || this.comment) {
- ws = `${vcb}
-${ctx.indent}`;
- } else if (!explicitKey && value instanceof Collection) {
- const flow = valueStr[0] === "[" || valueStr[0] === "{";
- if (!flow || valueStr.includes("\n")) ws = `
-${ctx.indent}`;
- } else if (valueStr[0] === "\n") ws = "";
- if (chompKeep && !valueComment && onChompKeep) onChompKeep();
- return addComment(str + ws + valueStr, ctx.indent, valueComment);
- }
- };
- PlainValue._defineProperty(Pair, "Type", {
- PAIR: "PAIR",
- MERGE_PAIR: "MERGE_PAIR"
- });
- var getAliasCount = (node, anchors) => {
- if (node instanceof Alias) {
- const anchor = anchors.get(node.source);
- return anchor.count * anchor.aliasCount;
- } else if (node instanceof Collection) {
- let count = 0;
- for (const item of node.items) {
- const c = getAliasCount(item, anchors);
- if (c > count) count = c;
- }
- return count;
- } else if (node instanceof Pair) {
- const kc = getAliasCount(node.key, anchors);
- const vc = getAliasCount(node.value, anchors);
- return Math.max(kc, vc);
- }
- return 1;
- };
- var Alias = class _Alias extends Node {
- static stringify({
- range,
- source
- }, {
- anchors,
- doc,
- implicitKey,
- inStringifyKey
- }) {
- let anchor = Object.keys(anchors).find((a) => anchors[a] === source);
- if (!anchor && inStringifyKey) anchor = doc.anchors.getName(source) || doc.anchors.newName();
- if (anchor) return `*${anchor}${implicitKey ? " " : ""}`;
- const msg = doc.anchors.getName(source) ? "Alias node must be after source node" : "Source node not found for alias node";
- throw new Error(`${msg} [${range}]`);
- }
- constructor(source) {
- super();
- this.source = source;
- this.type = PlainValue.Type.ALIAS;
- }
- set tag(t) {
- throw new Error("Alias nodes cannot have tags");
- }
- toJSON(arg, ctx) {
- if (!ctx) return toJSON(this.source, arg, ctx);
- const {
- anchors,
- maxAliasCount
- } = ctx;
- const anchor = anchors.get(this.source);
- if (!anchor || anchor.res === void 0) {
- const msg = "This should not happen: Alias anchor was not resolved?";
- if (this.cstNode) throw new PlainValue.YAMLReferenceError(this.cstNode, msg);
- else throw new ReferenceError(msg);
- }
- if (maxAliasCount >= 0) {
- anchor.count += 1;
- if (anchor.aliasCount === 0) anchor.aliasCount = getAliasCount(this.source, anchors);
- if (anchor.count * anchor.aliasCount > maxAliasCount) {
- const msg = "Excessive alias count indicates a resource exhaustion attack";
- if (this.cstNode) throw new PlainValue.YAMLReferenceError(this.cstNode, msg);
- else throw new ReferenceError(msg);
- }
- }
- return anchor.res;
- }
- // Only called when stringifying an alias mapping key while constructing
- // Object output.
- toString(ctx) {
- return _Alias.stringify(this, ctx);
- }
- };
- PlainValue._defineProperty(Alias, "default", true);
- function findPair(items, key) {
- const k = key instanceof Scalar ? key.value : key;
- for (const it of items) {
- if (it instanceof Pair) {
- if (it.key === key || it.key === k) return it;
- if (it.key && it.key.value === k) return it;
- }
- }
- return void 0;
- }
- var YAMLMap = class extends Collection {
- add(pair, overwrite) {
- if (!pair) pair = new Pair(pair);
- else if (!(pair instanceof Pair)) pair = new Pair(pair.key || pair, pair.value);
- const prev = findPair(this.items, pair.key);
- const sortEntries = this.schema && this.schema.sortMapEntries;
- if (prev) {
- if (overwrite) prev.value = pair.value;
- else throw new Error(`Key ${pair.key} already set`);
- } else if (sortEntries) {
- const i = this.items.findIndex((item) => sortEntries(pair, item) < 0);
- if (i === -1) this.items.push(pair);
- else this.items.splice(i, 0, pair);
- } else {
- this.items.push(pair);
- }
- }
- delete(key) {
- const it = findPair(this.items, key);
- if (!it) return false;
- const del = this.items.splice(this.items.indexOf(it), 1);
- return del.length > 0;
- }
- get(key, keepScalar) {
- const it = findPair(this.items, key);
- const node = it && it.value;
- return !keepScalar && node instanceof Scalar ? node.value : node;
- }
- has(key) {
- return !!findPair(this.items, key);
- }
- set(key, value) {
- this.add(new Pair(key, value), true);
- }
- /**
- * @param {*} arg ignored
- * @param {*} ctx Conversion context, originally set in Document#toJSON()
- * @param {Class} Type If set, forces the returned collection type
- * @returns {*} Instance of Type, Map, or Object
- */
- toJSON(_2, ctx, Type) {
- const map = Type ? new Type() : ctx && ctx.mapAsMap ? /* @__PURE__ */ new Map() : {};
- if (ctx && ctx.onCreate) ctx.onCreate(map);
- for (const item of this.items) item.addToJSMap(ctx, map);
- return map;
- }
- toString(ctx, onComment, onChompKeep) {
- if (!ctx) return JSON.stringify(this);
- for (const item of this.items) {
- if (!(item instanceof Pair)) throw new Error(`Map items must all be pairs; found ${JSON.stringify(item)} instead`);
- }
- return super.toString(ctx, {
- blockItem: (n) => n.str,
- flowChars: {
- start: "{",
- end: "}"
- },
- isMap: true,
- itemIndent: ctx.indent || ""
- }, onComment, onChompKeep);
- }
- };
- var MERGE_KEY = "<<";
- var Merge = class extends Pair {
- constructor(pair) {
- if (pair instanceof Pair) {
- let seq = pair.value;
- if (!(seq instanceof YAMLSeq)) {
- seq = new YAMLSeq();
- seq.items.push(pair.value);
- seq.range = pair.value.range;
- }
- super(pair.key, seq);
- this.range = pair.range;
- } else {
- super(new Scalar(MERGE_KEY), new YAMLSeq());
- }
- this.type = Pair.Type.MERGE_PAIR;
- }
- // If the value associated with a merge key is a single mapping node, each of
- // its key/value pairs is inserted into the current mapping, unless the key
- // already exists in it. If the value associated with the merge key is a
- // sequence, then this sequence is expected to contain mapping nodes and each
- // of these nodes is merged in turn according to its order in the sequence.
- // Keys in mapping nodes earlier in the sequence override keys specified in
- // later mapping nodes. -- http://yaml.org/type/merge.html
- addToJSMap(ctx, map) {
- for (const {
- source
- } of this.value.items) {
- if (!(source instanceof YAMLMap)) throw new Error("Merge sources must be maps");
- const srcMap = source.toJSON(null, ctx, Map);
- for (const [key, value] of srcMap) {
- if (map instanceof Map) {
- if (!map.has(key)) map.set(key, value);
- } else if (map instanceof Set) {
- map.add(key);
- } else if (!Object.prototype.hasOwnProperty.call(map, key)) {
- Object.defineProperty(map, key, {
- value,
- writable: true,
- enumerable: true,
- configurable: true
- });
- }
- }
- }
- return map;
- }
- toString(ctx, onComment) {
- const seq = this.value;
- if (seq.items.length > 1) return super.toString(ctx, onComment);
- this.value = seq.items[0];
- const str = super.toString(ctx, onComment);
- this.value = seq;
- return str;
- }
- };
- var binaryOptions = {
- defaultType: PlainValue.Type.BLOCK_LITERAL,
- lineWidth: 76
- };
- var boolOptions = {
- trueStr: "true",
- falseStr: "false"
- };
- var intOptions = {
- asBigInt: false
- };
- var nullOptions = {
- nullStr: "null"
- };
- var strOptions = {
- defaultType: PlainValue.Type.PLAIN,
- doubleQuoted: {
- jsonEncoding: false,
- minMultiLineLength: 40
- },
- fold: {
- lineWidth: 80,
- minContentWidth: 20
- }
- };
- function resolveScalar(str, tags, scalarFallback) {
- for (const {
- format,
- test,
- resolve
- } of tags) {
- if (test) {
- const match = str.match(test);
- if (match) {
- let res = resolve.apply(null, match);
- if (!(res instanceof Scalar)) res = new Scalar(res);
- if (format) res.format = format;
- return res;
- }
- }
- }
- if (scalarFallback) str = scalarFallback(str);
- return new Scalar(str);
- }
- var FOLD_FLOW = "flow";
- var FOLD_BLOCK = "block";
- var FOLD_QUOTED = "quoted";
- var consumeMoreIndentedLines = (text, i) => {
- let ch = text[i + 1];
- while (ch === " " || ch === " ") {
- do {
- ch = text[i += 1];
- } while (ch && ch !== "\n");
- ch = text[i + 1];
- }
- return i;
- };
- function foldFlowLines(text, indent, mode, {
- indentAtStart,
- lineWidth = 80,
- minContentWidth = 20,
- onFold,
- onOverflow
- }) {
- if (!lineWidth || lineWidth < 0) return text;
- const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);
- if (text.length <= endStep) return text;
- const folds = [];
- const escapedFolds = {};
- let end = lineWidth - indent.length;
- if (typeof indentAtStart === "number") {
- if (indentAtStart > lineWidth - Math.max(2, minContentWidth)) folds.push(0);
- else end = lineWidth - indentAtStart;
- }
- let split = void 0;
- let prev = void 0;
- let overflow = false;
- let i = -1;
- let escStart = -1;
- let escEnd = -1;
- if (mode === FOLD_BLOCK) {
- i = consumeMoreIndentedLines(text, i);
- if (i !== -1) end = i + endStep;
- }
- for (let ch; ch = text[i += 1]; ) {
- if (mode === FOLD_QUOTED && ch === "\\") {
- escStart = i;
- switch (text[i + 1]) {
- case "x":
- i += 3;
- break;
- case "u":
- i += 5;
- break;
- case "U":
- i += 9;
- break;
- default:
- i += 1;
- }
- escEnd = i;
- }
- if (ch === "\n") {
- if (mode === FOLD_BLOCK) i = consumeMoreIndentedLines(text, i);
- end = i + endStep;
- split = void 0;
- } else {
- if (ch === " " && prev && prev !== " " && prev !== "\n" && prev !== " ") {
- const next = text[i + 1];
- if (next && next !== " " && next !== "\n" && next !== " ") split = i;
- }
- if (i >= end) {
- if (split) {
- folds.push(split);
- end = split + endStep;
- split = void 0;
- } else if (mode === FOLD_QUOTED) {
- while (prev === " " || prev === " ") {
- prev = ch;
- ch = text[i += 1];
- overflow = true;
- }
- const j = i > escEnd + 1 ? i - 2 : escStart - 1;
- if (escapedFolds[j]) return text;
- folds.push(j);
- escapedFolds[j] = true;
- end = j + endStep;
- split = void 0;
- } else {
- overflow = true;
- }
- }
- }
- prev = ch;
- }
- if (overflow && onOverflow) onOverflow();
- if (folds.length === 0) return text;
- if (onFold) onFold();
- let res = text.slice(0, folds[0]);
- for (let i2 = 0; i2 < folds.length; ++i2) {
- const fold = folds[i2];
- const end2 = folds[i2 + 1] || text.length;
- if (fold === 0) res = `
-${indent}${text.slice(0, end2)}`;
- else {
- if (mode === FOLD_QUOTED && escapedFolds[fold]) res += `${text[fold]}\\`;
- res += `
-${indent}${text.slice(fold + 1, end2)}`;
- }
- }
- return res;
- }
- var getFoldOptions = ({
- indentAtStart
- }) => indentAtStart ? Object.assign({
- indentAtStart
- }, strOptions.fold) : strOptions.fold;
- var containsDocumentMarker = (str) => /^(%|---|\.\.\.)/m.test(str);
- function lineLengthOverLimit(str, lineWidth, indentLength) {
- if (!lineWidth || lineWidth < 0) return false;
- const limit = lineWidth - indentLength;
- const strLen = str.length;
- if (strLen <= limit) return false;
- for (let i = 0, start = 0; i < strLen; ++i) {
- if (str[i] === "\n") {
- if (i - start > limit) return true;
- start = i + 1;
- if (strLen - start <= limit) return false;
- }
- }
- return true;
- }
- function doubleQuotedString(value, ctx) {
- const {
- implicitKey
- } = ctx;
- const {
- jsonEncoding,
- minMultiLineLength
- } = strOptions.doubleQuoted;
- const json = JSON.stringify(value);
- if (jsonEncoding) return json;
- const indent = ctx.indent || (containsDocumentMarker(value) ? " " : "");
- let str = "";
- let start = 0;
- for (let i = 0, ch = json[i]; ch; ch = json[++i]) {
- if (ch === " " && json[i + 1] === "\\" && json[i + 2] === "n") {
- str += json.slice(start, i) + "\\ ";
- i += 1;
- start = i;
- ch = "\\";
- }
- if (ch === "\\") switch (json[i + 1]) {
- case "u":
- {
- str += json.slice(start, i);
- const code = json.substr(i + 2, 4);
- switch (code) {
- case "0000":
- str += "\\0";
- break;
- case "0007":
- str += "\\a";
- break;
- case "000b":
- str += "\\v";
- break;
- case "001b":
- str += "\\e";
- break;
- case "0085":
- str += "\\N";
- break;
- case "00a0":
- str += "\\_";
- break;
- case "2028":
- str += "\\L";
- break;
- case "2029":
- str += "\\P";
- break;
- default:
- if (code.substr(0, 2) === "00") str += "\\x" + code.substr(2);
- else str += json.substr(i, 6);
- }
- i += 5;
- start = i + 1;
- }
- break;
- case "n":
- if (implicitKey || json[i + 2] === '"' || json.length < minMultiLineLength) {
- i += 1;
- } else {
- str += json.slice(start, i) + "\n\n";
- while (json[i + 2] === "\\" && json[i + 3] === "n" && json[i + 4] !== '"') {
- str += "\n";
- i += 2;
- }
- str += indent;
- if (json[i + 2] === " ") str += "\\";
- i += 1;
- start = i + 1;
- }
- break;
- default:
- i += 1;
- }
- }
- str = start ? str + json.slice(start) : json;
- return implicitKey ? str : foldFlowLines(str, indent, FOLD_QUOTED, getFoldOptions(ctx));
- }
- function singleQuotedString(value, ctx) {
- if (ctx.implicitKey) {
- if (/\n/.test(value)) return doubleQuotedString(value, ctx);
- } else {
- if (/[ \t]\n|\n[ \t]/.test(value)) return doubleQuotedString(value, ctx);
- }
- const indent = ctx.indent || (containsDocumentMarker(value) ? " " : "");
- const res = "'" + value.replace(/'/g, "''").replace(/\n+/g, `$&
-${indent}`) + "'";
- return ctx.implicitKey ? res : foldFlowLines(res, indent, FOLD_FLOW, getFoldOptions(ctx));
- }
- function blockString({
- comment,
- type,
- value
- }, ctx, onComment, onChompKeep) {
- if (/\n[\t ]+$/.test(value) || /^\s*$/.test(value)) {
- return doubleQuotedString(value, ctx);
- }
- const indent = ctx.indent || (ctx.forceBlockIndent || containsDocumentMarker(value) ? " " : "");
- const indentSize = indent ? "2" : "1";
- const literal = type === PlainValue.Type.BLOCK_FOLDED ? false : type === PlainValue.Type.BLOCK_LITERAL ? true : !lineLengthOverLimit(value, strOptions.fold.lineWidth, indent.length);
- let header = literal ? "|" : ">";
- if (!value) return header + "\n";
- let wsStart = "";
- let wsEnd = "";
- value = value.replace(/[\n\t ]*$/, (ws) => {
- const n = ws.indexOf("\n");
- if (n === -1) {
- header += "-";
- } else if (value === ws || n !== ws.length - 1) {
- header += "+";
- if (onChompKeep) onChompKeep();
- }
- wsEnd = ws.replace(/\n$/, "");
- return "";
- }).replace(/^[\n ]*/, (ws) => {
- if (ws.indexOf(" ") !== -1) header += indentSize;
- const m = ws.match(/ +$/);
- if (m) {
- wsStart = ws.slice(0, -m[0].length);
- return m[0];
- } else {
- wsStart = ws;
- return "";
- }
- });
- if (wsEnd) wsEnd = wsEnd.replace(/\n+(?!\n|$)/g, `$&${indent}`);
- if (wsStart) wsStart = wsStart.replace(/\n+/g, `$&${indent}`);
- if (comment) {
- header += " #" + comment.replace(/ ?[\r\n]+/g, " ");
- if (onComment) onComment();
- }
- if (!value) return `${header}${indentSize}
-${indent}${wsEnd}`;
- if (literal) {
- value = value.replace(/\n+/g, `$&${indent}`);
- return `${header}
-${indent}${wsStart}${value}${wsEnd}`;
- }
- value = value.replace(/\n+/g, "\n$&").replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${indent}`);
- const body = foldFlowLines(`${wsStart}${value}${wsEnd}`, indent, FOLD_BLOCK, strOptions.fold);
- return `${header}
-${indent}${body}`;
- }
- function plainString(item, ctx, onComment, onChompKeep) {
- const {
- comment,
- type,
- value
- } = item;
- const {
- actualString,
- implicitKey,
- indent,
- inFlow
- } = ctx;
- if (implicitKey && /[\n[\]{},]/.test(value) || inFlow && /[[\]{},]/.test(value)) {
- return doubleQuotedString(value, ctx);
- }
- if (!value || /^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
- return implicitKey || inFlow || value.indexOf("\n") === -1 ? value.indexOf('"') !== -1 && value.indexOf("'") === -1 ? singleQuotedString(value, ctx) : doubleQuotedString(value, ctx) : blockString(item, ctx, onComment, onChompKeep);
- }
- if (!implicitKey && !inFlow && type !== PlainValue.Type.PLAIN && value.indexOf("\n") !== -1) {
- return blockString(item, ctx, onComment, onChompKeep);
- }
- if (indent === "" && containsDocumentMarker(value)) {
- ctx.forceBlockIndent = true;
- return blockString(item, ctx, onComment, onChompKeep);
- }
- const str = value.replace(/\n+/g, `$&
-${indent}`);
- if (actualString) {
- const {
- tags
- } = ctx.doc.schema;
- const resolved = resolveScalar(str, tags, tags.scalarFallback).value;
- if (typeof resolved !== "string") return doubleQuotedString(value, ctx);
- }
- const body = implicitKey ? str : foldFlowLines(str, indent, FOLD_FLOW, getFoldOptions(ctx));
- if (comment && !inFlow && (body.indexOf("\n") !== -1 || comment.indexOf("\n") !== -1)) {
- if (onComment) onComment();
- return addCommentBefore(body, indent, comment);
- }
- return body;
- }
- function stringifyString(item, ctx, onComment, onChompKeep) {
- const {
- defaultType
- } = strOptions;
- const {
- implicitKey,
- inFlow
- } = ctx;
- let {
- type,
- value
- } = item;
- if (typeof value !== "string") {
- value = String(value);
- item = Object.assign({}, item, {
- value
- });
- }
- const _stringify = (_type) => {
- switch (_type) {
- case PlainValue.Type.BLOCK_FOLDED:
- case PlainValue.Type.BLOCK_LITERAL:
- return blockString(item, ctx, onComment, onChompKeep);
- case PlainValue.Type.QUOTE_DOUBLE:
- return doubleQuotedString(value, ctx);
- case PlainValue.Type.QUOTE_SINGLE:
- return singleQuotedString(value, ctx);
- case PlainValue.Type.PLAIN:
- return plainString(item, ctx, onComment, onChompKeep);
- default:
- return null;
- }
- };
- if (type !== PlainValue.Type.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f]/.test(value)) {
- type = PlainValue.Type.QUOTE_DOUBLE;
- } else if ((implicitKey || inFlow) && (type === PlainValue.Type.BLOCK_FOLDED || type === PlainValue.Type.BLOCK_LITERAL)) {
- type = PlainValue.Type.QUOTE_DOUBLE;
- }
- let res = _stringify(type);
- if (res === null) {
- res = _stringify(defaultType);
- if (res === null) throw new Error(`Unsupported default string type ${defaultType}`);
- }
- return res;
- }
- function stringifyNumber({
- format,
- minFractionDigits,
- tag,
- value
- }) {
- if (typeof value === "bigint") return String(value);
- if (!isFinite(value)) return isNaN(value) ? ".nan" : value < 0 ? "-.inf" : ".inf";
- let n = JSON.stringify(value);
- if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^\d/.test(n)) {
- let i = n.indexOf(".");
- if (i < 0) {
- i = n.length;
- n += ".";
- }
- let d = minFractionDigits - (n.length - i - 1);
- while (d-- > 0) n += "0";
- }
- return n;
- }
- function checkFlowCollectionEnd(errors, cst) {
- let char, name;
- switch (cst.type) {
- case PlainValue.Type.FLOW_MAP:
- char = "}";
- name = "flow map";
- break;
- case PlainValue.Type.FLOW_SEQ:
- char = "]";
- name = "flow sequence";
- break;
- default:
- errors.push(new PlainValue.YAMLSemanticError(cst, "Not a flow collection!?"));
- return;
- }
- let lastItem;
- for (let i = cst.items.length - 1; i >= 0; --i) {
- const item = cst.items[i];
- if (!item || item.type !== PlainValue.Type.COMMENT) {
- lastItem = item;
- break;
- }
- }
- if (lastItem && lastItem.char !== char) {
- const msg = `Expected ${name} to end with ${char}`;
- let err;
- if (typeof lastItem.offset === "number") {
- err = new PlainValue.YAMLSemanticError(cst, msg);
- err.offset = lastItem.offset + 1;
- } else {
- err = new PlainValue.YAMLSemanticError(lastItem, msg);
- if (lastItem.range && lastItem.range.end) err.offset = lastItem.range.end - lastItem.range.start;
- }
- errors.push(err);
- }
- }
- function checkFlowCommentSpace(errors, comment) {
- const prev = comment.context.src[comment.range.start - 1];
- if (prev !== "\n" && prev !== " " && prev !== " ") {
- const msg = "Comments must be separated from other tokens by white space characters";
- errors.push(new PlainValue.YAMLSemanticError(comment, msg));
- }
- }
- function getLongKeyError(source, key) {
- const sk = String(key);
- const k = sk.substr(0, 8) + "..." + sk.substr(-8);
- return new PlainValue.YAMLSemanticError(source, `The "${k}" key is too long`);
- }
- function resolveComments(collection, comments) {
- for (const {
- afterKey,
- before,
- comment
- } of comments) {
- let item = collection.items[before];
- if (!item) {
- if (comment !== void 0) {
- if (collection.comment) collection.comment += "\n" + comment;
- else collection.comment = comment;
- }
- } else {
- if (afterKey && item.value) item = item.value;
- if (comment === void 0) {
- if (afterKey || !item.commentBefore) item.spaceBefore = true;
- } else {
- if (item.commentBefore) item.commentBefore += "\n" + comment;
- else item.commentBefore = comment;
- }
- }
- }
- }
- function resolveString(doc, node) {
- const res = node.strValue;
- if (!res) return "";
- if (typeof res === "string") return res;
- res.errors.forEach((error) => {
- if (!error.source) error.source = node;
- doc.errors.push(error);
- });
- return res.str;
- }
- function resolveTagHandle(doc, node) {
- const {
- handle,
- suffix
- } = node.tag;
- let prefix = doc.tagPrefixes.find((p) => p.handle === handle);
- if (!prefix) {
- const dtp = doc.getDefaults().tagPrefixes;
- if (dtp) prefix = dtp.find((p) => p.handle === handle);
- if (!prefix) throw new PlainValue.YAMLSemanticError(node, `The ${handle} tag handle is non-default and was not declared.`);
- }
- if (!suffix) throw new PlainValue.YAMLSemanticError(node, `The ${handle} tag has no suffix.`);
- if (handle === "!" && (doc.version || doc.options.version) === "1.0") {
- if (suffix[0] === "^") {
- doc.warnings.push(new PlainValue.YAMLWarning(node, "YAML 1.0 ^ tag expansion is not supported"));
- return suffix;
- }
- if (/[:/]/.test(suffix)) {
- const vocab = suffix.match(/^([a-z0-9-]+)\/(.*)/i);
- return vocab ? `tag:${vocab[1]}.yaml.org,2002:${vocab[2]}` : `tag:${suffix}`;
- }
- }
- return prefix.prefix + decodeURIComponent(suffix);
- }
- function resolveTagName(doc, node) {
- const {
- tag,
- type
- } = node;
- let nonSpecific = false;
- if (tag) {
- const {
- handle,
- suffix,
- verbatim
- } = tag;
- if (verbatim) {
- if (verbatim !== "!" && verbatim !== "!!") return verbatim;
- const msg = `Verbatim tags aren't resolved, so ${verbatim} is invalid.`;
- doc.errors.push(new PlainValue.YAMLSemanticError(node, msg));
- } else if (handle === "!" && !suffix) {
- nonSpecific = true;
- } else {
- try {
- return resolveTagHandle(doc, node);
- } catch (error) {
- doc.errors.push(error);
- }
- }
- }
- switch (type) {
- case PlainValue.Type.BLOCK_FOLDED:
- case PlainValue.Type.BLOCK_LITERAL:
- case PlainValue.Type.QUOTE_DOUBLE:
- case PlainValue.Type.QUOTE_SINGLE:
- return PlainValue.defaultTags.STR;
- case PlainValue.Type.FLOW_MAP:
- case PlainValue.Type.MAP:
- return PlainValue.defaultTags.MAP;
- case PlainValue.Type.FLOW_SEQ:
- case PlainValue.Type.SEQ:
- return PlainValue.defaultTags.SEQ;
- case PlainValue.Type.PLAIN:
- return nonSpecific ? PlainValue.defaultTags.STR : null;
- default:
- return null;
- }
- }
- function resolveByTagName(doc, node, tagName) {
- const {
- tags
- } = doc.schema;
- const matchWithTest = [];
- for (const tag of tags) {
- if (tag.tag === tagName) {
- if (tag.test) matchWithTest.push(tag);
- else {
- const res = tag.resolve(doc, node);
- return res instanceof Collection ? res : new Scalar(res);
- }
- }
- }
- const str = resolveString(doc, node);
- if (typeof str === "string" && matchWithTest.length > 0) return resolveScalar(str, matchWithTest, tags.scalarFallback);
- return null;
- }
- function getFallbackTagName({
- type
- }) {
- switch (type) {
- case PlainValue.Type.FLOW_MAP:
- case PlainValue.Type.MAP:
- return PlainValue.defaultTags.MAP;
- case PlainValue.Type.FLOW_SEQ:
- case PlainValue.Type.SEQ:
- return PlainValue.defaultTags.SEQ;
- default:
- return PlainValue.defaultTags.STR;
- }
- }
- function resolveTag(doc, node, tagName) {
- try {
- const res = resolveByTagName(doc, node, tagName);
- if (res) {
- if (tagName && node.tag) res.tag = tagName;
- return res;
- }
- } catch (error) {
- if (!error.source) error.source = node;
- doc.errors.push(error);
- return null;
- }
- try {
- const fallback = getFallbackTagName(node);
- if (!fallback) throw new Error(`The tag ${tagName} is unavailable`);
- const msg = `The tag ${tagName} is unavailable, falling back to ${fallback}`;
- doc.warnings.push(new PlainValue.YAMLWarning(node, msg));
- const res = resolveByTagName(doc, node, fallback);
- res.tag = tagName;
- return res;
- } catch (error) {
- const refError = new PlainValue.YAMLReferenceError(node, error.message);
- refError.stack = error.stack;
- doc.errors.push(refError);
- return null;
- }
- }
- var isCollectionItem = (node) => {
- if (!node) return false;
- const {
- type
- } = node;
- return type === PlainValue.Type.MAP_KEY || type === PlainValue.Type.MAP_VALUE || type === PlainValue.Type.SEQ_ITEM;
- };
- function resolveNodeProps(errors, node) {
- const comments = {
- before: [],
- after: []
- };
- let hasAnchor = false;
- let hasTag = false;
- const props = isCollectionItem(node.context.parent) ? node.context.parent.props.concat(node.props) : node.props;
- for (const {
- start,
- end
- } of props) {
- switch (node.context.src[start]) {
- case PlainValue.Char.COMMENT: {
- if (!node.commentHasRequiredWhitespace(start)) {
- const msg = "Comments must be separated from other tokens by white space characters";
- errors.push(new PlainValue.YAMLSemanticError(node, msg));
- }
- const {
- header,
- valueRange
- } = node;
- const cc = valueRange && (start > valueRange.start || header && start > header.start) ? comments.after : comments.before;
- cc.push(node.context.src.slice(start + 1, end));
- break;
- }
- case PlainValue.Char.ANCHOR:
- if (hasAnchor) {
- const msg = "A node can have at most one anchor";
- errors.push(new PlainValue.YAMLSemanticError(node, msg));
- }
- hasAnchor = true;
- break;
- case PlainValue.Char.TAG:
- if (hasTag) {
- const msg = "A node can have at most one tag";
- errors.push(new PlainValue.YAMLSemanticError(node, msg));
- }
- hasTag = true;
- break;
- }
- }
- return {
- comments,
- hasAnchor,
- hasTag
- };
- }
- function resolveNodeValue(doc, node) {
- const {
- anchors,
- errors,
- schema: schema2
- } = doc;
- if (node.type === PlainValue.Type.ALIAS) {
- const name = node.rawValue;
- const src = anchors.getNode(name);
- if (!src) {
- const msg = `Aliased anchor not found: ${name}`;
- errors.push(new PlainValue.YAMLReferenceError(node, msg));
- return null;
- }
- const res = new Alias(src);
- anchors._cstAliases.push(res);
- return res;
- }
- const tagName = resolveTagName(doc, node);
- if (tagName) return resolveTag(doc, node, tagName);
- if (node.type !== PlainValue.Type.PLAIN) {
- const msg = `Failed to resolve ${node.type} node here`;
- errors.push(new PlainValue.YAMLSyntaxError(node, msg));
- return null;
- }
- try {
- const str = resolveString(doc, node);
- return resolveScalar(str, schema2.tags, schema2.tags.scalarFallback);
- } catch (error) {
- if (!error.source) error.source = node;
- errors.push(error);
- return null;
- }
- }
- function resolveNode(doc, node) {
- if (!node) return null;
- if (node.error) doc.errors.push(node.error);
- const {
- comments,
- hasAnchor,
- hasTag
- } = resolveNodeProps(doc.errors, node);
- if (hasAnchor) {
- const {
- anchors
- } = doc;
- const name = node.anchor;
- const prev = anchors.getNode(name);
- if (prev) anchors.map[anchors.newName(name)] = prev;
- anchors.map[name] = node;
- }
- if (node.type === PlainValue.Type.ALIAS && (hasAnchor || hasTag)) {
- const msg = "An alias node must not specify any properties";
- doc.errors.push(new PlainValue.YAMLSemanticError(node, msg));
- }
- const res = resolveNodeValue(doc, node);
- if (res) {
- res.range = [node.range.start, node.range.end];
- if (doc.options.keepCstNodes) res.cstNode = node;
- if (doc.options.keepNodeTypes) res.type = node.type;
- const cb = comments.before.join("\n");
- if (cb) {
- res.commentBefore = res.commentBefore ? `${res.commentBefore}
-${cb}` : cb;
- }
- const ca = comments.after.join("\n");
- if (ca) res.comment = res.comment ? `${res.comment}
-${ca}` : ca;
- }
- return node.resolved = res;
- }
- function resolveMap(doc, cst) {
- if (cst.type !== PlainValue.Type.MAP && cst.type !== PlainValue.Type.FLOW_MAP) {
- const msg = `A ${cst.type} node cannot be resolved as a mapping`;
- doc.errors.push(new PlainValue.YAMLSyntaxError(cst, msg));
- return null;
- }
- const {
- comments,
- items
- } = cst.type === PlainValue.Type.FLOW_MAP ? resolveFlowMapItems(doc, cst) : resolveBlockMapItems(doc, cst);
- const map = new YAMLMap();
- map.items = items;
- resolveComments(map, comments);
- let hasCollectionKey = false;
- for (let i = 0; i < items.length; ++i) {
- const {
- key: iKey
- } = items[i];
- if (iKey instanceof Collection) hasCollectionKey = true;
- if (doc.schema.merge && iKey && iKey.value === MERGE_KEY) {
- items[i] = new Merge(items[i]);
- const sources = items[i].value.items;
- let error = null;
- sources.some((node) => {
- if (node instanceof Alias) {
- const {
- type
- } = node.source;
- if (type === PlainValue.Type.MAP || type === PlainValue.Type.FLOW_MAP) return false;
- return error = "Merge nodes aliases can only point to maps";
- }
- return error = "Merge nodes can only have Alias nodes as values";
- });
- if (error) doc.errors.push(new PlainValue.YAMLSemanticError(cst, error));
- } else {
- for (let j = i + 1; j < items.length; ++j) {
- const {
- key: jKey
- } = items[j];
- if (iKey === jKey || iKey && jKey && Object.prototype.hasOwnProperty.call(iKey, "value") && iKey.value === jKey.value) {
- const msg = `Map keys must be unique; "${iKey}" is repeated`;
- doc.errors.push(new PlainValue.YAMLSemanticError(cst, msg));
- break;
- }
- }
- }
- }
- if (hasCollectionKey && !doc.options.mapAsMap) {
- const warn = "Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this.";
- doc.warnings.push(new PlainValue.YAMLWarning(cst, warn));
- }
- cst.resolved = map;
- return map;
- }
- var valueHasPairComment = ({
- context: {
- lineStart,
- node,
- src
- },
- props
- }) => {
- if (props.length === 0) return false;
- const {
- start
- } = props[0];
- if (node && start > node.valueRange.start) return false;
- if (src[start] !== PlainValue.Char.COMMENT) return false;
- for (let i = lineStart; i < start; ++i) if (src[i] === "\n") return false;
- return true;
- };
- function resolvePairComment(item, pair) {
- if (!valueHasPairComment(item)) return;
- const comment = item.getPropValue(0, PlainValue.Char.COMMENT, true);
- let found = false;
- const cb = pair.value.commentBefore;
- if (cb && cb.startsWith(comment)) {
- pair.value.commentBefore = cb.substr(comment.length + 1);
- found = true;
- } else {
- const cc = pair.value.comment;
- if (!item.node && cc && cc.startsWith(comment)) {
- pair.value.comment = cc.substr(comment.length + 1);
- found = true;
- }
- }
- if (found) pair.comment = comment;
- }
- function resolveBlockMapItems(doc, cst) {
- const comments = [];
- const items = [];
- let key = void 0;
- let keyStart = null;
- for (let i = 0; i < cst.items.length; ++i) {
- const item = cst.items[i];
- switch (item.type) {
- case PlainValue.Type.BLANK_LINE:
- comments.push({
- afterKey: !!key,
- before: items.length
- });
- break;
- case PlainValue.Type.COMMENT:
- comments.push({
- afterKey: !!key,
- before: items.length,
- comment: item.comment
- });
- break;
- case PlainValue.Type.MAP_KEY:
- if (key !== void 0) items.push(new Pair(key));
- if (item.error) doc.errors.push(item.error);
- key = resolveNode(doc, item.node);
- keyStart = null;
- break;
- case PlainValue.Type.MAP_VALUE:
- {
- if (key === void 0) key = null;
- if (item.error) doc.errors.push(item.error);
- if (!item.context.atLineStart && item.node && item.node.type === PlainValue.Type.MAP && !item.node.context.atLineStart) {
- const msg = "Nested mappings are not allowed in compact mappings";
- doc.errors.push(new PlainValue.YAMLSemanticError(item.node, msg));
- }
- let valueNode = item.node;
- if (!valueNode && item.props.length > 0) {
- valueNode = new PlainValue.PlainValue(PlainValue.Type.PLAIN, []);
- valueNode.context = {
- parent: item,
- src: item.context.src
- };
- const pos = item.range.start + 1;
- valueNode.range = {
- start: pos,
- end: pos
- };
- valueNode.valueRange = {
- start: pos,
- end: pos
- };
- if (typeof item.range.origStart === "number") {
- const origPos = item.range.origStart + 1;
- valueNode.range.origStart = valueNode.range.origEnd = origPos;
- valueNode.valueRange.origStart = valueNode.valueRange.origEnd = origPos;
- }
- }
- const pair = new Pair(key, resolveNode(doc, valueNode));
- resolvePairComment(item, pair);
- items.push(pair);
- if (key && typeof keyStart === "number") {
- if (item.range.start > keyStart + 1024) doc.errors.push(getLongKeyError(cst, key));
- }
- key = void 0;
- keyStart = null;
- }
- break;
- default:
- if (key !== void 0) items.push(new Pair(key));
- key = resolveNode(doc, item);
- keyStart = item.range.start;
- if (item.error) doc.errors.push(item.error);
- next: for (let j = i + 1; ; ++j) {
- const nextItem = cst.items[j];
- switch (nextItem && nextItem.type) {
- case PlainValue.Type.BLANK_LINE:
- case PlainValue.Type.COMMENT:
- continue next;
- case PlainValue.Type.MAP_VALUE:
- break next;
- default: {
- const msg = "Implicit map keys need to be followed by map values";
- doc.errors.push(new PlainValue.YAMLSemanticError(item, msg));
- break next;
- }
- }
- }
- if (item.valueRangeContainsNewline) {
- const msg = "Implicit map keys need to be on a single line";
- doc.errors.push(new PlainValue.YAMLSemanticError(item, msg));
- }
- }
- }
- if (key !== void 0) items.push(new Pair(key));
- return {
- comments,
- items
- };
- }
- function resolveFlowMapItems(doc, cst) {
- const comments = [];
- const items = [];
- let key = void 0;
- let explicitKey = false;
- let next = "{";
- for (let i = 0; i < cst.items.length; ++i) {
- const item = cst.items[i];
- if (typeof item.char === "string") {
- const {
- char,
- offset
- } = item;
- if (char === "?" && key === void 0 && !explicitKey) {
- explicitKey = true;
- next = ":";
- continue;
- }
- if (char === ":") {
- if (key === void 0) key = null;
- if (next === ":") {
- next = ",";
- continue;
- }
- } else {
- if (explicitKey) {
- if (key === void 0 && char !== ",") key = null;
- explicitKey = false;
- }
- if (key !== void 0) {
- items.push(new Pair(key));
- key = void 0;
- if (char === ",") {
- next = ":";
- continue;
- }
- }
- }
- if (char === "}") {
- if (i === cst.items.length - 1) continue;
- } else if (char === next) {
- next = ":";
- continue;
- }
- const msg = `Flow map contains an unexpected ${char}`;
- const err = new PlainValue.YAMLSyntaxError(cst, msg);
- err.offset = offset;
- doc.errors.push(err);
- } else if (item.type === PlainValue.Type.BLANK_LINE) {
- comments.push({
- afterKey: !!key,
- before: items.length
- });
- } else if (item.type === PlainValue.Type.COMMENT) {
- checkFlowCommentSpace(doc.errors, item);
- comments.push({
- afterKey: !!key,
- before: items.length,
- comment: item.comment
- });
- } else if (key === void 0) {
- if (next === ",") doc.errors.push(new PlainValue.YAMLSemanticError(item, "Separator , missing in flow map"));
- key = resolveNode(doc, item);
- } else {
- if (next !== ",") doc.errors.push(new PlainValue.YAMLSemanticError(item, "Indicator : missing in flow map entry"));
- items.push(new Pair(key, resolveNode(doc, item)));
- key = void 0;
- explicitKey = false;
- }
- }
- checkFlowCollectionEnd(doc.errors, cst);
- if (key !== void 0) items.push(new Pair(key));
- return {
- comments,
- items
- };
- }
- function resolveSeq(doc, cst) {
- if (cst.type !== PlainValue.Type.SEQ && cst.type !== PlainValue.Type.FLOW_SEQ) {
- const msg = `A ${cst.type} node cannot be resolved as a sequence`;
- doc.errors.push(new PlainValue.YAMLSyntaxError(cst, msg));
- return null;
- }
- const {
- comments,
- items
- } = cst.type === PlainValue.Type.FLOW_SEQ ? resolveFlowSeqItems(doc, cst) : resolveBlockSeqItems(doc, cst);
- const seq = new YAMLSeq();
- seq.items = items;
- resolveComments(seq, comments);
- if (!doc.options.mapAsMap && items.some((it) => it instanceof Pair && it.key instanceof Collection)) {
- const warn = "Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this.";
- doc.warnings.push(new PlainValue.YAMLWarning(cst, warn));
- }
- cst.resolved = seq;
- return seq;
- }
- function resolveBlockSeqItems(doc, cst) {
- const comments = [];
- const items = [];
- for (let i = 0; i < cst.items.length; ++i) {
- const item = cst.items[i];
- switch (item.type) {
- case PlainValue.Type.BLANK_LINE:
- comments.push({
- before: items.length
- });
- break;
- case PlainValue.Type.COMMENT:
- comments.push({
- comment: item.comment,
- before: items.length
- });
- break;
- case PlainValue.Type.SEQ_ITEM:
- if (item.error) doc.errors.push(item.error);
- items.push(resolveNode(doc, item.node));
- if (item.hasProps) {
- const msg = "Sequence items cannot have tags or anchors before the - indicator";
- doc.errors.push(new PlainValue.YAMLSemanticError(item, msg));
- }
- break;
- default:
- if (item.error) doc.errors.push(item.error);
- doc.errors.push(new PlainValue.YAMLSyntaxError(item, `Unexpected ${item.type} node in sequence`));
- }
- }
- return {
- comments,
- items
- };
- }
- function resolveFlowSeqItems(doc, cst) {
- const comments = [];
- const items = [];
- let explicitKey = false;
- let key = void 0;
- let keyStart = null;
- let next = "[";
- let prevItem = null;
- for (let i = 0; i < cst.items.length; ++i) {
- const item = cst.items[i];
- if (typeof item.char === "string") {
- const {
- char,
- offset
- } = item;
- if (char !== ":" && (explicitKey || key !== void 0)) {
- if (explicitKey && key === void 0) key = next ? items.pop() : null;
- items.push(new Pair(key));
- explicitKey = false;
- key = void 0;
- keyStart = null;
- }
- if (char === next) {
- next = null;
- } else if (!next && char === "?") {
- explicitKey = true;
- } else if (next !== "[" && char === ":" && key === void 0) {
- if (next === ",") {
- key = items.pop();
- if (key instanceof Pair) {
- const msg = "Chaining flow sequence pairs is invalid";
- const err = new PlainValue.YAMLSemanticError(cst, msg);
- err.offset = offset;
- doc.errors.push(err);
- }
- if (!explicitKey && typeof keyStart === "number") {
- const keyEnd = item.range ? item.range.start : item.offset;
- if (keyEnd > keyStart + 1024) doc.errors.push(getLongKeyError(cst, key));
- const {
- src
- } = prevItem.context;
- for (let i2 = keyStart; i2 < keyEnd; ++i2) if (src[i2] === "\n") {
- const msg = "Implicit keys of flow sequence pairs need to be on a single line";
- doc.errors.push(new PlainValue.YAMLSemanticError(prevItem, msg));
- break;
- }
- }
- } else {
- key = null;
- }
- keyStart = null;
- explicitKey = false;
- next = null;
- } else if (next === "[" || char !== "]" || i < cst.items.length - 1) {
- const msg = `Flow sequence contains an unexpected ${char}`;
- const err = new PlainValue.YAMLSyntaxError(cst, msg);
- err.offset = offset;
- doc.errors.push(err);
- }
- } else if (item.type === PlainValue.Type.BLANK_LINE) {
- comments.push({
- before: items.length
- });
- } else if (item.type === PlainValue.Type.COMMENT) {
- checkFlowCommentSpace(doc.errors, item);
- comments.push({
- comment: item.comment,
- before: items.length
- });
- } else {
- if (next) {
- const msg = `Expected a ${next} in flow sequence`;
- doc.errors.push(new PlainValue.YAMLSemanticError(item, msg));
- }
- const value = resolveNode(doc, item);
- if (key === void 0) {
- items.push(value);
- prevItem = item;
- } else {
- items.push(new Pair(key, value));
- key = void 0;
- }
- keyStart = item.range.start;
- next = ",";
- }
- }
- checkFlowCollectionEnd(doc.errors, cst);
- if (key !== void 0) items.push(new Pair(key));
- return {
- comments,
- items
- };
- }
- exports2.Alias = Alias;
- exports2.Collection = Collection;
- exports2.Merge = Merge;
- exports2.Node = Node;
- exports2.Pair = Pair;
- exports2.Scalar = Scalar;
- exports2.YAMLMap = YAMLMap;
- exports2.YAMLSeq = YAMLSeq;
- exports2.addComment = addComment;
- exports2.binaryOptions = binaryOptions;
- exports2.boolOptions = boolOptions;
- exports2.findPair = findPair;
- exports2.intOptions = intOptions;
- exports2.isEmptyPath = isEmptyPath;
- exports2.nullOptions = nullOptions;
- exports2.resolveMap = resolveMap;
- exports2.resolveNode = resolveNode;
- exports2.resolveSeq = resolveSeq;
- exports2.resolveString = resolveString;
- exports2.strOptions = strOptions;
- exports2.stringifyNumber = stringifyNumber;
- exports2.stringifyString = stringifyString;
- exports2.toJSON = toJSON;
- }
-});
-
-// ../../node_modules/openapi-to-postmanv2/node_modules/yaml/dist/warnings-1000a372.js
-var require_warnings_1000a3722 = __commonJS({
- "../../node_modules/openapi-to-postmanv2/node_modules/yaml/dist/warnings-1000a372.js"(exports2) {
- "use strict";
- var PlainValue = require_PlainValue_ec8e588e2();
- var resolveSeq = require_resolveSeq_d03cb0372();
- var binary = {
- identify: (value) => value instanceof Uint8Array,
- // Buffer inherits from Uint8Array
- default: false,
- tag: "tag:yaml.org,2002:binary",
- /**
- * Returns a Buffer in node and an Uint8Array in browsers
- *
- * To use the resulting buffer as an image, you'll want to do something like:
- *
- * const blob = new Blob([buffer], { type: 'image/jpeg' })
- * document.querySelector('#photo').src = URL.createObjectURL(blob)
- */
- resolve: (doc, node) => {
- const src = resolveSeq.resolveString(doc, node);
- if (typeof Buffer === "function") {
- return Buffer.from(src, "base64");
- } else if (typeof atob === "function") {
- const str = atob(src.replace(/[\n\r]/g, ""));
- const buffer = new Uint8Array(str.length);
- for (let i = 0; i < str.length; ++i) buffer[i] = str.charCodeAt(i);
- return buffer;
- } else {
- const msg = "This environment does not support reading binary tags; either Buffer or atob is required";
- doc.errors.push(new PlainValue.YAMLReferenceError(node, msg));
- return null;
- }
- },
- options: resolveSeq.binaryOptions,
- stringify: ({
- comment,
- type,
- value
- }, ctx, onComment, onChompKeep) => {
- let src;
- if (typeof Buffer === "function") {
- src = value instanceof Buffer ? value.toString("base64") : Buffer.from(value.buffer).toString("base64");
- } else if (typeof btoa === "function") {
- let s = "";
- for (let i = 0; i < value.length; ++i) s += String.fromCharCode(value[i]);
- src = btoa(s);
- } else {
- throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
- }
- if (!type) type = resolveSeq.binaryOptions.defaultType;
- if (type === PlainValue.Type.QUOTE_DOUBLE) {
- value = src;
- } else {
- const {
- lineWidth
- } = resolveSeq.binaryOptions;
- const n = Math.ceil(src.length / lineWidth);
- const lines = new Array(n);
- for (let i = 0, o = 0; i < n; ++i, o += lineWidth) {
- lines[i] = src.substr(o, lineWidth);
- }
- value = lines.join(type === PlainValue.Type.BLOCK_LITERAL ? "\n" : " ");
- }
- return resolveSeq.stringifyString({
- comment,
- type,
- value
- }, ctx, onComment, onChompKeep);
- }
- };
- function parsePairs(doc, cst) {
- const seq = resolveSeq.resolveSeq(doc, cst);
- for (let i = 0; i < seq.items.length; ++i) {
- let item = seq.items[i];
- if (item instanceof resolveSeq.Pair) continue;
- else if (item instanceof resolveSeq.YAMLMap) {
- if (item.items.length > 1) {
- const msg = "Each pair must have its own sequence indicator";
- throw new PlainValue.YAMLSemanticError(cst, msg);
- }
- const pair = item.items[0] || new resolveSeq.Pair();
- if (item.commentBefore) pair.commentBefore = pair.commentBefore ? `${item.commentBefore}
-${pair.commentBefore}` : item.commentBefore;
- if (item.comment) pair.comment = pair.comment ? `${item.comment}
-${pair.comment}` : item.comment;
- item = pair;
- }
- seq.items[i] = item instanceof resolveSeq.Pair ? item : new resolveSeq.Pair(item);
- }
- return seq;
- }
- function createPairs(schema2, iterable, ctx) {
- const pairs2 = new resolveSeq.YAMLSeq(schema2);
- pairs2.tag = "tag:yaml.org,2002:pairs";
- for (const it of iterable) {
- let key, value;
- if (Array.isArray(it)) {
- if (it.length === 2) {
- key = it[0];
- value = it[1];
- } else throw new TypeError(`Expected [key, value] tuple: ${it}`);
- } else if (it && it instanceof Object) {
- const keys = Object.keys(it);
- if (keys.length === 1) {
- key = keys[0];
- value = it[key];
- } else throw new TypeError(`Expected { key: value } tuple: ${it}`);
- } else {
- key = it;
- }
- const pair = schema2.createPair(key, value, ctx);
- pairs2.items.push(pair);
- }
- return pairs2;
- }
- var pairs = {
- default: false,
- tag: "tag:yaml.org,2002:pairs",
- resolve: parsePairs,
- createNode: createPairs
- };
- var YAMLOMap = class _YAMLOMap extends resolveSeq.YAMLSeq {
- constructor() {
- super();
- PlainValue._defineProperty(this, "add", resolveSeq.YAMLMap.prototype.add.bind(this));
- PlainValue._defineProperty(this, "delete", resolveSeq.YAMLMap.prototype.delete.bind(this));
- PlainValue._defineProperty(this, "get", resolveSeq.YAMLMap.prototype.get.bind(this));
- PlainValue._defineProperty(this, "has", resolveSeq.YAMLMap.prototype.has.bind(this));
- PlainValue._defineProperty(this, "set", resolveSeq.YAMLMap.prototype.set.bind(this));
- this.tag = _YAMLOMap.tag;
- }
- toJSON(_2, ctx) {
- const map = /* @__PURE__ */ new Map();
- if (ctx && ctx.onCreate) ctx.onCreate(map);
- for (const pair of this.items) {
- let key, value;
- if (pair instanceof resolveSeq.Pair) {
- key = resolveSeq.toJSON(pair.key, "", ctx);
- value = resolveSeq.toJSON(pair.value, key, ctx);
- } else {
- key = resolveSeq.toJSON(pair, "", ctx);
- }
- if (map.has(key)) throw new Error("Ordered maps must not include duplicate keys");
- map.set(key, value);
- }
- return map;
- }
- };
- PlainValue._defineProperty(YAMLOMap, "tag", "tag:yaml.org,2002:omap");
- function parseOMap(doc, cst) {
- const pairs2 = parsePairs(doc, cst);
- const seenKeys = [];
- for (const {
- key
- } of pairs2.items) {
- if (key instanceof resolveSeq.Scalar) {
- if (seenKeys.includes(key.value)) {
- const msg = "Ordered maps must not include duplicate keys";
- throw new PlainValue.YAMLSemanticError(cst, msg);
- } else {
- seenKeys.push(key.value);
- }
- }
- }
- return Object.assign(new YAMLOMap(), pairs2);
- }
- function createOMap(schema2, iterable, ctx) {
- const pairs2 = createPairs(schema2, iterable, ctx);
- const omap2 = new YAMLOMap();
- omap2.items = pairs2.items;
- return omap2;
- }
- var omap = {
- identify: (value) => value instanceof Map,
- nodeClass: YAMLOMap,
- default: false,
- tag: "tag:yaml.org,2002:omap",
- resolve: parseOMap,
- createNode: createOMap
- };
- var YAMLSet = class _YAMLSet extends resolveSeq.YAMLMap {
- constructor() {
- super();
- this.tag = _YAMLSet.tag;
- }
- add(key) {
- const pair = key instanceof resolveSeq.Pair ? key : new resolveSeq.Pair(key);
- const prev = resolveSeq.findPair(this.items, pair.key);
- if (!prev) this.items.push(pair);
- }
- get(key, keepPair) {
- const pair = resolveSeq.findPair(this.items, key);
- return !keepPair && pair instanceof resolveSeq.Pair ? pair.key instanceof resolveSeq.Scalar ? pair.key.value : pair.key : pair;
- }
- set(key, value) {
- if (typeof value !== "boolean") throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof value}`);
- const prev = resolveSeq.findPair(this.items, key);
- if (prev && !value) {
- this.items.splice(this.items.indexOf(prev), 1);
- } else if (!prev && value) {
- this.items.push(new resolveSeq.Pair(key));
- }
- }
- toJSON(_2, ctx) {
- return super.toJSON(_2, ctx, Set);
- }
- toString(ctx, onComment, onChompKeep) {
- if (!ctx) return JSON.stringify(this);
- if (this.hasAllNullValues()) return super.toString(ctx, onComment, onChompKeep);
- else throw new Error("Set items must all have null values");
- }
- };
- PlainValue._defineProperty(YAMLSet, "tag", "tag:yaml.org,2002:set");
- function parseSet(doc, cst) {
- const map = resolveSeq.resolveMap(doc, cst);
- if (!map.hasAllNullValues()) throw new PlainValue.YAMLSemanticError(cst, "Set items must all have null values");
- return Object.assign(new YAMLSet(), map);
- }
- function createSet(schema2, iterable, ctx) {
- const set2 = new YAMLSet();
- for (const value of iterable) set2.items.push(schema2.createPair(value, null, ctx));
- return set2;
- }
- var set = {
- identify: (value) => value instanceof Set,
- nodeClass: YAMLSet,
- default: false,
- tag: "tag:yaml.org,2002:set",
- resolve: parseSet,
- createNode: createSet
- };
- var parseSexagesimal = (sign, parts) => {
- const n = parts.split(":").reduce((n2, p) => n2 * 60 + Number(p), 0);
- return sign === "-" ? -n : n;
- };
- var stringifySexagesimal = ({
- value
- }) => {
- if (isNaN(value) || !isFinite(value)) return resolveSeq.stringifyNumber(value);
- let sign = "";
- if (value < 0) {
- sign = "-";
- value = Math.abs(value);
- }
- const parts = [value % 60];
- if (value < 60) {
- parts.unshift(0);
- } else {
- value = Math.round((value - parts[0]) / 60);
- parts.unshift(value % 60);
- if (value >= 60) {
- value = Math.round((value - parts[0]) / 60);
- parts.unshift(value);
- }
- }
- return sign + parts.map((n) => n < 10 ? "0" + String(n) : String(n)).join(":").replace(/000000\d*$/, "");
- };
- var intTime = {
- identify: (value) => typeof value === "number",
- default: true,
- tag: "tag:yaml.org,2002:int",
- format: "TIME",
- test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+)$/,
- resolve: (str, sign, parts) => parseSexagesimal(sign, parts.replace(/_/g, "")),
- stringify: stringifySexagesimal
- };
- var floatTime = {
- identify: (value) => typeof value === "number",
- default: true,
- tag: "tag:yaml.org,2002:float",
- format: "TIME",
- test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*)$/,
- resolve: (str, sign, parts) => parseSexagesimal(sign, parts.replace(/_/g, "")),
- stringify: stringifySexagesimal
- };
- var timestamp = {
- identify: (value) => value instanceof Date,
- default: true,
- tag: "tag:yaml.org,2002:timestamp",
- // If the time zone is omitted, the timestamp is assumed to be specified in UTC. The time part
- // may be omitted altogether, resulting in a date format. In such a case, the time part is
- // assumed to be 00:00:00Z (start of day, UTC).
- test: RegExp("^(?:([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?)$"),
- resolve: (str, year, month, day, hour, minute, second, millisec, tz) => {
- if (millisec) millisec = (millisec + "00").substr(1, 3);
- let date = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec || 0);
- if (tz && tz !== "Z") {
- let d = parseSexagesimal(tz[0], tz.slice(1));
- if (Math.abs(d) < 30) d *= 60;
- date -= 6e4 * d;
- }
- return new Date(date);
- },
- stringify: ({
- value
- }) => value.toISOString().replace(/((T00:00)?:00)?\.000Z$/, "")
- };
- function shouldWarn(deprecation) {
- const env = typeof process !== "undefined" && process.env || {};
- if (deprecation) {
- if (typeof YAML_SILENCE_DEPRECATION_WARNINGS !== "undefined") return !YAML_SILENCE_DEPRECATION_WARNINGS;
- return !env.YAML_SILENCE_DEPRECATION_WARNINGS;
- }
- if (typeof YAML_SILENCE_WARNINGS !== "undefined") return !YAML_SILENCE_WARNINGS;
- return !env.YAML_SILENCE_WARNINGS;
- }
- function warn(warning, type) {
- if (shouldWarn(false)) {
- const emit = typeof process !== "undefined" && process.emitWarning;
- if (emit) emit(warning, type);
- else {
- console.warn(type ? `${type}: ${warning}` : warning);
- }
- }
- }
- function warnFileDeprecation(filename) {
- if (shouldWarn(true)) {
- const path = filename.replace(/.*yaml[/\\]/i, "").replace(/\.js$/, "").replace(/\\/g, "/");
- warn(`The endpoint 'yaml/${path}' will be removed in a future release.`, "DeprecationWarning");
- }
- }
- var warned = {};
- function warnOptionDeprecation(name, alternative) {
- if (!warned[name] && shouldWarn(true)) {
- warned[name] = true;
- let msg = `The option '${name}' will be removed in a future release`;
- msg += alternative ? `, use '${alternative}' instead.` : ".";
- warn(msg, "DeprecationWarning");
- }
- }
- exports2.binary = binary;
- exports2.floatTime = floatTime;
- exports2.intTime = intTime;
- exports2.omap = omap;
- exports2.pairs = pairs;
- exports2.set = set;
- exports2.timestamp = timestamp;
- exports2.warn = warn;
- exports2.warnFileDeprecation = warnFileDeprecation;
- exports2.warnOptionDeprecation = warnOptionDeprecation;
- }
-});
-
-// ../../node_modules/openapi-to-postmanv2/node_modules/yaml/dist/Schema-88e323a7.js
-var require_Schema_88e323a72 = __commonJS({
- "../../node_modules/openapi-to-postmanv2/node_modules/yaml/dist/Schema-88e323a7.js"(exports2) {
- "use strict";
- var PlainValue = require_PlainValue_ec8e588e2();
- var resolveSeq = require_resolveSeq_d03cb0372();
- var warnings = require_warnings_1000a3722();
- function createMap(schema2, obj, ctx) {
- const map2 = new resolveSeq.YAMLMap(schema2);
- if (obj instanceof Map) {
- for (const [key, value] of obj) map2.items.push(schema2.createPair(key, value, ctx));
- } else if (obj && typeof obj === "object") {
- for (const key of Object.keys(obj)) map2.items.push(schema2.createPair(key, obj[key], ctx));
- }
- if (typeof schema2.sortMapEntries === "function") {
- map2.items.sort(schema2.sortMapEntries);
- }
- return map2;
- }
- var map = {
- createNode: createMap,
- default: true,
- nodeClass: resolveSeq.YAMLMap,
- tag: "tag:yaml.org,2002:map",
- resolve: resolveSeq.resolveMap
- };
- function createSeq(schema2, obj, ctx) {
- const seq2 = new resolveSeq.YAMLSeq(schema2);
- if (obj && obj[Symbol.iterator]) {
- for (const it of obj) {
- const v = schema2.createNode(it, ctx.wrapScalars, null, ctx);
- seq2.items.push(v);
- }
- }
- return seq2;
- }
- var seq = {
- createNode: createSeq,
- default: true,
- nodeClass: resolveSeq.YAMLSeq,
- tag: "tag:yaml.org,2002:seq",
- resolve: resolveSeq.resolveSeq
- };
- var string = {
- identify: (value) => typeof value === "string",
- default: true,
- tag: "tag:yaml.org,2002:str",
- resolve: resolveSeq.resolveString,
- stringify(item, ctx, onComment, onChompKeep) {
- ctx = Object.assign({
- actualString: true
- }, ctx);
- return resolveSeq.stringifyString(item, ctx, onComment, onChompKeep);
- },
- options: resolveSeq.strOptions
- };
- var failsafe = [map, seq, string];
- var intIdentify$2 = (value) => typeof value === "bigint" || Number.isInteger(value);
- var intResolve$1 = (src, part, radix) => resolveSeq.intOptions.asBigInt ? BigInt(src) : parseInt(part, radix);
- function intStringify$1(node, radix, prefix) {
- const {
- value
- } = node;
- if (intIdentify$2(value) && value >= 0) return prefix + value.toString(radix);
- return resolveSeq.stringifyNumber(node);
- }
- var nullObj = {
- identify: (value) => value == null,
- createNode: (schema2, value, ctx) => ctx.wrapScalars ? new resolveSeq.Scalar(null) : null,
- default: true,
- tag: "tag:yaml.org,2002:null",
- test: /^(?:~|[Nn]ull|NULL)?$/,
- resolve: () => null,
- options: resolveSeq.nullOptions,
- stringify: () => resolveSeq.nullOptions.nullStr
- };
- var boolObj = {
- identify: (value) => typeof value === "boolean",
- default: true,
- tag: "tag:yaml.org,2002:bool",
- test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
- resolve: (str) => str[0] === "t" || str[0] === "T",
- options: resolveSeq.boolOptions,
- stringify: ({
- value
- }) => value ? resolveSeq.boolOptions.trueStr : resolveSeq.boolOptions.falseStr
- };
- var octObj = {
- identify: (value) => intIdentify$2(value) && value >= 0,
- default: true,
- tag: "tag:yaml.org,2002:int",
- format: "OCT",
- test: /^0o([0-7]+)$/,
- resolve: (str, oct) => intResolve$1(str, oct, 8),
- options: resolveSeq.intOptions,
- stringify: (node) => intStringify$1(node, 8, "0o")
- };
- var intObj = {
- identify: intIdentify$2,
- default: true,
- tag: "tag:yaml.org,2002:int",
- test: /^[-+]?[0-9]+$/,
- resolve: (str) => intResolve$1(str, str, 10),
- options: resolveSeq.intOptions,
- stringify: resolveSeq.stringifyNumber
- };
- var hexObj = {
- identify: (value) => intIdentify$2(value) && value >= 0,
- default: true,
- tag: "tag:yaml.org,2002:int",
- format: "HEX",
- test: /^0x([0-9a-fA-F]+)$/,
- resolve: (str, hex) => intResolve$1(str, hex, 16),
- options: resolveSeq.intOptions,
- stringify: (node) => intStringify$1(node, 16, "0x")
- };
- var nanObj = {
- identify: (value) => typeof value === "number",
- default: true,
- tag: "tag:yaml.org,2002:float",
- test: /^(?:[-+]?\.inf|(\.nan))$/i,
- resolve: (str, nan) => nan ? NaN : str[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
- stringify: resolveSeq.stringifyNumber
- };
- var expObj = {
- identify: (value) => typeof value === "number",
- default: true,
- tag: "tag:yaml.org,2002:float",
- format: "EXP",
- test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
- resolve: (str) => parseFloat(str),
- stringify: ({
- value
- }) => Number(value).toExponential()
- };
- var floatObj = {
- identify: (value) => typeof value === "number",
- default: true,
- tag: "tag:yaml.org,2002:float",
- test: /^[-+]?(?:\.([0-9]+)|[0-9]+\.([0-9]*))$/,
- resolve(str, frac1, frac2) {
- const frac = frac1 || frac2;
- const node = new resolveSeq.Scalar(parseFloat(str));
- if (frac && frac[frac.length - 1] === "0") node.minFractionDigits = frac.length;
- return node;
- },
- stringify: resolveSeq.stringifyNumber
- };
- var core = failsafe.concat([nullObj, boolObj, octObj, intObj, hexObj, nanObj, expObj, floatObj]);
- var intIdentify$1 = (value) => typeof value === "bigint" || Number.isInteger(value);
- var stringifyJSON = ({
- value
- }) => JSON.stringify(value);
- var json = [map, seq, {
- identify: (value) => typeof value === "string",
- default: true,
- tag: "tag:yaml.org,2002:str",
- resolve: resolveSeq.resolveString,
- stringify: stringifyJSON
- }, {
- identify: (value) => value == null,
- createNode: (schema2, value, ctx) => ctx.wrapScalars ? new resolveSeq.Scalar(null) : null,
- default: true,
- tag: "tag:yaml.org,2002:null",
- test: /^null$/,
- resolve: () => null,
- stringify: stringifyJSON
- }, {
- identify: (value) => typeof value === "boolean",
- default: true,
- tag: "tag:yaml.org,2002:bool",
- test: /^true|false$/,
- resolve: (str) => str === "true",
- stringify: stringifyJSON
- }, {
- identify: intIdentify$1,
- default: true,
- tag: "tag:yaml.org,2002:int",
- test: /^-?(?:0|[1-9][0-9]*)$/,
- resolve: (str) => resolveSeq.intOptions.asBigInt ? BigInt(str) : parseInt(str, 10),
- stringify: ({
- value
- }) => intIdentify$1(value) ? value.toString() : JSON.stringify(value)
- }, {
- identify: (value) => typeof value === "number",
- default: true,
- tag: "tag:yaml.org,2002:float",
- test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
- resolve: (str) => parseFloat(str),
- stringify: stringifyJSON
- }];
- json.scalarFallback = (str) => {
- throw new SyntaxError(`Unresolved plain scalar ${JSON.stringify(str)}`);
- };
- var boolStringify = ({
- value
- }) => value ? resolveSeq.boolOptions.trueStr : resolveSeq.boolOptions.falseStr;
- var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
- function intResolve(sign, src, radix) {
- let str = src.replace(/_/g, "");
- if (resolveSeq.intOptions.asBigInt) {
- switch (radix) {
- case 2:
- str = `0b${str}`;
- break;
- case 8:
- str = `0o${str}`;
- break;
- case 16:
- str = `0x${str}`;
- break;
- }
- const n2 = BigInt(str);
- return sign === "-" ? BigInt(-1) * n2 : n2;
- }
- const n = parseInt(str, radix);
- return sign === "-" ? -1 * n : n;
- }
- function intStringify(node, radix, prefix) {
- const {
- value
- } = node;
- if (intIdentify(value)) {
- const str = value.toString(radix);
- return value < 0 ? "-" + prefix + str.substr(1) : prefix + str;
- }
- return resolveSeq.stringifyNumber(node);
- }
- var yaml11 = failsafe.concat([{
- identify: (value) => value == null,
- createNode: (schema2, value, ctx) => ctx.wrapScalars ? new resolveSeq.Scalar(null) : null,
- default: true,
- tag: "tag:yaml.org,2002:null",
- test: /^(?:~|[Nn]ull|NULL)?$/,
- resolve: () => null,
- options: resolveSeq.nullOptions,
- stringify: () => resolveSeq.nullOptions.nullStr
- }, {
- identify: (value) => typeof value === "boolean",
- default: true,
- tag: "tag:yaml.org,2002:bool",
- test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
- resolve: () => true,
- options: resolveSeq.boolOptions,
- stringify: boolStringify
- }, {
- identify: (value) => typeof value === "boolean",
- default: true,
- tag: "tag:yaml.org,2002:bool",
- test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,
- resolve: () => false,
- options: resolveSeq.boolOptions,
- stringify: boolStringify
- }, {
- identify: intIdentify,
- default: true,
- tag: "tag:yaml.org,2002:int",
- format: "BIN",
- test: /^([-+]?)0b([0-1_]+)$/,
- resolve: (str, sign, bin) => intResolve(sign, bin, 2),
- stringify: (node) => intStringify(node, 2, "0b")
- }, {
- identify: intIdentify,
- default: true,
- tag: "tag:yaml.org,2002:int",
- format: "OCT",
- test: /^([-+]?)0([0-7_]+)$/,
- resolve: (str, sign, oct) => intResolve(sign, oct, 8),
- stringify: (node) => intStringify(node, 8, "0")
- }, {
- identify: intIdentify,
- default: true,
- tag: "tag:yaml.org,2002:int",
- test: /^([-+]?)([0-9][0-9_]*)$/,
- resolve: (str, sign, abs) => intResolve(sign, abs, 10),
- stringify: resolveSeq.stringifyNumber
- }, {
- identify: intIdentify,
- default: true,
- tag: "tag:yaml.org,2002:int",
- format: "HEX",
- test: /^([-+]?)0x([0-9a-fA-F_]+)$/,
- resolve: (str, sign, hex) => intResolve(sign, hex, 16),
- stringify: (node) => intStringify(node, 16, "0x")
- }, {
- identify: (value) => typeof value === "number",
- default: true,
- tag: "tag:yaml.org,2002:float",
- test: /^(?:[-+]?\.inf|(\.nan))$/i,
- resolve: (str, nan) => nan ? NaN : str[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
- stringify: resolveSeq.stringifyNumber
- }, {
- identify: (value) => typeof value === "number",
- default: true,
- tag: "tag:yaml.org,2002:float",
- format: "EXP",
- test: /^[-+]?([0-9][0-9_]*)?(\.[0-9_]*)?[eE][-+]?[0-9]+$/,
- resolve: (str) => parseFloat(str.replace(/_/g, "")),
- stringify: ({
- value
- }) => Number(value).toExponential()
- }, {
- identify: (value) => typeof value === "number",
- default: true,
- tag: "tag:yaml.org,2002:float",
- test: /^[-+]?(?:[0-9][0-9_]*)?\.([0-9_]*)$/,
- resolve(str, frac) {
- const node = new resolveSeq.Scalar(parseFloat(str.replace(/_/g, "")));
- if (frac) {
- const f = frac.replace(/_/g, "");
- if (f[f.length - 1] === "0") node.minFractionDigits = f.length;
- }
- return node;
- },
- stringify: resolveSeq.stringifyNumber
- }], warnings.binary, warnings.omap, warnings.pairs, warnings.set, warnings.intTime, warnings.floatTime, warnings.timestamp);
- var schemas = {
- core,
- failsafe,
- json,
- yaml11
- };
- var tags = {
- binary: warnings.binary,
- bool: boolObj,
- float: floatObj,
- floatExp: expObj,
- floatNaN: nanObj,
- floatTime: warnings.floatTime,
- int: intObj,
- intHex: hexObj,
- intOct: octObj,
- intTime: warnings.intTime,
- map,
- null: nullObj,
- omap: warnings.omap,
- pairs: warnings.pairs,
- seq,
- set: warnings.set,
- timestamp: warnings.timestamp
- };
- function findTagObject(value, tagName, tags2) {
- if (tagName) {
- const match = tags2.filter((t) => t.tag === tagName);
- const tagObj = match.find((t) => !t.format) || match[0];
- if (!tagObj) throw new Error(`Tag ${tagName} not found`);
- return tagObj;
- }
- return tags2.find((t) => (t.identify && t.identify(value) || t.class && value instanceof t.class) && !t.format);
- }
- function createNode(value, tagName, ctx) {
- if (value instanceof resolveSeq.Node) return value;
- const {
- defaultPrefix,
- onTagObj,
- prevObjects,
- schema: schema2,
- wrapScalars
- } = ctx;
- if (tagName && tagName.startsWith("!!")) tagName = defaultPrefix + tagName.slice(2);
- let tagObj = findTagObject(value, tagName, schema2.tags);
- if (!tagObj) {
- if (typeof value.toJSON === "function") value = value.toJSON();
- if (!value || typeof value !== "object") return wrapScalars ? new resolveSeq.Scalar(value) : value;
- tagObj = value instanceof Map ? map : value[Symbol.iterator] ? seq : map;
- }
- if (onTagObj) {
- onTagObj(tagObj);
- delete ctx.onTagObj;
- }
- const obj = {
- value: void 0,
- node: void 0
- };
- if (value && typeof value === "object" && prevObjects) {
- const prev = prevObjects.get(value);
- if (prev) {
- const alias = new resolveSeq.Alias(prev);
- ctx.aliasNodes.push(alias);
- return alias;
- }
- obj.value = value;
- prevObjects.set(value, obj);
- }
- obj.node = tagObj.createNode ? tagObj.createNode(ctx.schema, value, ctx) : wrapScalars ? new resolveSeq.Scalar(value) : value;
- if (tagName && obj.node instanceof resolveSeq.Node) obj.node.tag = tagName;
- return obj.node;
- }
- function getSchemaTags(schemas2, knownTags, customTags, schemaId) {
- let tags2 = schemas2[schemaId.replace(/\W/g, "")];
- if (!tags2) {
- const keys = Object.keys(schemas2).map((key) => JSON.stringify(key)).join(", ");
- throw new Error(`Unknown schema "${schemaId}"; use one of ${keys}`);
- }
- if (Array.isArray(customTags)) {
- for (const tag of customTags) tags2 = tags2.concat(tag);
- } else if (typeof customTags === "function") {
- tags2 = customTags(tags2.slice());
- }
- for (let i = 0; i < tags2.length; ++i) {
- const tag = tags2[i];
- if (typeof tag === "string") {
- const tagObj = knownTags[tag];
- if (!tagObj) {
- const keys = Object.keys(knownTags).map((key) => JSON.stringify(key)).join(", ");
- throw new Error(`Unknown custom tag "${tag}"; use one of ${keys}`);
- }
- tags2[i] = tagObj;
- }
- }
- return tags2;
- }
- var sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
- var Schema = class _Schema {
- // TODO: remove in v2
- // TODO: remove in v2
- constructor({
- customTags,
- merge,
- schema: schema2,
- sortMapEntries,
- tags: deprecatedCustomTags
- }) {
- this.merge = !!merge;
- this.name = schema2;
- this.sortMapEntries = sortMapEntries === true ? sortMapEntriesByKey : sortMapEntries || null;
- if (!customTags && deprecatedCustomTags) warnings.warnOptionDeprecation("tags", "customTags");
- this.tags = getSchemaTags(schemas, tags, customTags || deprecatedCustomTags, schema2);
- }
- createNode(value, wrapScalars, tagName, ctx) {
- const baseCtx = {
- defaultPrefix: _Schema.defaultPrefix,
- schema: this,
- wrapScalars
- };
- const createCtx = ctx ? Object.assign(ctx, baseCtx) : baseCtx;
- return createNode(value, tagName, createCtx);
- }
- createPair(key, value, ctx) {
- if (!ctx) ctx = {
- wrapScalars: true
- };
- const k = this.createNode(key, ctx.wrapScalars, null, ctx);
- const v = this.createNode(value, ctx.wrapScalars, null, ctx);
- return new resolveSeq.Pair(k, v);
- }
- };
- PlainValue._defineProperty(Schema, "defaultPrefix", PlainValue.defaultTagPrefix);
- PlainValue._defineProperty(Schema, "defaultTags", PlainValue.defaultTags);
- exports2.Schema = Schema;
- }
-});
-
-// ../../node_modules/openapi-to-postmanv2/node_modules/yaml/dist/Document-9b4560a1.js
-var require_Document_9b4560a12 = __commonJS({
- "../../node_modules/openapi-to-postmanv2/node_modules/yaml/dist/Document-9b4560a1.js"(exports2) {
- "use strict";
- var PlainValue = require_PlainValue_ec8e588e2();
- var resolveSeq = require_resolveSeq_d03cb0372();
- var Schema = require_Schema_88e323a72();
- var defaultOptions = {
- anchorPrefix: "a",
- customTags: null,
- indent: 2,
- indentSeq: true,
- keepCstNodes: false,
- keepNodeTypes: true,
- keepBlobsInJSON: true,
- mapAsMap: false,
- maxAliasCount: 100,
- prettyErrors: false,
- // TODO Set true in v2
- simpleKeys: false,
- version: "1.2"
- };
- var scalarOptions = {
- get binary() {
- return resolveSeq.binaryOptions;
- },
- set binary(opt) {
- Object.assign(resolveSeq.binaryOptions, opt);
- },
- get bool() {
- return resolveSeq.boolOptions;
- },
- set bool(opt) {
- Object.assign(resolveSeq.boolOptions, opt);
- },
- get int() {
- return resolveSeq.intOptions;
- },
- set int(opt) {
- Object.assign(resolveSeq.intOptions, opt);
- },
- get null() {
- return resolveSeq.nullOptions;
- },
- set null(opt) {
- Object.assign(resolveSeq.nullOptions, opt);
- },
- get str() {
- return resolveSeq.strOptions;
- },
- set str(opt) {
- Object.assign(resolveSeq.strOptions, opt);
- }
- };
- var documentOptions = {
- "1.0": {
- schema: "yaml-1.1",
- merge: true,
- tagPrefixes: [{
- handle: "!",
- prefix: PlainValue.defaultTagPrefix
- }, {
- handle: "!!",
- prefix: "tag:private.yaml.org,2002:"
- }]
- },
- 1.1: {
- schema: "yaml-1.1",
- merge: true,
- tagPrefixes: [{
- handle: "!",
- prefix: "!"
- }, {
- handle: "!!",
- prefix: PlainValue.defaultTagPrefix
- }]
- },
- 1.2: {
- schema: "core",
- merge: false,
- tagPrefixes: [{
- handle: "!",
- prefix: "!"
- }, {
- handle: "!!",
- prefix: PlainValue.defaultTagPrefix
- }]
- }
- };
- function stringifyTag(doc, tag) {
- if ((doc.version || doc.options.version) === "1.0") {
- const priv = tag.match(/^tag:private\.yaml\.org,2002:([^:/]+)$/);
- if (priv) return "!" + priv[1];
- const vocab = tag.match(/^tag:([a-zA-Z0-9-]+)\.yaml\.org,2002:(.*)/);
- return vocab ? `!${vocab[1]}/${vocab[2]}` : `!${tag.replace(/^tag:/, "")}`;
- }
- let p = doc.tagPrefixes.find((p2) => tag.indexOf(p2.prefix) === 0);
- if (!p) {
- const dtp = doc.getDefaults().tagPrefixes;
- p = dtp && dtp.find((p2) => tag.indexOf(p2.prefix) === 0);
- }
- if (!p) return tag[0] === "!" ? tag : `!<${tag}>`;
- const suffix = tag.substr(p.prefix.length).replace(/[!,[\]{}]/g, (ch) => ({
- "!": "%21",
- ",": "%2C",
- "[": "%5B",
- "]": "%5D",
- "{": "%7B",
- "}": "%7D"
- })[ch]);
- return p.handle + suffix;
- }
- function getTagObject(tags, item) {
- if (item instanceof resolveSeq.Alias) return resolveSeq.Alias;
- if (item.tag) {
- const match = tags.filter((t) => t.tag === item.tag);
- if (match.length > 0) return match.find((t) => t.format === item.format) || match[0];
- }
- let tagObj, obj;
- if (item instanceof resolveSeq.Scalar) {
- obj = item.value;
- const match = tags.filter((t) => t.identify && t.identify(obj) || t.class && obj instanceof t.class);
- tagObj = match.find((t) => t.format === item.format) || match.find((t) => !t.format);
- } else {
- obj = item;
- tagObj = tags.find((t) => t.nodeClass && obj instanceof t.nodeClass);
- }
- if (!tagObj) {
- const name = obj && obj.constructor ? obj.constructor.name : typeof obj;
- throw new Error(`Tag not resolved for ${name} value`);
- }
- return tagObj;
- }
- function stringifyProps(node, tagObj, {
- anchors,
- doc
- }) {
- const props = [];
- const anchor = doc.anchors.getName(node);
- if (anchor) {
- anchors[anchor] = node;
- props.push(`&${anchor}`);
- }
- if (node.tag) {
- props.push(stringifyTag(doc, node.tag));
- } else if (!tagObj.default) {
- props.push(stringifyTag(doc, tagObj.tag));
- }
- return props.join(" ");
- }
- function stringify2(item, ctx, onComment, onChompKeep) {
- const {
- anchors,
- schema: schema2
- } = ctx.doc;
- let tagObj;
- if (!(item instanceof resolveSeq.Node)) {
- const createCtx = {
- aliasNodes: [],
- onTagObj: (o) => tagObj = o,
- prevObjects: /* @__PURE__ */ new Map()
- };
- item = schema2.createNode(item, true, null, createCtx);
- for (const alias of createCtx.aliasNodes) {
- alias.source = alias.source.node;
- let name = anchors.getName(alias.source);
- if (!name) {
- name = anchors.newName();
- anchors.map[name] = alias.source;
- }
- }
- }
- if (item instanceof resolveSeq.Pair) return item.toString(ctx, onComment, onChompKeep);
- if (!tagObj) tagObj = getTagObject(schema2.tags, item);
- const props = stringifyProps(item, tagObj, ctx);
- if (props.length > 0) ctx.indentAtStart = (ctx.indentAtStart || 0) + props.length + 1;
- const str = typeof tagObj.stringify === "function" ? tagObj.stringify(item, ctx, onComment, onChompKeep) : item instanceof resolveSeq.Scalar ? resolveSeq.stringifyString(item, ctx, onComment, onChompKeep) : item.toString(ctx, onComment, onChompKeep);
- if (!props) return str;
- return item instanceof resolveSeq.Scalar || str[0] === "{" || str[0] === "[" ? `${props} ${str}` : `${props}
-${ctx.indent}${str}`;
- }
- var Anchors = class _Anchors {
- static validAnchorNode(node) {
- return node instanceof resolveSeq.Scalar || node instanceof resolveSeq.YAMLSeq || node instanceof resolveSeq.YAMLMap;
- }
- constructor(prefix) {
- PlainValue._defineProperty(this, "map", /* @__PURE__ */ Object.create(null));
- this.prefix = prefix;
- }
- createAlias(node, name) {
- this.setAnchor(node, name);
- return new resolveSeq.Alias(node);
- }
- createMergePair(...sources) {
- const merge = new resolveSeq.Merge();
- merge.value.items = sources.map((s) => {
- if (s instanceof resolveSeq.Alias) {
- if (s.source instanceof resolveSeq.YAMLMap) return s;
- } else if (s instanceof resolveSeq.YAMLMap) {
- return this.createAlias(s);
- }
- throw new Error("Merge sources must be Map nodes or their Aliases");
- });
- return merge;
- }
- getName(node) {
- const {
- map
- } = this;
- return Object.keys(map).find((a) => map[a] === node);
- }
- getNames() {
- return Object.keys(this.map);
- }
- getNode(name) {
- return this.map[name];
- }
- newName(prefix) {
- if (!prefix) prefix = this.prefix;
- const names = Object.keys(this.map);
- for (let i = 1; true; ++i) {
- const name = `${prefix}${i}`;
- if (!names.includes(name)) return name;
- }
- }
- // During parsing, map & aliases contain CST nodes
- resolveNodes() {
- const {
- map,
- _cstAliases
- } = this;
- Object.keys(map).forEach((a) => {
- map[a] = map[a].resolved;
- });
- _cstAliases.forEach((a) => {
- a.source = a.source.resolved;
- });
- delete this._cstAliases;
- }
- setAnchor(node, name) {
- if (node != null && !_Anchors.validAnchorNode(node)) {
- throw new Error("Anchors may only be set for Scalar, Seq and Map nodes");
- }
- if (name && /[\x00-\x19\s,[\]{}]/.test(name)) {
- throw new Error("Anchor names must not contain whitespace or control characters");
- }
- const {
- map
- } = this;
- const prev = node && Object.keys(map).find((a) => map[a] === node);
- if (prev) {
- if (!name) {
- return prev;
- } else if (prev !== name) {
- delete map[prev];
- map[name] = node;
- }
- } else {
- if (!name) {
- if (!node) return null;
- name = this.newName();
- }
- map[name] = node;
- }
- return name;
- }
- };
- var visit = (node, tags) => {
- if (node && typeof node === "object") {
- const {
- tag
- } = node;
- if (node instanceof resolveSeq.Collection) {
- if (tag) tags[tag] = true;
- node.items.forEach((n) => visit(n, tags));
- } else if (node instanceof resolveSeq.Pair) {
- visit(node.key, tags);
- visit(node.value, tags);
- } else if (node instanceof resolveSeq.Scalar) {
- if (tag) tags[tag] = true;
- }
- }
- return tags;
- };
- var listTagNames = (node) => Object.keys(visit(node, {}));
- function parseContents(doc, contents) {
- const comments = {
- before: [],
- after: []
- };
- let body = void 0;
- let spaceBefore = false;
- for (const node of contents) {
- if (node.valueRange) {
- if (body !== void 0) {
- const msg = "Document contains trailing content not separated by a ... or --- line";
- doc.errors.push(new PlainValue.YAMLSyntaxError(node, msg));
- break;
- }
- const res = resolveSeq.resolveNode(doc, node);
- if (spaceBefore) {
- res.spaceBefore = true;
- spaceBefore = false;
- }
- body = res;
- } else if (node.comment !== null) {
- const cc = body === void 0 ? comments.before : comments.after;
- cc.push(node.comment);
- } else if (node.type === PlainValue.Type.BLANK_LINE) {
- spaceBefore = true;
- if (body === void 0 && comments.before.length > 0 && !doc.commentBefore) {
- doc.commentBefore = comments.before.join("\n");
- comments.before = [];
- }
- }
- }
- doc.contents = body || null;
- if (!body) {
- doc.comment = comments.before.concat(comments.after).join("\n") || null;
- } else {
- const cb = comments.before.join("\n");
- if (cb) {
- const cbNode = body instanceof resolveSeq.Collection && body.items[0] ? body.items[0] : body;
- cbNode.commentBefore = cbNode.commentBefore ? `${cb}
-${cbNode.commentBefore}` : cb;
- }
- doc.comment = comments.after.join("\n") || null;
- }
- }
- function resolveTagDirective({
- tagPrefixes
- }, directive) {
- const [handle, prefix] = directive.parameters;
- if (!handle || !prefix) {
- const msg = "Insufficient parameters given for %TAG directive";
- throw new PlainValue.YAMLSemanticError(directive, msg);
- }
- if (tagPrefixes.some((p) => p.handle === handle)) {
- const msg = "The %TAG directive must only be given at most once per handle in the same document.";
- throw new PlainValue.YAMLSemanticError(directive, msg);
- }
- return {
- handle,
- prefix
- };
- }
- function resolveYamlDirective(doc, directive) {
- let [version2] = directive.parameters;
- if (directive.name === "YAML:1.0") version2 = "1.0";
- if (!version2) {
- const msg = "Insufficient parameters given for %YAML directive";
- throw new PlainValue.YAMLSemanticError(directive, msg);
- }
- if (!documentOptions[version2]) {
- const v0 = doc.version || doc.options.version;
- const msg = `Document will be parsed as YAML ${v0} rather than YAML ${version2}`;
- doc.warnings.push(new PlainValue.YAMLWarning(directive, msg));
- }
- return version2;
- }
- function parseDirectives(doc, directives, prevDoc) {
- const directiveComments = [];
- let hasDirectives = false;
- for (const directive of directives) {
- const {
- comment,
- name
- } = directive;
- switch (name) {
- case "TAG":
- try {
- doc.tagPrefixes.push(resolveTagDirective(doc, directive));
- } catch (error) {
- doc.errors.push(error);
- }
- hasDirectives = true;
- break;
- case "YAML":
- case "YAML:1.0":
- if (doc.version) {
- const msg = "The %YAML directive must only be given at most once per document.";
- doc.errors.push(new PlainValue.YAMLSemanticError(directive, msg));
- }
- try {
- doc.version = resolveYamlDirective(doc, directive);
- } catch (error) {
- doc.errors.push(error);
- }
- hasDirectives = true;
- break;
- default:
- if (name) {
- const msg = `YAML only supports %TAG and %YAML directives, and not %${name}`;
- doc.warnings.push(new PlainValue.YAMLWarning(directive, msg));
- }
- }
- if (comment) directiveComments.push(comment);
- }
- if (prevDoc && !hasDirectives && "1.1" === (doc.version || prevDoc.version || doc.options.version)) {
- const copyTagPrefix = ({
- handle,
- prefix
- }) => ({
- handle,
- prefix
- });
- doc.tagPrefixes = prevDoc.tagPrefixes.map(copyTagPrefix);
- doc.version = prevDoc.version;
- }
- doc.commentBefore = directiveComments.join("\n") || null;
- }
- function assertCollection(contents) {
- if (contents instanceof resolveSeq.Collection) return true;
- throw new Error("Expected a YAML collection as document contents");
- }
- var Document = class _Document {
- constructor(options) {
- this.anchors = new Anchors(options.anchorPrefix);
- this.commentBefore = null;
- this.comment = null;
- this.contents = null;
- this.directivesEndMarker = null;
- this.errors = [];
- this.options = options;
- this.schema = null;
- this.tagPrefixes = [];
- this.version = null;
- this.warnings = [];
- }
- add(value) {
- assertCollection(this.contents);
- return this.contents.add(value);
- }
- addIn(path, value) {
- assertCollection(this.contents);
- this.contents.addIn(path, value);
- }
- delete(key) {
- assertCollection(this.contents);
- return this.contents.delete(key);
- }
- deleteIn(path) {
- if (resolveSeq.isEmptyPath(path)) {
- if (this.contents == null) return false;
- this.contents = null;
- return true;
- }
- assertCollection(this.contents);
- return this.contents.deleteIn(path);
- }
- getDefaults() {
- return _Document.defaults[this.version] || _Document.defaults[this.options.version] || {};
- }
- get(key, keepScalar) {
- return this.contents instanceof resolveSeq.Collection ? this.contents.get(key, keepScalar) : void 0;
- }
- getIn(path, keepScalar) {
- if (resolveSeq.isEmptyPath(path)) return !keepScalar && this.contents instanceof resolveSeq.Scalar ? this.contents.value : this.contents;
- return this.contents instanceof resolveSeq.Collection ? this.contents.getIn(path, keepScalar) : void 0;
- }
- has(key) {
- return this.contents instanceof resolveSeq.Collection ? this.contents.has(key) : false;
- }
- hasIn(path) {
- if (resolveSeq.isEmptyPath(path)) return this.contents !== void 0;
- return this.contents instanceof resolveSeq.Collection ? this.contents.hasIn(path) : false;
- }
- set(key, value) {
- assertCollection(this.contents);
- this.contents.set(key, value);
- }
- setIn(path, value) {
- if (resolveSeq.isEmptyPath(path)) this.contents = value;
- else {
- assertCollection(this.contents);
- this.contents.setIn(path, value);
- }
- }
- setSchema(id, customTags) {
- if (!id && !customTags && this.schema) return;
- if (typeof id === "number") id = id.toFixed(1);
- if (id === "1.0" || id === "1.1" || id === "1.2") {
- if (this.version) this.version = id;
- else this.options.version = id;
- delete this.options.schema;
- } else if (id && typeof id === "string") {
- this.options.schema = id;
- }
- if (Array.isArray(customTags)) this.options.customTags = customTags;
- const opt = Object.assign({}, this.getDefaults(), this.options);
- this.schema = new Schema.Schema(opt);
- }
- parse(node, prevDoc) {
- if (this.options.keepCstNodes) this.cstNode = node;
- if (this.options.keepNodeTypes) this.type = "DOCUMENT";
- const {
- directives = [],
- contents = [],
- directivesEndMarker,
- error,
- valueRange
- } = node;
- if (error) {
- if (!error.source) error.source = this;
- this.errors.push(error);
- }
- parseDirectives(this, directives, prevDoc);
- if (directivesEndMarker) this.directivesEndMarker = true;
- this.range = valueRange ? [valueRange.start, valueRange.end] : null;
- this.setSchema();
- this.anchors._cstAliases = [];
- parseContents(this, contents);
- this.anchors.resolveNodes();
- if (this.options.prettyErrors) {
- for (const error2 of this.errors) if (error2 instanceof PlainValue.YAMLError) error2.makePretty();
- for (const warn of this.warnings) if (warn instanceof PlainValue.YAMLError) warn.makePretty();
- }
- return this;
- }
- listNonDefaultTags() {
- return listTagNames(this.contents).filter((t) => t.indexOf(Schema.Schema.defaultPrefix) !== 0);
- }
- setTagPrefix(handle, prefix) {
- if (handle[0] !== "!" || handle[handle.length - 1] !== "!") throw new Error("Handle must start and end with !");
- if (prefix) {
- const prev = this.tagPrefixes.find((p) => p.handle === handle);
- if (prev) prev.prefix = prefix;
- else this.tagPrefixes.push({
- handle,
- prefix
- });
- } else {
- this.tagPrefixes = this.tagPrefixes.filter((p) => p.handle !== handle);
- }
- }
- toJSON(arg, onAnchor) {
- const {
- keepBlobsInJSON,
- mapAsMap,
- maxAliasCount
- } = this.options;
- const keep = keepBlobsInJSON && (typeof arg !== "string" || !(this.contents instanceof resolveSeq.Scalar));
- const ctx = {
- doc: this,
- indentStep: " ",
- keep,
- mapAsMap: keep && !!mapAsMap,
- maxAliasCount,
- stringify: stringify2
- // Requiring directly in Pair would create circular dependencies
- };
- const anchorNames = Object.keys(this.anchors.map);
- if (anchorNames.length > 0) ctx.anchors = new Map(anchorNames.map((name) => [this.anchors.map[name], {
- alias: [],
- aliasCount: 0,
- count: 1
- }]));
- const res = resolveSeq.toJSON(this.contents, arg, ctx);
- if (typeof onAnchor === "function" && ctx.anchors) for (const {
- count,
- res: res2
- } of ctx.anchors.values()) onAnchor(res2, count);
- return res;
- }
- toString() {
- if (this.errors.length > 0) throw new Error("Document with errors cannot be stringified");
- const indentSize = this.options.indent;
- if (!Number.isInteger(indentSize) || indentSize <= 0) {
- const s = JSON.stringify(indentSize);
- throw new Error(`"indent" option must be a positive integer, not ${s}`);
- }
- this.setSchema();
- const lines = [];
- let hasDirectives = false;
- if (this.version) {
- let vd = "%YAML 1.2";
- if (this.schema.name === "yaml-1.1") {
- if (this.version === "1.0") vd = "%YAML:1.0";
- else if (this.version === "1.1") vd = "%YAML 1.1";
- }
- lines.push(vd);
- hasDirectives = true;
- }
- const tagNames = this.listNonDefaultTags();
- this.tagPrefixes.forEach(({
- handle,
- prefix
- }) => {
- if (tagNames.some((t) => t.indexOf(prefix) === 0)) {
- lines.push(`%TAG ${handle} ${prefix}`);
- hasDirectives = true;
- }
- });
- if (hasDirectives || this.directivesEndMarker) lines.push("---");
- if (this.commentBefore) {
- if (hasDirectives || !this.directivesEndMarker) lines.unshift("");
- lines.unshift(this.commentBefore.replace(/^/gm, "#"));
- }
- const ctx = {
- anchors: /* @__PURE__ */ Object.create(null),
- doc: this,
- indent: "",
- indentStep: " ".repeat(indentSize),
- stringify: stringify2
- // Requiring directly in nodes would create circular dependencies
- };
- let chompKeep = false;
- let contentComment = null;
- if (this.contents) {
- if (this.contents instanceof resolveSeq.Node) {
- if (this.contents.spaceBefore && (hasDirectives || this.directivesEndMarker)) lines.push("");
- if (this.contents.commentBefore) lines.push(this.contents.commentBefore.replace(/^/gm, "#"));
- ctx.forceBlockIndent = !!this.comment;
- contentComment = this.contents.comment;
- }
- const onChompKeep = contentComment ? null : () => chompKeep = true;
- const body = stringify2(this.contents, ctx, () => contentComment = null, onChompKeep);
- lines.push(resolveSeq.addComment(body, "", contentComment));
- } else if (this.contents !== void 0) {
- lines.push(stringify2(this.contents, ctx));
- }
- if (this.comment) {
- if ((!chompKeep || contentComment) && lines[lines.length - 1] !== "") lines.push("");
- lines.push(this.comment.replace(/^/gm, "#"));
- }
- return lines.join("\n") + "\n";
- }
- };
- PlainValue._defineProperty(Document, "defaults", documentOptions);
- exports2.Document = Document;
- exports2.defaultOptions = defaultOptions;
- exports2.scalarOptions = scalarOptions;
- }
-});
-
-// ../../node_modules/openapi-to-postmanv2/node_modules/yaml/dist/index.js
-var require_dist2 = __commonJS({
- "../../node_modules/openapi-to-postmanv2/node_modules/yaml/dist/index.js"(exports2) {
- "use strict";
- var parseCst = require_parse_cst2();
- var Document$1 = require_Document_9b4560a12();
- var Schema = require_Schema_88e323a72();
- var PlainValue = require_PlainValue_ec8e588e2();
- var warnings = require_warnings_1000a3722();
- require_resolveSeq_d03cb0372();
- function createNode(value, wrapScalars = true, tag) {
- if (tag === void 0 && typeof wrapScalars === "string") {
- tag = wrapScalars;
- wrapScalars = true;
- }
- const options = Object.assign({}, Document$1.Document.defaults[Document$1.defaultOptions.version], Document$1.defaultOptions);
- const schema2 = new Schema.Schema(options);
- return schema2.createNode(value, wrapScalars, tag);
- }
- var Document = class extends Document$1.Document {
- constructor(options) {
- super(Object.assign({}, Document$1.defaultOptions, options));
- }
- };
- function parseAllDocuments(src, options) {
- const stream = [];
- let prev;
- for (const cstDoc of parseCst.parse(src)) {
- const doc = new Document(options);
- doc.parse(cstDoc, prev);
- stream.push(doc);
- prev = doc;
- }
- return stream;
- }
- function parseDocument(src, options) {
- const cst = parseCst.parse(src);
- const doc = new Document(options).parse(cst[0]);
- if (cst.length > 1) {
- const errMsg = "Source contains multiple documents; please use YAML.parseAllDocuments()";
- doc.errors.unshift(new PlainValue.YAMLSemanticError(cst[1], errMsg));
- }
- return doc;
- }
- function parse2(src, options) {
- const doc = parseDocument(src, options);
- doc.warnings.forEach((warning) => warnings.warn(warning));
- if (doc.errors.length > 0) throw doc.errors[0];
- return doc.toJSON();
- }
- function stringify2(value, options) {
- const doc = new Document(options);
- doc.contents = value;
- return String(doc);
- }
- var YAML = {
- createNode,
- defaultOptions: Document$1.defaultOptions,
- Document,
- parse: parse2,
- parseAllDocuments,
- parseCST: parseCst.parse,
- parseDocument,
- scalarOptions: Document$1.scalarOptions,
- stringify: stringify2
- };
- exports2.YAML = YAML;
- }
-});
-
-// ../../node_modules/openapi-to-postmanv2/node_modules/yaml/index.js
-var require_yaml2 = __commonJS({
- "../../node_modules/openapi-to-postmanv2/node_modules/yaml/index.js"(exports2, module2) {
- module2.exports = require_dist2().YAML;
- }
-});
-
-// ../../node_modules/openapi-to-postmanv2/lib/parse.js
-var require_parse = __commonJS({
- "../../node_modules/openapi-to-postmanv2/lib/parse.js"(exports2, module2) {
- var yaml = require_js_yaml();
- var fs = require("fs");
- var _2 = require_lodash();
- var path = require("path");
- var pathBrowserify = require_path_browserify();
- var resolver = require_oas_resolver_browser();
- var yamlParse = require_yaml2();
- var { compareVersion, getVersionFromSpec } = require_versionUtils();
- var BROWSER = "browser";
- var YAML_FORMAT = "yaml";
- var JSON_FORMAT = "json";
- var UNSUPPORTED_FORMAT = "unsupported";
- function looksLikeJson(spec) {
- return typeof spec === "string" && spec.startsWith("{");
- }
- module2.exports = {
- asJson: function(spec) {
- try {
- return JSON.parse(spec);
- } catch (jsonException) {
- throw new SyntaxError(`Specification is not a valid JSON. ${jsonException}`);
- }
- },
- asYaml: function(spec) {
- try {
- let obj = yaml.load(spec, {
- schema: yaml.JSON_SCHEMA
- });
- if (typeof obj !== "object") {
- throw new Error("");
- }
- return obj;
- } catch (yamlException) {
- throw new SyntaxError(`Specification is not a valid YAML. ${yamlException}`);
- }
- },
- /** Converts OpenAPI input to OpenAPI Object
- * @param {String} openApiSpec OpenAPI input in string
- * @returns {Object} oasObject
- */
- getOasObject: function(openApiSpec) {
- let oasObject = openApiSpec, inputFormat = UNSUPPORTED_FORMAT, detailedError = "Invalid format. Input must be in YAML or JSON format.";
- try {
- oasObject = this.asYaml(openApiSpec);
- inputFormat = looksLikeJson(openApiSpec) ? JSON_FORMAT : YAML_FORMAT;
- } catch (yamlException) {
- try {
- oasObject = this.asJson(openApiSpec);
- inputFormat = JSON_FORMAT;
- } catch (jsonException) {
- if (openApiSpec && openApiSpec[0] === "{") {
- detailedError += " " + jsonException.message;
- } else if (openApiSpec && openApiSpec.indexOf("openapi:") === 0) {
- detailedError += " " + yamlException.message;
- }
- return {
- result: false,
- reason: detailedError
- };
- }
- }
- return {
- result: true,
- oasObject,
- inputFormat
- };
- },
- /** Given an array of files returns the root OAS file if present
- *
- * @param {Array} input input object that contains files array
- * @param {Object} inputValidation Validator according to version
- * @param {Object} options computed process options
- * @param {Object} files Files map
- * @param {string} specificationVersion the string of the desired version
- * @param {boolean} allowReadingFS wheter to allow reading content from file system
- * @return {String} rootFile
- */
- getRootFiles: function(input, inputValidation, options, files = {}, specificationVersion, allowReadingFS = true) {
- let rootFilesArray = [], filesPathArray = input.data, origin = input.origin || "";
- filesPathArray.forEach((filePath) => {
- let obj, file, oasObject;
- try {
- if (origin === BROWSER) {
- path = pathBrowserify;
- }
- if (!_2.isEmpty(files)) {
- file = files[path.resolve(filePath.fileName)];
- } else if (allowReadingFS) {
- file = fs.readFileSync(filePath.fileName, "utf8");
- }
- obj = this.getOasObject(file);
- if (obj.result) {
- oasObject = obj.oasObject;
- } else {
- return;
- }
- if (inputValidation.validateSpec(oasObject, options).result) {
- if (specificationVersion) {
- if (compareVersion(specificationVersion, getVersionFromSpec(oasObject))) {
- rootFilesArray.push(filePath.fileName);
- }
- } else {
- rootFilesArray.push(filePath.fileName);
- }
- }
- } catch (e) {
- throw new Error(e.message);
- }
- });
- return rootFilesArray;
- },
- /**
- * Resolve file references and generate single OAS Object
- *
- * @param {Object} openapi OpenAPI
- * @param {Object} options options
- * @param {Object} files Map of files path and content
- * @return {Object} Resolved content
- */
- resolveContent: function(openapi, options, files) {
- return resolver.resolve(openapi, options.source, {
- options: Object.assign({}, options),
- resolve: true,
- cache: [],
- externals: [],
- externalRefs: {},
- rewriteRefs: true,
- openapi,
- files,
- browser: options.browser || "",
- resolveInternal: true
- });
- },
- /** Resolves all OpenAPI file references and returns a single OAS Object
- *
- * @param {Object} source Root file path
- * @param {Object} options Configurable options as per oas-resolver module.
- * @param {Object} files Map of files path and content
- * @return {Object} Resolved OpenAPI Schema
- */
- mergeFiles: function(source, options = {}, files = {}) {
- options.source = source;
- options.origin = source;
- if (!_2.isEmpty(files)) {
- if (options.browser) {
- path = pathBrowserify;
- }
- let content = files[path.resolve(source)], unresolved;
- try {
- unresolved = yamlParse.parse(content, { prettyErrors: true });
- } catch (err) {
- throw new Error("\nLine: " + err.linePos.start.line + ", col: " + err.linePos.start.col + " " + err.message);
- }
- return new Promise((resolve, reject) => {
- return this.resolveContent(unresolved, options, files).then((result) => {
- return resolve(result.openapi);
- }, (err) => {
- return reject(err);
- });
- });
- }
- return this.readFileAsync(source, "utf8").then((content) => {
- try {
- return yamlParse.parse(content, { prettyErrors: true });
- } catch (err) {
- throw new Error("\nLine: " + err.linePos.start.line + ", col: " + err.linePos.start.col + " " + err.message);
- }
- }, (err) => {
- throw new Error(err.message);
- }).then((unresolved) => {
- if (options.resolve === true) {
- return this.resolveContent(unresolved, options);
- }
- }, (err) => {
- throw err;
- }).then((result) => {
- return result.openapi;
- }, (err) => {
- throw err;
- });
- },
- /** Read File asynchronously
- *
- * @param {String} filePath Path of the file.
- * @param {String} encoding encoding
- * @return {String} Contents of the file
- */
- readFileAsync: function(filePath, encoding) {
- return new Promise((resolve, reject) => {
- fs.readFile(filePath, encoding, (err, data) => {
- if (err) {
- reject(err);
- } else {
- resolve(data);
- }
- });
- });
- },
- /**
- * Serializes the given API as JSON, using the given spaces for formatting.
- *
- * @param {object} api specification to parse
- * @param {string|number} spaces number of spaces to use for tabulation
- *
- * @return {String} Contents of the file in json format
- */
- toJSON: function(api, spaces) {
- return JSON.stringify(api, null, spaces);
- },
- /**
- * Serializes the given API as YAML, using the given spaces for formatting.
- *
- * @param {object} api API to convert to YAML
- * @param {string|number} spaces number of spaces to ident
- * @param {number} lineWidth set max line width. (default: 80)
- *
- * @return {String} Contents of the file in yaml format
- */
- toYAML: function(api, spaces, lineWidth) {
- return yaml.dump(api, {
- indent: spaces,
- lineWidth,
- noRefs: true
- });
- },
- YAML_FORMAT,
- JSON_FORMAT
- };
- }
-});
-
-// ../../node_modules/openapi-to-postmanv2/lib/common/schemaUtilsCommon.js
-var require_schemaUtilsCommon = __commonJS({
- "../../node_modules/openapi-to-postmanv2/lib/common/schemaUtilsCommon.js"(exports2, module2) {
- var parse2 = require_parse();
- var _2 = require_lodash();
- var typesMap = {
- integer: {
- int32: "",
- int64: ""
- },
- number: {
- float: "",
- double: ""
- },
- string: {
- byte: "",
- binary: "",
- date: "",
- "date-time": "",
- password: ""
- },
- boolean: "",
- array: "",
- object: "