bantou 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/nitro.json +13 -0
- package/.output/public/_nuxt/BmGsA4i2.js +1 -0
- package/.output/public/_nuxt/D_G6gzEa.js +1 -0
- package/.output/public/_nuxt/builds/latest.json +1 -0
- package/.output/public/_nuxt/builds/meta/1a8fc623-6671-445b-bdd3-c3d073520a3a.json +1 -0
- package/.output/public/_nuxt/entry.CZSvzYhH.css +1 -0
- package/.output/public/_nuxt/error-404.C3wqHTJz.css +1 -0
- package/.output/public/_nuxt/error-500.D6rBzoDj.css +1 -0
- package/.output/public/_nuxt/pdFQkwM_.js +4 -0
- package/.output/server/chunks/_/error-500.mjs +20 -0
- package/.output/server/chunks/_/error-500.mjs.map +1 -0
- package/.output/server/chunks/nitro/nitro.mjs +5870 -0
- package/.output/server/chunks/nitro/nitro.mjs.map +1 -0
- package/.output/server/chunks/routes/mcp.mjs +22 -0
- package/.output/server/chunks/routes/mcp.mjs.map +1 -0
- package/.output/server/chunks/routes/renderer.mjs +462 -0
- package/.output/server/chunks/routes/renderer.mjs.map +1 -0
- package/.output/server/chunks/virtual/_virtual_spa-template.mjs +4 -0
- package/.output/server/chunks/virtual/_virtual_spa-template.mjs.map +1 -0
- package/.output/server/chunks/virtual/precomputed.mjs +4 -0
- package/.output/server/chunks/virtual/precomputed.mjs.map +1 -0
- package/.output/server/index.mjs +18 -0
- package/.output/server/index.mjs.map +1 -0
- package/.output/server/node_modules/@babel/parser/lib/index.js +14657 -0
- package/.output/server/node_modules/@babel/parser/package.json +50 -0
- package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js +64 -0
- package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js +16 -0
- package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js +32 -0
- package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js +246 -0
- package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/package.json +1 -0
- package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js +41 -0
- package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js +429 -0
- package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js +971 -0
- package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/server/requestBody.js +58 -0
- package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.js +13 -0
- package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js +961 -0
- package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js +228 -0
- package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js +51 -0
- package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js +57 -0
- package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js +1137 -0
- package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js +92 -0
- package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.js +239 -0
- package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js +2065 -0
- package/.output/server/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js +87 -0
- package/.output/server/node_modules/@modelcontextprotocol/sdk/package.json +165 -0
- package/.output/server/node_modules/@parcel/watcher-wasm/index.mjs +349 -0
- package/.output/server/node_modules/@parcel/watcher-wasm/package.json +44 -0
- package/.output/server/node_modules/@parcel/watcher-wasm/watcher.wasm +0 -0
- package/.output/server/node_modules/@parcel/watcher-wasm/wrapper.js +88 -0
- package/.output/server/node_modules/@unagents/messenger-broker/dist/index.mjs +12 -0
- package/.output/server/node_modules/@unagents/messenger-broker/dist/shared/messenger-broker.B8W77sqB.mjs +1177 -0
- package/.output/server/node_modules/@unagents/messenger-broker/package.json +37 -0
- package/.output/server/node_modules/@unagents/messenger-client/dist/index.mjs +9 -0
- package/.output/server/node_modules/@unagents/messenger-client/dist/shared/messenger-client.CfQVmH_Z.mjs +975 -0
- package/.output/server/node_modules/@unagents/messenger-client/dist/shared/messenger-client.CoDKzubj.mjs +1000 -0
- package/.output/server/node_modules/@unagents/messenger-client/package.json +37 -0
- package/.output/server/node_modules/@unagents/messenger-protocol/dist/index.mjs +103 -0
- package/.output/server/node_modules/@unagents/messenger-protocol/package.json +29 -0
- package/.output/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +6802 -0
- package/.output/server/node_modules/@vue/compiler-core/package.json +58 -0
- package/.output/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +729 -0
- package/.output/server/node_modules/@vue/compiler-dom/package.json +57 -0
- package/.output/server/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +1420 -0
- package/.output/server/node_modules/@vue/compiler-ssr/package.json +34 -0
- package/.output/server/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js +1933 -0
- package/.output/server/node_modules/@vue/reactivity/package.json +55 -0
- package/.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js +7085 -0
- package/.output/server/node_modules/@vue/runtime-core/package.json +52 -0
- package/.output/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +1917 -0
- package/.output/server/node_modules/@vue/runtime-dom/package.json +60 -0
- package/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js +951 -0
- package/.output/server/node_modules/@vue/server-renderer/package.json +53 -0
- package/.output/server/node_modules/@vue/shared/dist/shared.cjs.prod.js +655 -0
- package/.output/server/node_modules/@vue/shared/package.json +47 -0
- package/.output/server/node_modules/ajv/dist/ajv.js +50 -0
- package/.output/server/node_modules/ajv/dist/compile/codegen/code.js +156 -0
- package/.output/server/node_modules/ajv/dist/compile/codegen/index.js +697 -0
- package/.output/server/node_modules/ajv/dist/compile/codegen/scope.js +143 -0
- package/.output/server/node_modules/ajv/dist/compile/errors.js +123 -0
- package/.output/server/node_modules/ajv/dist/compile/index.js +242 -0
- package/.output/server/node_modules/ajv/dist/compile/names.js +28 -0
- package/.output/server/node_modules/ajv/dist/compile/ref_error.js +12 -0
- package/.output/server/node_modules/ajv/dist/compile/resolve.js +155 -0
- package/.output/server/node_modules/ajv/dist/compile/rules.js +26 -0
- package/.output/server/node_modules/ajv/dist/compile/util.js +178 -0
- package/.output/server/node_modules/ajv/dist/compile/validate/applicability.js +19 -0
- package/.output/server/node_modules/ajv/dist/compile/validate/boolSchema.js +50 -0
- package/.output/server/node_modules/ajv/dist/compile/validate/dataType.js +203 -0
- package/.output/server/node_modules/ajv/dist/compile/validate/defaults.js +35 -0
- package/.output/server/node_modules/ajv/dist/compile/validate/index.js +520 -0
- package/.output/server/node_modules/ajv/dist/compile/validate/keyword.js +124 -0
- package/.output/server/node_modules/ajv/dist/compile/validate/subschema.js +81 -0
- package/.output/server/node_modules/ajv/dist/core.js +618 -0
- package/.output/server/node_modules/ajv/dist/refs/data.json +13 -0
- package/.output/server/node_modules/ajv/dist/refs/json-schema-draft-07.json +151 -0
- package/.output/server/node_modules/ajv/dist/runtime/equal.js +7 -0
- package/.output/server/node_modules/ajv/dist/runtime/ucs2length.js +24 -0
- package/.output/server/node_modules/ajv/dist/runtime/uri.js +6 -0
- package/.output/server/node_modules/ajv/dist/runtime/validation_error.js +11 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +49 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +106 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/allOf.js +23 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +12 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/contains.js +95 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +85 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/if.js +66 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/index.js +44 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/items.js +52 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/items2020.js +30 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/not.js +26 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +60 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +75 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +12 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/properties.js +54 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +38 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +13 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/code.js +131 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/core/id.js +10 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/core/index.js +16 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/core/ref.js +122 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/discriminator/index.js +104 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/discriminator/types.js +9 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/draft7.js +17 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/format/format.js +92 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/format/index.js +6 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/metadata.js +18 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/const.js +25 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/enum.js +48 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/index.js +33 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/limitItems.js +24 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/limitLength.js +27 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +27 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +24 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +26 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/pattern.js +33 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/required.js +79 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +64 -0
- package/.output/server/node_modules/ajv/package.json +126 -0
- package/.output/server/node_modules/ajv-formats/dist/formats.js +208 -0
- package/.output/server/node_modules/ajv-formats/dist/index.js +37 -0
- package/.output/server/node_modules/ajv-formats/dist/limit.js +69 -0
- package/.output/server/node_modules/ajv-formats/package.json +74 -0
- package/.output/server/node_modules/consola/dist/chunks/prompt.mjs +280 -0
- package/.output/server/node_modules/consola/dist/core.mjs +512 -0
- package/.output/server/node_modules/consola/dist/index.mjs +651 -0
- package/.output/server/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs +72 -0
- package/.output/server/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs +288 -0
- package/.output/server/node_modules/consola/dist/utils.mjs +54 -0
- package/.output/server/node_modules/consola/package.json +136 -0
- package/.output/server/node_modules/content-type/index.js +225 -0
- package/.output/server/node_modules/content-type/package.json +42 -0
- package/.output/server/node_modules/cookie-es/dist/index.mjs +268 -0
- package/.output/server/node_modules/cookie-es/package.json +46 -0
- package/.output/server/node_modules/crossws/dist/_chunks/_request.mjs +83 -0
- package/.output/server/node_modules/crossws/dist/_chunks/adapter.mjs +234 -0
- package/.output/server/node_modules/crossws/dist/_chunks/error.mjs +7 -0
- package/.output/server/node_modules/crossws/dist/_chunks/libs/ws.mjs +6 -0
- package/.output/server/node_modules/crossws/dist/_chunks/node.mjs +220 -0
- package/.output/server/node_modules/crossws/dist/_chunks/peer.mjs +208 -0
- package/.output/server/node_modules/crossws/dist/adapters/node.mjs +1 -0
- package/.output/server/node_modules/crossws/package.json +115 -0
- package/.output/server/node_modules/defu/dist/defu.mjs +69 -0
- package/.output/server/node_modules/defu/package.json +48 -0
- package/.output/server/node_modules/destr/dist/index.mjs +72 -0
- package/.output/server/node_modules/destr/package.json +47 -0
- package/.output/server/node_modules/devalue/index.js +17 -0
- package/.output/server/node_modules/devalue/package.json +39 -0
- package/.output/server/node_modules/devalue/src/base64.js +60 -0
- package/.output/server/node_modules/devalue/src/constants.js +12 -0
- package/.output/server/node_modules/devalue/src/operations.js +221 -0
- package/.output/server/node_modules/devalue/src/parse.js +279 -0
- package/.output/server/node_modules/devalue/src/stringify.js +433 -0
- package/.output/server/node_modules/devalue/src/uneval.js +698 -0
- package/.output/server/node_modules/devalue/src/utils.js +190 -0
- package/.output/server/node_modules/entities/dist/commonjs/decode-codepoint.js +77 -0
- package/.output/server/node_modules/entities/dist/commonjs/decode.js +568 -0
- package/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-html.js +7 -0
- package/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-xml.js +7 -0
- package/.output/server/node_modules/entities/dist/commonjs/internal/bin-trie-flags.js +21 -0
- package/.output/server/node_modules/entities/dist/commonjs/internal/decode-shared.js +31 -0
- package/.output/server/node_modules/entities/dist/commonjs/package.json +3 -0
- package/.output/server/node_modules/entities/package.json +120 -0
- package/.output/server/node_modules/estree-walker/dist/umd/estree-walker.js +344 -0
- package/.output/server/node_modules/estree-walker/package.json +37 -0
- package/.output/server/node_modules/fast-deep-equal/index.js +46 -0
- package/.output/server/node_modules/fast-deep-equal/package.json +61 -0
- package/.output/server/node_modules/fast-uri/index.js +711 -0
- package/.output/server/node_modules/fast-uri/lib/schemes.js +272 -0
- package/.output/server/node_modules/fast-uri/lib/utils.js +799 -0
- package/.output/server/node_modules/fast-uri/package.json +68 -0
- package/.output/server/node_modules/get-port-please/dist/index.mjs +430 -0
- package/.output/server/node_modules/get-port-please/package.json +39 -0
- package/.output/server/node_modules/h3/dist/index.mjs +2498 -0
- package/.output/server/node_modules/h3/package.json +75 -0
- package/.output/server/node_modules/hookable/dist/index.mjs +257 -0
- package/.output/server/node_modules/hookable/package.json +54 -0
- package/.output/server/node_modules/http-shutdown/index.js +85 -0
- package/.output/server/node_modules/http-shutdown/package.json +32 -0
- package/.output/server/node_modules/iron-webcrypto/dist/index.js +298 -0
- package/.output/server/node_modules/iron-webcrypto/package.json +72 -0
- package/.output/server/node_modules/is-extglob/index.js +20 -0
- package/.output/server/node_modules/is-extglob/package.json +69 -0
- package/.output/server/node_modules/is-glob/index.js +150 -0
- package/.output/server/node_modules/is-glob/package.json +81 -0
- package/.output/server/node_modules/jiti/dist/jiti.cjs +1 -0
- package/.output/server/node_modules/jiti/lib/jiti.mjs +29 -0
- package/.output/server/node_modules/jiti/package.json +146 -0
- package/.output/server/node_modules/json-schema-traverse/index.js +93 -0
- package/.output/server/node_modules/json-schema-traverse/package.json +43 -0
- package/.output/server/node_modules/listhen/dist/chunks/xdg-open.mjs +1069 -0
- package/.output/server/node_modules/listhen/dist/index.mjs +19 -0
- package/.output/server/node_modules/listhen/dist/shared/listhen.tqe5I1Rl.mjs +1040 -0
- package/.output/server/node_modules/listhen/package.json +84 -0
- package/.output/server/node_modules/napi-wasm/index.mjs +1371 -0
- package/.output/server/node_modules/napi-wasm/package.json +33 -0
- package/.output/server/node_modules/node-forge/lib/aes.js +1091 -0
- package/.output/server/node_modules/node-forge/lib/aesCipherSuites.js +282 -0
- package/.output/server/node_modules/node-forge/lib/asn1-validator.js +91 -0
- package/.output/server/node_modules/node-forge/lib/asn1.js +1522 -0
- package/.output/server/node_modules/node-forge/lib/baseN.js +186 -0
- package/.output/server/node_modules/node-forge/lib/cipher.js +230 -0
- package/.output/server/node_modules/node-forge/lib/cipherModes.js +1027 -0
- package/.output/server/node_modules/node-forge/lib/des.js +496 -0
- package/.output/server/node_modules/node-forge/lib/ed25519.js +1091 -0
- package/.output/server/node_modules/node-forge/lib/forge.js +13 -0
- package/.output/server/node_modules/node-forge/lib/hmac.js +146 -0
- package/.output/server/node_modules/node-forge/lib/index.js +33 -0
- package/.output/server/node_modules/node-forge/lib/jsbn.js +1294 -0
- package/.output/server/node_modules/node-forge/lib/kem.js +168 -0
- package/.output/server/node_modules/node-forge/lib/log.js +319 -0
- package/.output/server/node_modules/node-forge/lib/md.all.js +13 -0
- package/.output/server/node_modules/node-forge/lib/md.js +11 -0
- package/.output/server/node_modules/node-forge/lib/md5.js +289 -0
- package/.output/server/node_modules/node-forge/lib/mgf.js +12 -0
- package/.output/server/node_modules/node-forge/lib/mgf1.js +57 -0
- package/.output/server/node_modules/node-forge/lib/oids.js +180 -0
- package/.output/server/node_modules/node-forge/lib/pbe.js +1029 -0
- package/.output/server/node_modules/node-forge/lib/pbkdf2.js +211 -0
- package/.output/server/node_modules/node-forge/lib/pem.js +413 -0
- package/.output/server/node_modules/node-forge/lib/pkcs1.js +276 -0
- package/.output/server/node_modules/node-forge/lib/pkcs12.js +1081 -0
- package/.output/server/node_modules/node-forge/lib/pkcs7.js +1260 -0
- package/.output/server/node_modules/node-forge/lib/pkcs7asn1.js +410 -0
- package/.output/server/node_modules/node-forge/lib/pki.js +102 -0
- package/.output/server/node_modules/node-forge/lib/prime.js +297 -0
- package/.output/server/node_modules/node-forge/lib/prng.js +419 -0
- package/.output/server/node_modules/node-forge/lib/pss.js +241 -0
- package/.output/server/node_modules/node-forge/lib/random.js +191 -0
- package/.output/server/node_modules/node-forge/lib/rc2.js +410 -0
- package/.output/server/node_modules/node-forge/lib/rsa.js +2014 -0
- package/.output/server/node_modules/node-forge/lib/sha1.js +319 -0
- package/.output/server/node_modules/node-forge/lib/sha256.js +327 -0
- package/.output/server/node_modules/node-forge/lib/sha512.js +561 -0
- package/.output/server/node_modules/node-forge/lib/ssh.js +236 -0
- package/.output/server/node_modules/node-forge/lib/tls.js +4334 -0
- package/.output/server/node_modules/node-forge/lib/util.js +2652 -0
- package/.output/server/node_modules/node-forge/lib/x509.js +3257 -0
- package/.output/server/node_modules/node-forge/package.json +123 -0
- package/.output/server/node_modules/node-mock-http/dist/_polyfill/buffer/node.mjs +1 -0
- package/.output/server/node_modules/node-mock-http/dist/_polyfill/events/node.mjs +1 -0
- package/.output/server/node_modules/node-mock-http/dist/index.mjs +1 -0
- package/.output/server/node_modules/node-mock-http/package.json +63 -0
- package/.output/server/node_modules/nostics/dist/formatters/ansi.mjs +19 -0
- package/.output/server/node_modules/nostics/dist/index.mjs +194 -0
- package/.output/server/node_modules/nostics/package.json +126 -0
- package/.output/server/node_modules/pathe/dist/index.mjs +19 -0
- package/.output/server/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs +249 -0
- package/.output/server/node_modules/pathe/package.json +61 -0
- package/.output/server/node_modules/picomatch/index.js +17 -0
- package/.output/server/node_modules/picomatch/lib/constants.js +184 -0
- package/.output/server/node_modules/picomatch/lib/parse.js +1425 -0
- package/.output/server/node_modules/picomatch/lib/picomatch.js +361 -0
- package/.output/server/node_modules/picomatch/lib/scan.js +403 -0
- package/.output/server/node_modules/picomatch/lib/utils.js +72 -0
- package/.output/server/node_modules/picomatch/package.json +83 -0
- package/.output/server/node_modules/radix3/dist/index.mjs +262 -0
- package/.output/server/node_modules/radix3/package.json +52 -0
- package/.output/server/node_modules/source-map-js/lib/array-set.js +121 -0
- package/.output/server/node_modules/source-map-js/lib/base64-vlq.js +140 -0
- package/.output/server/node_modules/source-map-js/lib/base64.js +67 -0
- package/.output/server/node_modules/source-map-js/lib/binary-search.js +111 -0
- package/.output/server/node_modules/source-map-js/lib/mapping-list.js +79 -0
- package/.output/server/node_modules/source-map-js/lib/quick-sort.js +141 -0
- package/.output/server/node_modules/source-map-js/lib/source-map-consumer.js +1236 -0
- package/.output/server/node_modules/source-map-js/lib/source-map-generator.js +446 -0
- package/.output/server/node_modules/source-map-js/lib/source-node.js +420 -0
- package/.output/server/node_modules/source-map-js/lib/util.js +594 -0
- package/.output/server/node_modules/source-map-js/package.json +71 -0
- package/.output/server/node_modules/source-map-js/source-map.js +8 -0
- package/.output/server/node_modules/std-env/dist/index.mjs +1 -0
- package/.output/server/node_modules/std-env/package.json +43 -0
- package/.output/server/node_modules/tinyclip/dist/index.js +143 -0
- package/.output/server/node_modules/tinyclip/package.json +48 -0
- package/.output/server/node_modules/ufo/dist/index.mjs +645 -0
- package/.output/server/node_modules/ufo/package.json +48 -0
- package/.output/server/node_modules/uncrypto/dist/crypto.node.mjs +16 -0
- package/.output/server/node_modules/uncrypto/package.json +60 -0
- package/.output/server/node_modules/unhead/dist/client.mjs +22 -0
- package/.output/server/node_modules/unhead/dist/legacy.mjs +33 -0
- package/.output/server/node_modules/unhead/dist/minify.mjs +183 -0
- package/.output/server/node_modules/unhead/dist/parser.mjs +518 -0
- package/.output/server/node_modules/unhead/dist/plugins.mjs +782 -0
- package/.output/server/node_modules/unhead/dist/server.mjs +99 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.BEmVMkeA.mjs +673 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.Bf_fPVYA.mjs +6 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.Bm4Y6XQI.mjs +17 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.C5Bksi2B.mjs +49 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.CGPOfp5O.mjs +32 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.CHEy9ana.mjs +7 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.C_7zwq8E.mjs +11 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.CaeaMM5q.mjs +19 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.D7HkBzZn.mjs +59 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.D9VfQWNo.mjs +240 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.DD4N5B4k.mjs +224 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.DGl9jcjg.mjs +196 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.DJuZwX9c.mjs +400 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.DkxnqlHC.mjs +264 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.DspMpm6y.mjs +48 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.o8j9utSy.mjs +208 -0
- package/.output/server/node_modules/unhead/dist/stream/client.mjs +33 -0
- package/.output/server/node_modules/unhead/dist/stream/iife.mjs +2 -0
- package/.output/server/node_modules/unhead/dist/stream/server.mjs +446 -0
- package/.output/server/node_modules/unhead/dist/utils.mjs +7 -0
- package/.output/server/node_modules/unhead/package.json +179 -0
- package/.output/server/node_modules/untun/dist/_chunks/cloudflared.mjs +179 -0
- package/.output/server/node_modules/untun/dist/_chunks/log.mjs +27 -0
- package/.output/server/node_modules/untun/dist/index.mjs +47 -0
- package/.output/server/node_modules/untun/package.json +44 -0
- package/.output/server/node_modules/uqr/dist/index.mjs +739 -0
- package/.output/server/node_modules/uqr/package.json +69 -0
- package/.output/server/node_modules/vue/dist/vue.cjs.js +80 -0
- package/.output/server/node_modules/vue/dist/vue.cjs.prod.js +66 -0
- package/.output/server/node_modules/vue/index.js +7 -0
- package/.output/server/node_modules/vue/index.mjs +1 -0
- package/.output/server/node_modules/vue/package.json +112 -0
- package/.output/server/node_modules/vue/server-renderer/index.mjs +1 -0
- package/.output/server/node_modules/vue-bundle-renderer/dist/runtime.mjs +687 -0
- package/.output/server/node_modules/vue-bundle-renderer/package.json +66 -0
- package/.output/server/node_modules/zod/index.js +7 -0
- package/.output/server/node_modules/zod/package.json +147 -0
- package/.output/server/node_modules/zod/v3/ZodError.js +143 -0
- package/.output/server/node_modules/zod/v3/errors.js +9 -0
- package/.output/server/node_modules/zod/v3/external.js +6 -0
- package/.output/server/node_modules/zod/v3/helpers/errorUtil.js +6 -0
- package/.output/server/node_modules/zod/v3/helpers/parseUtil.js +109 -0
- package/.output/server/node_modules/zod/v3/helpers/typeAliases.js +1 -0
- package/.output/server/node_modules/zod/v3/helpers/util.js +133 -0
- package/.output/server/node_modules/zod/v3/index.js +4 -0
- package/.output/server/node_modules/zod/v3/locales/en.js +109 -0
- package/.output/server/node_modules/zod/v3/package.json +7 -0
- package/.output/server/node_modules/zod/v3/types.js +3697 -0
- package/.output/server/node_modules/zod/v4/classic/checks.js +1 -0
- package/.output/server/node_modules/zod/v4/classic/coerce.js +17 -0
- package/.output/server/node_modules/zod/v4/classic/compat.js +31 -0
- package/.output/server/node_modules/zod/v4/classic/deep-partial.js +13 -0
- package/.output/server/node_modules/zod/v4/classic/errors.js +57 -0
- package/.output/server/node_modules/zod/v4/classic/external.js +17 -0
- package/.output/server/node_modules/zod/v4/classic/from-json-schema.js +881 -0
- package/.output/server/node_modules/zod/v4/classic/in-out.js +36 -0
- package/.output/server/node_modules/zod/v4/classic/index.js +4 -0
- package/.output/server/node_modules/zod/v4/classic/iso.js +15 -0
- package/.output/server/node_modules/zod/v4/classic/package.json +7 -0
- package/.output/server/node_modules/zod/v4/classic/parse.js +16 -0
- package/.output/server/node_modules/zod/v4/classic/schemas.js +1535 -0
- package/.output/server/node_modules/zod/v4/core/api.js +1107 -0
- package/.output/server/node_modules/zod/v4/core/checks.js +516 -0
- package/.output/server/node_modules/zod/v4/core/compile.js +1866 -0
- package/.output/server/node_modules/zod/v4/core/core.js +141 -0
- package/.output/server/node_modules/zod/v4/core/doc.js +38 -0
- package/.output/server/node_modules/zod/v4/core/errors.js +267 -0
- package/.output/server/node_modules/zod/v4/core/index.js +19 -0
- package/.output/server/node_modules/zod/v4/core/json-schema-generator.js +99 -0
- package/.output/server/node_modules/zod/v4/core/json-schema-processors.js +843 -0
- package/.output/server/node_modules/zod/v4/core/json-schema.js +1 -0
- package/.output/server/node_modules/zod/v4/core/memoizer.js +311 -0
- package/.output/server/node_modules/zod/v4/core/package.json +7 -0
- package/.output/server/node_modules/zod/v4/core/parse.js +175 -0
- package/.output/server/node_modules/zod/v4/core/regexes.js +156 -0
- package/.output/server/node_modules/zod/v4/core/registries.js +51 -0
- package/.output/server/node_modules/zod/v4/core/schemas.js +2636 -0
- package/.output/server/node_modules/zod/v4/core/to-json-schema.js +651 -0
- package/.output/server/node_modules/zod/v4/core/util.js +873 -0
- package/.output/server/node_modules/zod/v4/core/versions.js +5 -0
- package/.output/server/node_modules/zod/v4/core/visit.js +169 -0
- package/.output/server/node_modules/zod/v4/index.js +4 -0
- package/.output/server/node_modules/zod/v4/locales/ar.js +111 -0
- package/.output/server/node_modules/zod/v4/locales/az.js +110 -0
- package/.output/server/node_modules/zod/v4/locales/be.js +168 -0
- package/.output/server/node_modules/zod/v4/locales/bg.js +125 -0
- package/.output/server/node_modules/zod/v4/locales/bn.js +113 -0
- package/.output/server/node_modules/zod/v4/locales/ca.js +112 -0
- package/.output/server/node_modules/zod/v4/locales/ckb.js +133 -0
- package/.output/server/node_modules/zod/v4/locales/cs.js +116 -0
- package/.output/server/node_modules/zod/v4/locales/da.js +120 -0
- package/.output/server/node_modules/zod/v4/locales/de.js +113 -0
- package/.output/server/node_modules/zod/v4/locales/el.js +112 -0
- package/.output/server/node_modules/zod/v4/locales/en.js +125 -0
- package/.output/server/node_modules/zod/v4/locales/eo.js +114 -0
- package/.output/server/node_modules/zod/v4/locales/es.js +136 -0
- package/.output/server/node_modules/zod/v4/locales/fa.js +119 -0
- package/.output/server/node_modules/zod/v4/locales/fi.js +117 -0
- package/.output/server/node_modules/zod/v4/locales/fr-CA.js +112 -0
- package/.output/server/node_modules/zod/v4/locales/fr.js +129 -0
- package/.output/server/node_modules/zod/v4/locales/gu.js +113 -0
- package/.output/server/node_modules/zod/v4/locales/he.js +221 -0
- package/.output/server/node_modules/zod/v4/locales/hi.js +111 -0
- package/.output/server/node_modules/zod/v4/locales/hr.js +126 -0
- package/.output/server/node_modules/zod/v4/locales/hu.js +113 -0
- package/.output/server/node_modules/zod/v4/locales/hy.js +158 -0
- package/.output/server/node_modules/zod/v4/locales/id.js +111 -0
- package/.output/server/node_modules/zod/v4/locales/index.js +63 -0
- package/.output/server/node_modules/zod/v4/locales/is.js +114 -0
- package/.output/server/node_modules/zod/v4/locales/it.js +113 -0
- package/.output/server/node_modules/zod/v4/locales/ja.js +112 -0
- package/.output/server/node_modules/zod/v4/locales/ka.js +117 -0
- package/.output/server/node_modules/zod/v4/locales/kh.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/km.js +115 -0
- package/.output/server/node_modules/zod/v4/locales/kn.js +116 -0
- package/.output/server/node_modules/zod/v4/locales/ko.js +116 -0
- package/.output/server/node_modules/zod/v4/locales/lt.js +207 -0
- package/.output/server/node_modules/zod/v4/locales/mk.js +114 -0
- package/.output/server/node_modules/zod/v4/locales/ms.js +112 -0
- package/.output/server/node_modules/zod/v4/locales/ne.js +111 -0
- package/.output/server/node_modules/zod/v4/locales/nl.js +115 -0
- package/.output/server/node_modules/zod/v4/locales/nn.js +113 -0
- package/.output/server/node_modules/zod/v4/locales/no.js +113 -0
- package/.output/server/node_modules/zod/v4/locales/ota.js +114 -0
- package/.output/server/node_modules/zod/v4/locales/package.json +7 -0
- package/.output/server/node_modules/zod/v4/locales/pl.js +114 -0
- package/.output/server/node_modules/zod/v4/locales/ps.js +119 -0
- package/.output/server/node_modules/zod/v4/locales/pt-BR.js +143 -0
- package/.output/server/node_modules/zod/v4/locales/pt.js +142 -0
- package/.output/server/node_modules/zod/v4/locales/ro.js +122 -0
- package/.output/server/node_modules/zod/v4/locales/ru.js +168 -0
- package/.output/server/node_modules/zod/v4/locales/sk.js +116 -0
- package/.output/server/node_modules/zod/v4/locales/sl.js +114 -0
- package/.output/server/node_modules/zod/v4/locales/sv.js +115 -0
- package/.output/server/node_modules/zod/v4/locales/ta.js +115 -0
- package/.output/server/node_modules/zod/v4/locales/tg.js +117 -0
- package/.output/server/node_modules/zod/v4/locales/th.js +115 -0
- package/.output/server/node_modules/zod/v4/locales/tk.js +107 -0
- package/.output/server/node_modules/zod/v4/locales/tr.js +110 -0
- package/.output/server/node_modules/zod/v4/locales/ua.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/uk.js +113 -0
- package/.output/server/node_modules/zod/v4/locales/ur.js +115 -0
- package/.output/server/node_modules/zod/v4/locales/uz.js +113 -0
- package/.output/server/node_modules/zod/v4/locales/vi.js +113 -0
- package/.output/server/node_modules/zod/v4/locales/yo.js +112 -0
- package/.output/server/node_modules/zod/v4/locales/zh-CN.js +114 -0
- package/.output/server/node_modules/zod/v4/locales/zh-TW.js +112 -0
- package/.output/server/node_modules/zod/v4/mini/checks.js +1 -0
- package/.output/server/node_modules/zod/v4/mini/coerce.js +22 -0
- package/.output/server/node_modules/zod/v4/mini/deep-partial.js +13 -0
- package/.output/server/node_modules/zod/v4/mini/external.js +16 -0
- package/.output/server/node_modules/zod/v4/mini/in-out.js +36 -0
- package/.output/server/node_modules/zod/v4/mini/iso.js +34 -0
- package/.output/server/node_modules/zod/v4/mini/package.json +7 -0
- package/.output/server/node_modules/zod/v4/mini/parse.js +1 -0
- package/.output/server/node_modules/zod/v4/mini/schemas.js +1002 -0
- package/.output/server/node_modules/zod/v4/package.json +7 -0
- package/.output/server/node_modules/zod/v4-mini/index.js +3 -0
- package/.output/server/node_modules/zod/v4-mini/package.json +7 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/Options.js +46 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/Refs.js +22 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/errorMessages.js +14 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js +8 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/index.js +40 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/package.json +1 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parseDef.js +62 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parseTypes.js +1 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/any.js +17 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/array.js +26 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js +49 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js +5 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js +4 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js +4 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/date.js +46 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/default.js +7 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js +7 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js +6 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js +52 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js +21 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/map.js +26 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js +16 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/never.js +11 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/null.js +10 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js +33 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/number.js +52 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/object.js +72 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js +21 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js +20 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js +4 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js +4 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/record.js +61 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/set.js +20 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/string.js +352 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js +32 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js +6 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/union.js +80 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js +4 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/selectParser.js +105 -0
- package/.output/server/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js +87 -0
- package/.output/server/node_modules/zod-to-json-schema/package.json +85 -0
- package/.output/server/package.json +64 -0
- package/README.md +226 -23
- package/bin/bantou.mjs +33 -0
- package/package.json +18 -8
- package/protocol/PROTOCOL.md +26 -0
- package/protocol/protocol.json +92 -0
- package/dist/cap.js +0 -7
- package/dist/cli.js +0 -27
- package/dist/config.js +0 -23
- package/dist/daemon.js +0 -23
- package/dist/session.js +0 -7
- package/dist/workspace.js +0 -8
|
@@ -0,0 +1,799 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
/** @type {(value: string) => boolean} */
|
|
4
|
+
const isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu)
|
|
5
|
+
|
|
6
|
+
/** @type {(value: string) => boolean} */
|
|
7
|
+
const isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u)
|
|
8
|
+
|
|
9
|
+
/** @type {(value: string) => boolean} */
|
|
10
|
+
const isPort = RegExp.prototype.test.bind(/^\d*$/u)
|
|
11
|
+
|
|
12
|
+
/** @type {(value: string) => boolean} */
|
|
13
|
+
const isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu)
|
|
14
|
+
|
|
15
|
+
/** @type {(value: string) => boolean} */
|
|
16
|
+
const isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu)
|
|
17
|
+
|
|
18
|
+
/** @type {(value: string) => boolean} */
|
|
19
|
+
const isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u)
|
|
20
|
+
|
|
21
|
+
/** @type {(value: string) => boolean} */
|
|
22
|
+
const isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u)
|
|
23
|
+
|
|
24
|
+
/** @type {(value: string) => boolean} */
|
|
25
|
+
const isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u)
|
|
26
|
+
|
|
27
|
+
const BYTE_HEX = new Array(256)
|
|
28
|
+
{
|
|
29
|
+
const HEX_DIGITS = '0123456789ABCDEF'
|
|
30
|
+
for (let i = 0; i < 256; i++) {
|
|
31
|
+
BYTE_HEX[i] = '%' + HEX_DIGITS[i >> 4] + HEX_DIGITS[i & 0xF]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function percentEncodeNonAscii (cp) {
|
|
35
|
+
if (cp < 0x800) {
|
|
36
|
+
return BYTE_HEX[0xC0 | (cp >> 6)] +
|
|
37
|
+
BYTE_HEX[0x80 | (cp & 0x3F)]
|
|
38
|
+
}
|
|
39
|
+
if (cp < 0x10000) {
|
|
40
|
+
return BYTE_HEX[0xE0 | (cp >> 12)] +
|
|
41
|
+
BYTE_HEX[0x80 | ((cp >> 6) & 0x3F)] +
|
|
42
|
+
BYTE_HEX[0x80 | (cp & 0x3F)]
|
|
43
|
+
}
|
|
44
|
+
return BYTE_HEX[0xF0 | (cp >> 18)] +
|
|
45
|
+
BYTE_HEX[0x80 | ((cp >> 12) & 0x3F)] +
|
|
46
|
+
BYTE_HEX[0x80 | ((cp >> 6) & 0x3F)] +
|
|
47
|
+
BYTE_HEX[0x80 | (cp & 0x3F)]
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @param {Array<string>} input
|
|
52
|
+
* @returns {string}
|
|
53
|
+
*/
|
|
54
|
+
function stringArrayToHexStripped (input) {
|
|
55
|
+
let acc = ''
|
|
56
|
+
let code = 0
|
|
57
|
+
let i = 0
|
|
58
|
+
|
|
59
|
+
for (i = 0; i < input.length; i++) {
|
|
60
|
+
code = input[i].charCodeAt(0)
|
|
61
|
+
if (code === 48) {
|
|
62
|
+
continue
|
|
63
|
+
}
|
|
64
|
+
if (!((code >= 48 && code <= 57) || (code >= 65 && code <= 70) || (code >= 97 && code <= 102))) {
|
|
65
|
+
return ''
|
|
66
|
+
}
|
|
67
|
+
acc += input[i]
|
|
68
|
+
break
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
for (i += 1; i < input.length; i++) {
|
|
72
|
+
code = input[i].charCodeAt(0)
|
|
73
|
+
if (!((code >= 48 && code <= 57) || (code >= 65 && code <= 70) || (code >= 97 && code <= 102))) {
|
|
74
|
+
return ''
|
|
75
|
+
}
|
|
76
|
+
acc += input[i]
|
|
77
|
+
}
|
|
78
|
+
return acc
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** @type {(value: string) => boolean} */
|
|
82
|
+
const isHextet = RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/)
|
|
83
|
+
|
|
84
|
+
/** @type {(value: string) => boolean} */
|
|
85
|
+
const isIPvFuture = RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/)
|
|
86
|
+
|
|
87
|
+
/** @type {(value: string) => boolean} */
|
|
88
|
+
const isZoneCharacter = RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/)
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @param {string} value
|
|
92
|
+
* @returns {boolean}
|
|
93
|
+
*/
|
|
94
|
+
const nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u)
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @param {string} zone
|
|
98
|
+
* @returns {boolean}
|
|
99
|
+
*/
|
|
100
|
+
function isZoneIdentifier (zone) {
|
|
101
|
+
if (zone.length === 0) return false
|
|
102
|
+
|
|
103
|
+
for (let i = 0; i < zone.length; i++) {
|
|
104
|
+
if (isZoneCharacter(zone[i])) continue
|
|
105
|
+
if (zone[i] === '%' && i + 2 < zone.length && isHexPair(zone.slice(i + 1, i + 3))) {
|
|
106
|
+
i += 2
|
|
107
|
+
continue
|
|
108
|
+
}
|
|
109
|
+
return false
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return true
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Compresses the longest run of zero hextets to "::" per RFC 5952. A run of a
|
|
117
|
+
* single zero hextet is left uncompressed. On ties the leftmost run wins.
|
|
118
|
+
*
|
|
119
|
+
* @param {string[]} hextets
|
|
120
|
+
* @returns {string}
|
|
121
|
+
*/
|
|
122
|
+
function compressIPv6ZeroRun (hextets) {
|
|
123
|
+
let bestStart = -1
|
|
124
|
+
let bestLength = 0
|
|
125
|
+
let runStart = -1
|
|
126
|
+
let runLength = 0
|
|
127
|
+
for (let i = 0; i < hextets.length; i++) {
|
|
128
|
+
if (hextets[i] === '0') {
|
|
129
|
+
if (runStart === -1) runStart = i
|
|
130
|
+
runLength++
|
|
131
|
+
if (runLength > bestLength) {
|
|
132
|
+
bestLength = runLength
|
|
133
|
+
bestStart = runStart
|
|
134
|
+
}
|
|
135
|
+
} else {
|
|
136
|
+
runStart = -1
|
|
137
|
+
runLength = 0
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (bestLength < 2) return hextets.join(':')
|
|
142
|
+
|
|
143
|
+
const head = hextets.slice(0, bestStart).join(':')
|
|
144
|
+
const tail = hextets.slice(bestStart + bestLength).join(':')
|
|
145
|
+
return head + '::' + tail
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Validates an IPv6 address against the alternatives in RFC 3986 section
|
|
150
|
+
* 3.2.2 and returns the same address with leading hextet zeroes removed.
|
|
151
|
+
* An embedded IPv4 address counts as two hextets and is only valid at the end.
|
|
152
|
+
*
|
|
153
|
+
* @param {string} input
|
|
154
|
+
* @returns {string|undefined}
|
|
155
|
+
*/
|
|
156
|
+
function normalizeIPv6Address (input) {
|
|
157
|
+
const compression = input.indexOf('::')
|
|
158
|
+
if (compression !== -1 && input.indexOf('::', compression + 1) !== -1) return undefined
|
|
159
|
+
|
|
160
|
+
const left = compression === -1 ? input.split(':') : input.slice(0, compression).split(':')
|
|
161
|
+
const right = compression === -1 ? [] : input.slice(compression + 2).split(':')
|
|
162
|
+
if (compression !== -1) {
|
|
163
|
+
if (left.length === 1 && left[0] === '') left.length = 0
|
|
164
|
+
if (right.length === 1 && right[0] === '') right.length = 0
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const parts = left.concat(right)
|
|
168
|
+
let hextetCount = 0
|
|
169
|
+
for (let i = 0; i < parts.length; i++) {
|
|
170
|
+
const part = parts[i]
|
|
171
|
+
if (part === '') return undefined
|
|
172
|
+
|
|
173
|
+
if (part.indexOf('.') !== -1) {
|
|
174
|
+
if (i !== parts.length - 1 || (compression !== -1 && right.length === 0) || !isIPv4(part)) return undefined
|
|
175
|
+
hextetCount += 2
|
|
176
|
+
continue
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (!isHextet(part)) return undefined
|
|
180
|
+
parts[i] = parseInt(part, 16).toString(16)
|
|
181
|
+
hextetCount++
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (compression === -1) {
|
|
185
|
+
if (hextetCount !== 8) return undefined
|
|
186
|
+
return compressIPv6ZeroRun(parts)
|
|
187
|
+
}
|
|
188
|
+
if (hextetCount >= 8) return undefined
|
|
189
|
+
|
|
190
|
+
// expand "::" then re-compress the longest run for a canonical result
|
|
191
|
+
const expanded = parts.slice(0, left.length)
|
|
192
|
+
for (let i = hextetCount; i < 8; i++) expanded.push('0')
|
|
193
|
+
for (let i = left.length; i < parts.length; i++) expanded.push(parts[i])
|
|
194
|
+
return compressIPv6ZeroRun(expanded)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* @typedef {Object} NormalizeIPv6Result
|
|
199
|
+
* @property {string} host - The normalized host.
|
|
200
|
+
* @property {string} [escapedHost] - The escaped host.
|
|
201
|
+
* @property {boolean} isIPV6 - Indicates if the host is an IPv6 address.
|
|
202
|
+
* @property {boolean} [isIPVFuture] - Indicates if the host is an IPvFuture literal.
|
|
203
|
+
* @property {boolean} [error] - Indicates if a bracketed IP literal is malformed.
|
|
204
|
+
*/
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Validates and normalizes a bracketed IP literal. Raw zone separators remain
|
|
208
|
+
* accepted for backwards compatibility, while encoded separators and zone
|
|
209
|
+
* contents follow RFC 6874.
|
|
210
|
+
*
|
|
211
|
+
* @param {string} host
|
|
212
|
+
* @returns {NormalizeIPv6Result}
|
|
213
|
+
*/
|
|
214
|
+
function normalizeIPv6 (host) {
|
|
215
|
+
const bracketed = host[0] === '[' && host[host.length - 1] === ']'
|
|
216
|
+
const hasBracket = host[0] === '[' || host[host.length - 1] === ']'
|
|
217
|
+
if (hasBracket && !bracketed) return { host, isIPV6: false, error: true }
|
|
218
|
+
|
|
219
|
+
let input = bracketed ? host.slice(1, -1) : host
|
|
220
|
+
if (bracketed && isIPvFuture(input)) {
|
|
221
|
+
input = input.toLowerCase()
|
|
222
|
+
return { host: `[${input}]`, escapedHost: input, isIPV6: false, isIPVFuture: true }
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if (findToken(input, ':') < 2) {
|
|
226
|
+
return { host, isIPV6: false, error: bracketed }
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
let zoneIdentifier = ''
|
|
230
|
+
const zoneSeparator = input.indexOf('%')
|
|
231
|
+
if (zoneSeparator !== -1) {
|
|
232
|
+
const separatorLength = input.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === '%25' ? 3 : 1
|
|
233
|
+
zoneIdentifier = input.slice(zoneSeparator + separatorLength)
|
|
234
|
+
if (!isZoneIdentifier(zoneIdentifier)) return { host, isIPV6: false, error: true }
|
|
235
|
+
input = input.slice(0, zoneSeparator)
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const address = normalizeIPv6Address(input)
|
|
239
|
+
if (address === undefined) return { host, isIPV6: false, error: true }
|
|
240
|
+
|
|
241
|
+
return {
|
|
242
|
+
host: address + (zoneIdentifier ? '%' + zoneIdentifier : ''),
|
|
243
|
+
escapedHost: address + (zoneIdentifier ? '%25' + zoneIdentifier : ''),
|
|
244
|
+
isIPV6: true
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* @param {string} str
|
|
250
|
+
* @param {string} token
|
|
251
|
+
* @returns {number}
|
|
252
|
+
*/
|
|
253
|
+
function findToken (str, token) {
|
|
254
|
+
let ind = 0
|
|
255
|
+
for (let i = 0; i < str.length; i++) {
|
|
256
|
+
if (str[i] === token) ind++
|
|
257
|
+
}
|
|
258
|
+
return ind
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* @param {string} path
|
|
263
|
+
* @returns {string}
|
|
264
|
+
*
|
|
265
|
+
* @see https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4
|
|
266
|
+
*/
|
|
267
|
+
function removeDotSegments (path) {
|
|
268
|
+
let input = path
|
|
269
|
+
const output = []
|
|
270
|
+
let nextSlash = -1
|
|
271
|
+
let len = 0
|
|
272
|
+
|
|
273
|
+
// eslint-disable-next-line no-cond-assign
|
|
274
|
+
while (len = input.length) {
|
|
275
|
+
if (len === 1) {
|
|
276
|
+
if (input === '.') {
|
|
277
|
+
break
|
|
278
|
+
} else if (input === '/') {
|
|
279
|
+
output.push('/')
|
|
280
|
+
break
|
|
281
|
+
} else {
|
|
282
|
+
output.push(input)
|
|
283
|
+
break
|
|
284
|
+
}
|
|
285
|
+
} else if (len === 2) {
|
|
286
|
+
if (input[0] === '.') {
|
|
287
|
+
if (input[1] === '.') {
|
|
288
|
+
break
|
|
289
|
+
} else if (input[1] === '/') {
|
|
290
|
+
input = input.slice(2)
|
|
291
|
+
continue
|
|
292
|
+
}
|
|
293
|
+
} else if (input[0] === '/') {
|
|
294
|
+
if (input[1] === '.' || input[1] === '/') {
|
|
295
|
+
output.push('/')
|
|
296
|
+
break
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
} else if (len === 3) {
|
|
300
|
+
if (input === '/..') {
|
|
301
|
+
if (output.length !== 0) {
|
|
302
|
+
output.pop()
|
|
303
|
+
}
|
|
304
|
+
output.push('/')
|
|
305
|
+
break
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
if (input[0] === '.') {
|
|
309
|
+
if (input[1] === '.') {
|
|
310
|
+
if (input[2] === '/') {
|
|
311
|
+
input = input.slice(3)
|
|
312
|
+
continue
|
|
313
|
+
}
|
|
314
|
+
} else if (input[1] === '/') {
|
|
315
|
+
input = input.slice(2)
|
|
316
|
+
continue
|
|
317
|
+
}
|
|
318
|
+
} else if (input[0] === '/') {
|
|
319
|
+
if (input[1] === '.') {
|
|
320
|
+
if (input[2] === '/') {
|
|
321
|
+
input = input.slice(2)
|
|
322
|
+
continue
|
|
323
|
+
} else if (input[2] === '.') {
|
|
324
|
+
if (input[3] === '/') {
|
|
325
|
+
input = input.slice(3)
|
|
326
|
+
if (output.length !== 0) {
|
|
327
|
+
output.pop()
|
|
328
|
+
}
|
|
329
|
+
continue
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// Rule 2E: Move normal path segment to output
|
|
336
|
+
if ((nextSlash = input.indexOf('/', 1)) === -1) {
|
|
337
|
+
output.push(input)
|
|
338
|
+
break
|
|
339
|
+
} else {
|
|
340
|
+
output.push(input.slice(0, nextSlash))
|
|
341
|
+
input = input.slice(nextSlash)
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
return output.join('')
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Removes dot segments from the path of a relative reference (a path that does
|
|
350
|
+
* not start with "/") without changing what it resolves to against any base.
|
|
351
|
+
* Unlike `removeDotSegments`, leading ".." segments that cannot be collapsed
|
|
352
|
+
* are kept, the result never becomes root-relative, and a result that would be
|
|
353
|
+
* empty or start with an empty segment is prefixed with "." (an empty path
|
|
354
|
+
* means "same document" and a leading "//" would introduce an authority).
|
|
355
|
+
*
|
|
356
|
+
* @param {string} path
|
|
357
|
+
* @returns {string}
|
|
358
|
+
*/
|
|
359
|
+
function removeDotSegmentsRelative (path) {
|
|
360
|
+
if (path === '' || path[0] === '/') {
|
|
361
|
+
return removeDotSegments(path)
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
const segments = path.split('/')
|
|
365
|
+
const last = segments.length - 1
|
|
366
|
+
/** @type {string[]} */
|
|
367
|
+
const output = []
|
|
368
|
+
let trailingDirectory = false
|
|
369
|
+
|
|
370
|
+
for (let i = 0; i <= last; i++) {
|
|
371
|
+
const segment = segments[i]
|
|
372
|
+
if (segment === '.' || segment === '..') {
|
|
373
|
+
if (segment === '..') {
|
|
374
|
+
if (output.length !== 0 && output[output.length - 1] !== '..') {
|
|
375
|
+
output.pop()
|
|
376
|
+
} else {
|
|
377
|
+
output.push('..')
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
trailingDirectory = i === last
|
|
381
|
+
} else {
|
|
382
|
+
output.push(segment)
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
if (trailingDirectory && output[output.length - 1] !== '..') {
|
|
387
|
+
output.push('')
|
|
388
|
+
}
|
|
389
|
+
if (output.length === 0 || output[0] === '' || output[0].includes(':')) {
|
|
390
|
+
// An empty path, a leading empty segment ("//"), or a first segment
|
|
391
|
+
// containing ":" (which would be mistaken for a scheme, RFC 3986 section
|
|
392
|
+
// 4.2) must stay behind a "." segment so the reference keeps its meaning.
|
|
393
|
+
output.unshift('.')
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
return output.join('/')
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Re-escape RFC 3986 gen-delims that must not appear literally in the host.
|
|
401
|
+
* After the URI regex parses, these characters cannot be literal in the host
|
|
402
|
+
* field, so any that appear after decoding came from percent-encoding and
|
|
403
|
+
* must be restored to prevent authority structure changes.
|
|
404
|
+
*
|
|
405
|
+
* @param {string} host
|
|
406
|
+
* @param {boolean} isIP - true for IPv4/IPv6 hosts (skip colon re-escaping)
|
|
407
|
+
* @returns {string}
|
|
408
|
+
*/
|
|
409
|
+
const HOST_DELIMS = { '@': '%40', '/': '%2F', '?': '%3F', '#': '%23', ':': '%3A' }
|
|
410
|
+
const HOST_DELIM_RE = /[@/?#:]/g
|
|
411
|
+
const HOST_DELIM_NO_COLON_RE = /[@/?#]/g
|
|
412
|
+
|
|
413
|
+
function reescapeHostDelimiters (host, isIP) {
|
|
414
|
+
const re = isIP ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE
|
|
415
|
+
re.lastIndex = 0
|
|
416
|
+
return host.replace(re, (ch) => HOST_DELIMS[ch])
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Normalizes percent escapes and optionally decodes only unreserved ASCII bytes.
|
|
421
|
+
* Reserved delimiters such as `%2F` stay escaped; `%2E` is unreserved.
|
|
422
|
+
*
|
|
423
|
+
* @param {string} input
|
|
424
|
+
* @param {boolean} [decodeUnreserved=false]
|
|
425
|
+
* @returns {string}
|
|
426
|
+
*/
|
|
427
|
+
function normalizePercentEncoding (input, decodeUnreserved = false) {
|
|
428
|
+
if (input.indexOf('%') === -1) {
|
|
429
|
+
return input
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
let output = ''
|
|
433
|
+
|
|
434
|
+
for (let i = 0; i < input.length; i++) {
|
|
435
|
+
if (input[i] === '%' && i + 2 < input.length) {
|
|
436
|
+
const hex = input.slice(i + 1, i + 3)
|
|
437
|
+
if (isHexPair(hex)) {
|
|
438
|
+
const normalizedHex = hex.toUpperCase()
|
|
439
|
+
const decoded = String.fromCharCode(parseInt(normalizedHex, 16))
|
|
440
|
+
|
|
441
|
+
if (decodeUnreserved && isUnreserved(decoded)) {
|
|
442
|
+
output += decoded
|
|
443
|
+
} else {
|
|
444
|
+
output += '%' + normalizedHex
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
i += 2
|
|
448
|
+
continue
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
output += input[i]
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
return output
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* Normalizes path data without turning reserved escapes into live path syntax.
|
|
460
|
+
* Valid escapes are uppercased, raw unsafe characters are escaped, and only
|
|
461
|
+
* unreserved bytes that are not `.` are decoded.
|
|
462
|
+
*
|
|
463
|
+
* @param {string} input
|
|
464
|
+
* @returns {string}
|
|
465
|
+
*/
|
|
466
|
+
function normalizePathEncoding (input) {
|
|
467
|
+
let output = ''
|
|
468
|
+
|
|
469
|
+
for (let i = 0; i < input.length; i++) {
|
|
470
|
+
const ch = input[i]
|
|
471
|
+
if (ch === '%' && i + 2 < input.length) {
|
|
472
|
+
const hex = input.slice(i + 1, i + 3)
|
|
473
|
+
if (isHexPair(hex)) {
|
|
474
|
+
const normalizedHex = hex.toUpperCase()
|
|
475
|
+
const decoded = String.fromCharCode(parseInt(normalizedHex, 16))
|
|
476
|
+
|
|
477
|
+
if (decoded !== '.' && isUnreserved(decoded)) {
|
|
478
|
+
output += decoded
|
|
479
|
+
} else {
|
|
480
|
+
output += '%' + normalizedHex
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
i += 2
|
|
484
|
+
continue
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
if (isPathCharacter(ch)) {
|
|
489
|
+
output += ch
|
|
490
|
+
} else {
|
|
491
|
+
const code = input.charCodeAt(i)
|
|
492
|
+
if (code < 0x80) {
|
|
493
|
+
output += isEscapeSafe(code) ? ch : BYTE_HEX[code]
|
|
494
|
+
} else if (code < 0xD800 || code > 0xDFFF) {
|
|
495
|
+
output += percentEncodeNonAscii(code)
|
|
496
|
+
} else if (code <= 0xDBFF && i + 1 < input.length) {
|
|
497
|
+
const low = input.charCodeAt(i + 1)
|
|
498
|
+
if (low >= 0xDC00 && low <= 0xDFFF) {
|
|
499
|
+
output += percentEncodeNonAscii(0x10000 + ((code - 0xD800) << 10) + (low - 0xDC00))
|
|
500
|
+
i++
|
|
501
|
+
} else {
|
|
502
|
+
output += percentEncodeNonAscii(0xFFFD)
|
|
503
|
+
}
|
|
504
|
+
} else {
|
|
505
|
+
output += percentEncodeNonAscii(0xFFFD)
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
return output
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Serializes a path without rewriting reserved data. Raw RFC 3986 path
|
|
515
|
+
* characters remain literal, valid escapes are preserved and uppercased, and
|
|
516
|
+
* everything else is UTF-8 percent-encoded. In a path-noscheme, a colon in the
|
|
517
|
+
* first segment must be escaped so the result cannot be parsed as a scheme.
|
|
518
|
+
*
|
|
519
|
+
* @param {string} input
|
|
520
|
+
* @param {boolean} [pathNoScheme=false]
|
|
521
|
+
* @returns {string}
|
|
522
|
+
*/
|
|
523
|
+
function serializePathEncoding (input, pathNoScheme = false) {
|
|
524
|
+
let output = ''
|
|
525
|
+
let firstSegment = pathNoScheme && input[0] !== '/'
|
|
526
|
+
|
|
527
|
+
for (let i = 0; i < input.length; i++) {
|
|
528
|
+
const ch = input[i]
|
|
529
|
+
if (ch === '%' && i + 2 < input.length) {
|
|
530
|
+
const hex = input.slice(i + 1, i + 3)
|
|
531
|
+
if (isHexPair(hex)) {
|
|
532
|
+
output += '%' + hex.toUpperCase()
|
|
533
|
+
i += 2
|
|
534
|
+
continue
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
if (ch === '/') {
|
|
539
|
+
firstSegment = false
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
if (isPathCharacter(ch) && (ch !== ':' || !firstSegment)) {
|
|
543
|
+
output += ch
|
|
544
|
+
} else {
|
|
545
|
+
const code = input.charCodeAt(i)
|
|
546
|
+
if (code < 0x80) {
|
|
547
|
+
output += BYTE_HEX[code]
|
|
548
|
+
} else if (code < 0xD800 || code > 0xDFFF) {
|
|
549
|
+
output += percentEncodeNonAscii(code)
|
|
550
|
+
} else if (code <= 0xDBFF && i + 1 < input.length) {
|
|
551
|
+
const low = input.charCodeAt(i + 1)
|
|
552
|
+
if (low >= 0xDC00 && low <= 0xDFFF) {
|
|
553
|
+
output += percentEncodeNonAscii(0x10000 + ((code - 0xD800) << 10) + (low - 0xDC00))
|
|
554
|
+
i++
|
|
555
|
+
} else {
|
|
556
|
+
output += percentEncodeNonAscii(0xFFFD)
|
|
557
|
+
}
|
|
558
|
+
} else {
|
|
559
|
+
output += percentEncodeNonAscii(0xFFFD)
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
return output
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Percent-encodes a URI component using its RFC 3986 literal character set.
|
|
569
|
+
* Existing valid escapes are preserved and normalized to uppercase hex.
|
|
570
|
+
*
|
|
571
|
+
* @param {string} input
|
|
572
|
+
* @param {(value: string) => boolean} isAllowed
|
|
573
|
+
* @returns {string}
|
|
574
|
+
*/
|
|
575
|
+
function encodeComponent (input, isAllowed) {
|
|
576
|
+
let output = ''
|
|
577
|
+
|
|
578
|
+
for (let i = 0; i < input.length; i++) {
|
|
579
|
+
const ch = input[i]
|
|
580
|
+
if (ch === '%' && i + 2 < input.length) {
|
|
581
|
+
const hex = input.slice(i + 1, i + 3)
|
|
582
|
+
if (isHexPair(hex)) {
|
|
583
|
+
output += '%' + hex.toUpperCase()
|
|
584
|
+
i += 2
|
|
585
|
+
continue
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
if (isAllowed(ch)) {
|
|
590
|
+
output += ch
|
|
591
|
+
} else {
|
|
592
|
+
const code = input.charCodeAt(i)
|
|
593
|
+
if (code < 0x80) {
|
|
594
|
+
output += BYTE_HEX[code]
|
|
595
|
+
} else if (code < 0xD800 || code > 0xDFFF) {
|
|
596
|
+
output += percentEncodeNonAscii(code)
|
|
597
|
+
} else if (code <= 0xDBFF && i + 1 < input.length) {
|
|
598
|
+
const low = input.charCodeAt(i + 1)
|
|
599
|
+
if (low >= 0xDC00 && low <= 0xDFFF) {
|
|
600
|
+
output += percentEncodeNonAscii(0x10000 + ((code - 0xD800) << 10) + (low - 0xDC00))
|
|
601
|
+
i++
|
|
602
|
+
} else {
|
|
603
|
+
output += percentEncodeNonAscii(0xFFFD)
|
|
604
|
+
}
|
|
605
|
+
} else {
|
|
606
|
+
output += percentEncodeNonAscii(0xFFFD)
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
return output
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* Encodes userinfo while preserving its RFC 3986 §3.2.1 literal characters.
|
|
616
|
+
* In particular, authority delimiters such as `@`, `/`, `?`, and `#` are data.
|
|
617
|
+
*
|
|
618
|
+
* @param {string} input
|
|
619
|
+
* @returns {string}
|
|
620
|
+
*/
|
|
621
|
+
function encodeUserinfo (input) {
|
|
622
|
+
return encodeComponent(input, isUserinfoCharacter)
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* Encodes query data using the RFC 3986 §3.4 grammar. A literal `#` must be
|
|
627
|
+
* escaped because it would otherwise begin the fragment component.
|
|
628
|
+
*
|
|
629
|
+
* @param {string} input
|
|
630
|
+
* @returns {string}
|
|
631
|
+
*/
|
|
632
|
+
function encodeQuery (input) {
|
|
633
|
+
return encodeComponent(input, isQueryFragmentCharacter)
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* Encodes fragment data using the RFC 3986 §3.5 grammar.
|
|
638
|
+
*
|
|
639
|
+
* @param {string} input
|
|
640
|
+
* @returns {string}
|
|
641
|
+
*/
|
|
642
|
+
function encodeFragment (input) {
|
|
643
|
+
return encodeComponent(input, isQueryFragmentCharacter)
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
function isEscapeSafe (cp) {
|
|
647
|
+
return (
|
|
648
|
+
(cp >= 0x30 && cp <= 0x39) ||
|
|
649
|
+
(cp >= 0x41 && cp <= 0x5A) ||
|
|
650
|
+
(cp >= 0x61 && cp <= 0x7A) ||
|
|
651
|
+
cp === 0x2A || cp === 0x2B || cp === 0x2D || cp === 0x2E ||
|
|
652
|
+
cp === 0x2F || cp === 0x40 || cp === 0x5F
|
|
653
|
+
)
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* Normalizes the percent-encoding of a query or fragment component.
|
|
658
|
+
*
|
|
659
|
+
* Like `normalizePathEncoding`, but uses the query/fragment character set
|
|
660
|
+
* (which additionally allows `?`) and decodes `.` since it has no dot-segment
|
|
661
|
+
* meaning outside of a path.
|
|
662
|
+
*
|
|
663
|
+
* @param {string} input
|
|
664
|
+
* @returns {string}
|
|
665
|
+
*/
|
|
666
|
+
function normalizeQueryFragmentEncoding (input) {
|
|
667
|
+
let output = ''
|
|
668
|
+
|
|
669
|
+
for (let i = 0; i < input.length; i++) {
|
|
670
|
+
const ch = input[i]
|
|
671
|
+
if (ch === '%' && i + 2 < input.length) {
|
|
672
|
+
const hex = input.slice(i + 1, i + 3)
|
|
673
|
+
if (isHexPair(hex)) {
|
|
674
|
+
const normalizedHex = hex.toUpperCase()
|
|
675
|
+
const decoded = String.fromCharCode(parseInt(normalizedHex, 16))
|
|
676
|
+
|
|
677
|
+
if (isUnreserved(decoded)) {
|
|
678
|
+
output += decoded
|
|
679
|
+
} else {
|
|
680
|
+
output += '%' + normalizedHex
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
i += 2
|
|
684
|
+
continue
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
if (isQueryFragmentCharacter(ch)) {
|
|
689
|
+
output += ch
|
|
690
|
+
} else {
|
|
691
|
+
const code = input.charCodeAt(i)
|
|
692
|
+
if (code < 0x80) {
|
|
693
|
+
output += isEscapeSafe(code) ? ch : BYTE_HEX[code]
|
|
694
|
+
} else if (code < 0xD800 || code > 0xDFFF) {
|
|
695
|
+
output += percentEncodeNonAscii(code)
|
|
696
|
+
} else if (code <= 0xDBFF && i + 1 < input.length) {
|
|
697
|
+
const low = input.charCodeAt(i + 1)
|
|
698
|
+
if (low >= 0xDC00 && low <= 0xDFFF) {
|
|
699
|
+
output += percentEncodeNonAscii(0x10000 + ((code - 0xD800) << 10) + (low - 0xDC00))
|
|
700
|
+
i++
|
|
701
|
+
} else {
|
|
702
|
+
output += percentEncodeNonAscii(0xFFFD)
|
|
703
|
+
}
|
|
704
|
+
} else {
|
|
705
|
+
output += percentEncodeNonAscii(0xFFFD)
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
return output
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* Escapes a component while preserving existing valid percent escapes.
|
|
715
|
+
*
|
|
716
|
+
* @param {string} input
|
|
717
|
+
* @returns {string}
|
|
718
|
+
*/
|
|
719
|
+
function escapePreservingEscapes (input) {
|
|
720
|
+
let output = ''
|
|
721
|
+
|
|
722
|
+
for (let i = 0; i < input.length; i++) {
|
|
723
|
+
if (input[i] === '%' && i + 2 < input.length) {
|
|
724
|
+
const hex = input.slice(i + 1, i + 3)
|
|
725
|
+
if (isHexPair(hex)) {
|
|
726
|
+
output += '%' + hex.toUpperCase()
|
|
727
|
+
i += 2
|
|
728
|
+
continue
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
output += escape(input[i])
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
return output
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
/**
|
|
739
|
+
* @param {import('../types/index').URIComponent} component
|
|
740
|
+
* @returns {string|undefined}
|
|
741
|
+
*/
|
|
742
|
+
function recomposeAuthority (component) {
|
|
743
|
+
const uriTokens = []
|
|
744
|
+
|
|
745
|
+
if (component.userinfo !== undefined) {
|
|
746
|
+
uriTokens.push(encodeUserinfo(component.userinfo))
|
|
747
|
+
uriTokens.push('@')
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
if (component.host !== undefined) {
|
|
751
|
+
let host = component.host
|
|
752
|
+
if (!isIPv4(host)) {
|
|
753
|
+
let ipV6res = normalizeIPv6(host)
|
|
754
|
+
if (ipV6res.isIPV6 !== true && ipV6res.isIPVFuture !== true) {
|
|
755
|
+
// Decode only unreserved bytes, once. In particular, keep %25 encoded
|
|
756
|
+
// so it cannot introduce a second escape during recomposition.
|
|
757
|
+
host = normalizePercentEncoding(host, true)
|
|
758
|
+
ipV6res = normalizeIPv6(host)
|
|
759
|
+
}
|
|
760
|
+
if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) {
|
|
761
|
+
host = `[${ipV6res.escapedHost}]`
|
|
762
|
+
} else {
|
|
763
|
+
host = reescapeHostDelimiters(host, false)
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
uriTokens.push(host)
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
if (typeof component.port === 'number' || typeof component.port === 'string') {
|
|
770
|
+
const port = String(component.port)
|
|
771
|
+
if (!isPort(port)) {
|
|
772
|
+
throw new TypeError('URI port is malformed.')
|
|
773
|
+
}
|
|
774
|
+
uriTokens.push(':')
|
|
775
|
+
uriTokens.push(port)
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
return uriTokens.length ? uriTokens.join('') : undefined
|
|
779
|
+
};
|
|
780
|
+
|
|
781
|
+
module.exports = {
|
|
782
|
+
nonSimpleDomain,
|
|
783
|
+
recomposeAuthority,
|
|
784
|
+
reescapeHostDelimiters,
|
|
785
|
+
normalizePercentEncoding,
|
|
786
|
+
normalizePathEncoding,
|
|
787
|
+
serializePathEncoding,
|
|
788
|
+
normalizeQueryFragmentEncoding,
|
|
789
|
+
encodeUserinfo,
|
|
790
|
+
encodeQuery,
|
|
791
|
+
encodeFragment,
|
|
792
|
+
escapePreservingEscapes,
|
|
793
|
+
removeDotSegments,
|
|
794
|
+
removeDotSegmentsRelative,
|
|
795
|
+
isIPv4,
|
|
796
|
+
isUUID,
|
|
797
|
+
normalizeIPv6,
|
|
798
|
+
stringArrayToHexStripped
|
|
799
|
+
}
|