UNPKG

chaite

Version:

core for chatgpt-plugin and karin-plugin-chatgpt

105 lines (102 loc) 3.75 kB
import { t as __commonJS } from "../../rolldown-runtime-DVriDoez.mjs"; //#region node_modules/.pnpm/encodeurl@2.0.0/node_modules/encodeurl/index.js /*! * encodeurl * Copyright(c) 2016 Douglas Christopher Wilson * MIT Licensed */ var require_encodeurl$1 = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/encodeurl@2.0.0/node_modules/encodeurl/index.js": ((exports, module) => { /** * Module exports. * @public */ module.exports = encodeUrl$1; /** * RegExp to match non-URL code points, *after* encoding (i.e. not including "%") * and including invalid escape sequences. * @private */ var ENCODE_CHARS_REGEXP$1 = /(?:[^\x21\x23-\x3B\x3D\x3F-\x5F\x61-\x7A\x7C\x7E]|%(?:[^0-9A-Fa-f]|[0-9A-Fa-f][^0-9A-Fa-f]|$))+/g; /** * RegExp to match unmatched surrogate pair. * @private */ var UNMATCHED_SURROGATE_PAIR_REGEXP$1 = /(^|[^\uD800-\uDBFF])[\uDC00-\uDFFF]|[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/g; /** * String to replace unmatched surrogate pair with. * @private */ var UNMATCHED_SURROGATE_PAIR_REPLACE$1 = "$1�$2"; /** * Encode a URL to a percent-encoded form, excluding already-encoded sequences. * * This function will take an already-encoded URL and encode all the non-URL * code points. This function will not encode the "%" character unless it is * not part of a valid sequence (`%20` will be left as-is, but `%foo` will * be encoded as `%25foo`). * * This encode is meant to be "safe" and does not throw errors. It will try as * hard as it can to properly encode the given URL, including replacing any raw, * unpaired surrogate pairs with the Unicode replacement character prior to * encoding. * * @param {string} url * @return {string} * @public */ function encodeUrl$1(url) { return String(url).replace(UNMATCHED_SURROGATE_PAIR_REGEXP$1, UNMATCHED_SURROGATE_PAIR_REPLACE$1).replace(ENCODE_CHARS_REGEXP$1, encodeURI); } }) }); //#endregion //#region node_modules/.pnpm/encodeurl@1.0.2/node_modules/encodeurl/index.js /*! * encodeurl * Copyright(c) 2016 Douglas Christopher Wilson * MIT Licensed */ var require_encodeurl = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/encodeurl@1.0.2/node_modules/encodeurl/index.js": ((exports, module) => { /** * Module exports. * @public */ module.exports = encodeUrl; /** * RegExp to match non-URL code points, *after* encoding (i.e. not including "%") * and including invalid escape sequences. * @private */ var ENCODE_CHARS_REGEXP = /(?:[^\x21\x25\x26-\x3B\x3D\x3F-\x5B\x5D\x5F\x61-\x7A\x7E]|%(?:[^0-9A-Fa-f]|[0-9A-Fa-f][^0-9A-Fa-f]|$))+/g; /** * RegExp to match unmatched surrogate pair. * @private */ var UNMATCHED_SURROGATE_PAIR_REGEXP = /(^|[^\uD800-\uDBFF])[\uDC00-\uDFFF]|[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/g; /** * String to replace unmatched surrogate pair with. * @private */ var UNMATCHED_SURROGATE_PAIR_REPLACE = "$1�$2"; /** * Encode a URL to a percent-encoded form, excluding already-encoded sequences. * * This function will take an already-encoded URL and encode all the non-URL * code points. This function will not encode the "%" character unless it is * not part of a valid sequence (`%20` will be left as-is, but `%foo` will * be encoded as `%25foo`). * * This encode is meant to be "safe" and does not throw errors. It will try as * hard as it can to properly encode the given URL, including replacing any raw, * unpaired surrogate pairs with the Unicode replacement character prior to * encoding. * * @param {string} url * @return {string} * @public */ function encodeUrl(url) { return String(url).replace(UNMATCHED_SURROGATE_PAIR_REGEXP, UNMATCHED_SURROGATE_PAIR_REPLACE).replace(ENCODE_CHARS_REGEXP, encodeURI); } }) }); //#endregion export { require_encodeurl$1 as n, require_encodeurl as t };