@ontos-ai/knowhere-claw 0.1.0-beta.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.
Files changed (80) hide show
  1. package/README.md +163 -0
  2. package/dist/_virtual/_rolldown/runtime.js +37 -0
  3. package/dist/client.d.ts +33 -0
  4. package/dist/client.js +395 -0
  5. package/dist/config.d.ts +6 -0
  6. package/dist/config.js +132 -0
  7. package/dist/error-message.d.ts +1 -0
  8. package/dist/error-message.js +48 -0
  9. package/dist/hooks.d.ts +8 -0
  10. package/dist/hooks.js +415 -0
  11. package/dist/index.d.ts +9 -0
  12. package/dist/index.js +43 -0
  13. package/dist/node_modules/.pnpm/@knowhere-ai_sdk@0.1.1/node_modules/@knowhere-ai/sdk/dist/index.js +717 -0
  14. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/adapters/adapters.js +83 -0
  15. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/adapters/fetch.js +170 -0
  16. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/adapters/xhr.js +106 -0
  17. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/axios.js +57 -0
  18. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/cancel/CancelToken.js +90 -0
  19. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/cancel/CanceledError.js +20 -0
  20. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/cancel/isCancel.js +6 -0
  21. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/Axios.js +174 -0
  22. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/AxiosError.js +70 -0
  23. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/AxiosHeaders.js +204 -0
  24. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/InterceptorManager.js +60 -0
  25. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/buildFullPath.js +20 -0
  26. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/dispatchRequest.js +52 -0
  27. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/mergeConfig.js +81 -0
  28. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/settle.js +18 -0
  29. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/transformData.js +25 -0
  30. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/defaults/index.js +107 -0
  31. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/defaults/transitional.js +9 -0
  32. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/env/data.js +4 -0
  33. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +50 -0
  34. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/HttpStatusCode.js +77 -0
  35. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/bind.js +15 -0
  36. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/buildURL.js +40 -0
  37. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/combineURLs.js +14 -0
  38. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/composeSignals.js +39 -0
  39. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/cookies.js +31 -0
  40. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/formDataToJSON.js +67 -0
  41. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/isAbsoluteURL.js +14 -0
  42. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/isAxiosError.js +14 -0
  43. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/isURLSameOrigin.js +8 -0
  44. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/parseHeaders.js +53 -0
  45. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/parseProtocol.js +7 -0
  46. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/progressEventReducer.js +38 -0
  47. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/resolveConfig.js +36 -0
  48. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/speedometer.js +36 -0
  49. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/spread.js +29 -0
  50. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/throttle.js +38 -0
  51. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/toFormData.js +151 -0
  52. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/toURLEncodedForm.js +18 -0
  53. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/trackStream.js +69 -0
  54. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/validator.js +76 -0
  55. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/browser/classes/Blob.js +4 -0
  56. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/browser/classes/FormData.js +4 -0
  57. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +5 -0
  58. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/browser/index.js +22 -0
  59. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/common/utils.js +46 -0
  60. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/index.js +9 -0
  61. package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/utils.js +698 -0
  62. package/dist/node_modules/.pnpm/fflate@0.8.2/node_modules/fflate/esm/browser.js +426 -0
  63. package/dist/node_modules/.pnpm/jszip@3.10.1/node_modules/jszip/dist/jszip.min.js +3110 -0
  64. package/dist/parser.d.ts +16 -0
  65. package/dist/parser.js +323 -0
  66. package/dist/session.d.ts +11 -0
  67. package/dist/session.js +78 -0
  68. package/dist/store.d.ts +62 -0
  69. package/dist/store.js +482 -0
  70. package/dist/text.d.ts +10 -0
  71. package/dist/text.js +34 -0
  72. package/dist/tools.d.ts +9 -0
  73. package/dist/tools.js +1177 -0
  74. package/dist/tracker-progress.d.ts +8 -0
  75. package/dist/tracker-progress.js +197 -0
  76. package/dist/types.d.ts +247 -0
  77. package/dist/types.js +9 -0
  78. package/openclaw.plugin.json +107 -0
  79. package/package.json +61 -0
  80. package/skills/knowhere/SKILL.md +243 -0
@@ -0,0 +1,83 @@
1
+ import utils_default from "../utils.js";
2
+ import AxiosError from "../core/AxiosError.js";
3
+ import xhr_default from "./xhr.js";
4
+ import { getFetch } from "./fetch.js";
5
+ //#region node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/adapters/adapters.js
6
+ /**
7
+ * Known adapters mapping.
8
+ * Provides environment-specific adapters for Axios:
9
+ * - `http` for Node.js
10
+ * - `xhr` for browsers
11
+ * - `fetch` for fetch API-based requests
12
+ *
13
+ * @type {Object<string, Function|Object>}
14
+ */
15
+ const knownAdapters = {
16
+ http: null,
17
+ xhr: xhr_default,
18
+ fetch: { get: getFetch }
19
+ };
20
+ utils_default.forEach(knownAdapters, (fn, value) => {
21
+ if (fn) {
22
+ try {
23
+ Object.defineProperty(fn, "name", { value });
24
+ } catch (e) {}
25
+ Object.defineProperty(fn, "adapterName", { value });
26
+ }
27
+ });
28
+ /**
29
+ * Render a rejection reason string for unknown or unsupported adapters
30
+ *
31
+ * @param {string} reason
32
+ * @returns {string}
33
+ */
34
+ const renderReason = (reason) => `- ${reason}`;
35
+ /**
36
+ * Check if the adapter is resolved (function, null, or false)
37
+ *
38
+ * @param {Function|null|false} adapter
39
+ * @returns {boolean}
40
+ */
41
+ const isResolvedHandle = (adapter) => utils_default.isFunction(adapter) || adapter === null || adapter === false;
42
+ /**
43
+ * Get the first suitable adapter from the provided list.
44
+ * Tries each adapter in order until a supported one is found.
45
+ * Throws an AxiosError if no adapter is suitable.
46
+ *
47
+ * @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
48
+ * @param {Object} config - Axios request configuration
49
+ * @throws {AxiosError} If no suitable adapter is available
50
+ * @returns {Function} The resolved adapter function
51
+ */
52
+ function getAdapter(adapters, config) {
53
+ adapters = utils_default.isArray(adapters) ? adapters : [adapters];
54
+ const { length } = adapters;
55
+ let nameOrAdapter;
56
+ let adapter;
57
+ const rejectedReasons = {};
58
+ for (let i = 0; i < length; i++) {
59
+ nameOrAdapter = adapters[i];
60
+ let id;
61
+ adapter = nameOrAdapter;
62
+ if (!isResolvedHandle(nameOrAdapter)) {
63
+ adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
64
+ if (adapter === void 0) throw new AxiosError(`Unknown adapter '${id}'`);
65
+ }
66
+ if (adapter && (utils_default.isFunction(adapter) || (adapter = adapter.get(config)))) break;
67
+ rejectedReasons[id || "#" + i] = adapter;
68
+ }
69
+ if (!adapter) {
70
+ const reasons = Object.entries(rejectedReasons).map(([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build"));
71
+ throw new AxiosError(`There is no suitable adapter to dispatch the request ` + (length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified"), "ERR_NOT_SUPPORT");
72
+ }
73
+ return adapter;
74
+ }
75
+ /**
76
+ * Exports Axios adapters and utility to resolve an adapter
77
+ */
78
+ var adapters_default = {
79
+ getAdapter,
80
+ adapters: knownAdapters
81
+ };
82
+ //#endregion
83
+ export { adapters_default as default };
@@ -0,0 +1,170 @@
1
+ import utils_default from "../utils.js";
2
+ import AxiosError from "../core/AxiosError.js";
3
+ import platform_default from "../platform/index.js";
4
+ import AxiosHeaders from "../core/AxiosHeaders.js";
5
+ import settle from "../core/settle.js";
6
+ import { asyncDecorator, progressEventDecorator, progressEventReducer } from "../helpers/progressEventReducer.js";
7
+ import resolveConfig_default from "../helpers/resolveConfig.js";
8
+ import composeSignals from "../helpers/composeSignals.js";
9
+ import { trackStream } from "../helpers/trackStream.js";
10
+ //#region node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/adapters/fetch.js
11
+ const DEFAULT_CHUNK_SIZE = 64 * 1024;
12
+ const { isFunction } = utils_default;
13
+ const globalFetchAPI = (({ Request, Response }) => ({
14
+ Request,
15
+ Response
16
+ }))(utils_default.global);
17
+ const { ReadableStream, TextEncoder } = utils_default.global;
18
+ const test = (fn, ...args) => {
19
+ try {
20
+ return !!fn(...args);
21
+ } catch (e) {
22
+ return false;
23
+ }
24
+ };
25
+ const factory = (env) => {
26
+ env = utils_default.merge.call({ skipUndefined: true }, globalFetchAPI, env);
27
+ const { fetch: envFetch, Request, Response } = env;
28
+ const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === "function";
29
+ const isRequestSupported = isFunction(Request);
30
+ const isResponseSupported = isFunction(Response);
31
+ if (!isFetchSupported) return false;
32
+ const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream);
33
+ const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
34
+ const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
35
+ let duplexAccessed = false;
36
+ const hasContentType = new Request(platform_default.origin, {
37
+ body: new ReadableStream(),
38
+ method: "POST",
39
+ get duplex() {
40
+ duplexAccessed = true;
41
+ return "half";
42
+ }
43
+ }).headers.has("Content-Type");
44
+ return duplexAccessed && !hasContentType;
45
+ });
46
+ const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils_default.isReadableStream(new Response("").body));
47
+ const resolvers = { stream: supportsResponseStream && ((res) => res.body) };
48
+ isFetchSupported && [
49
+ "text",
50
+ "arrayBuffer",
51
+ "blob",
52
+ "formData",
53
+ "stream"
54
+ ].forEach((type) => {
55
+ !resolvers[type] && (resolvers[type] = (res, config) => {
56
+ let method = res && res[type];
57
+ if (method) return method.call(res);
58
+ throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
59
+ });
60
+ });
61
+ const getBodyLength = async (body) => {
62
+ if (body == null) return 0;
63
+ if (utils_default.isBlob(body)) return body.size;
64
+ if (utils_default.isSpecCompliantForm(body)) return (await new Request(platform_default.origin, {
65
+ method: "POST",
66
+ body
67
+ }).arrayBuffer()).byteLength;
68
+ if (utils_default.isArrayBufferView(body) || utils_default.isArrayBuffer(body)) return body.byteLength;
69
+ if (utils_default.isURLSearchParams(body)) body = body + "";
70
+ if (utils_default.isString(body)) return (await encodeText(body)).byteLength;
71
+ };
72
+ const resolveBodyLength = async (headers, body) => {
73
+ const length = utils_default.toFiniteNumber(headers.getContentLength());
74
+ return length == null ? getBodyLength(body) : length;
75
+ };
76
+ return async (config) => {
77
+ let { url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, withCredentials = "same-origin", fetchOptions } = resolveConfig_default(config);
78
+ let _fetch = envFetch || fetch;
79
+ responseType = responseType ? (responseType + "").toLowerCase() : "text";
80
+ let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
81
+ let request = null;
82
+ const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
83
+ composedSignal.unsubscribe();
84
+ });
85
+ let requestContentLength;
86
+ try {
87
+ if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
88
+ let _request = new Request(url, {
89
+ method: "POST",
90
+ body: data,
91
+ duplex: "half"
92
+ });
93
+ let contentTypeHeader;
94
+ if (utils_default.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) headers.setContentType(contentTypeHeader);
95
+ if (_request.body) {
96
+ const [onProgress, flush] = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress)));
97
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
98
+ }
99
+ }
100
+ if (!utils_default.isString(withCredentials)) withCredentials = withCredentials ? "include" : "omit";
101
+ const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
102
+ const resolvedOptions = {
103
+ ...fetchOptions,
104
+ signal: composedSignal,
105
+ method: method.toUpperCase(),
106
+ headers: headers.normalize().toJSON(),
107
+ body: data,
108
+ duplex: "half",
109
+ credentials: isCredentialsSupported ? withCredentials : void 0
110
+ };
111
+ request = isRequestSupported && new Request(url, resolvedOptions);
112
+ let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
113
+ const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
114
+ if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
115
+ const options = {};
116
+ [
117
+ "status",
118
+ "statusText",
119
+ "headers"
120
+ ].forEach((prop) => {
121
+ options[prop] = response[prop];
122
+ });
123
+ const responseContentLength = utils_default.toFiniteNumber(response.headers.get("content-length"));
124
+ const [onProgress, flush] = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [];
125
+ response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
126
+ flush && flush();
127
+ unsubscribe && unsubscribe();
128
+ }), options);
129
+ }
130
+ responseType = responseType || "text";
131
+ let responseData = await resolvers[utils_default.findKey(resolvers, responseType) || "text"](response, config);
132
+ !isStreamResponse && unsubscribe && unsubscribe();
133
+ return await new Promise((resolve, reject) => {
134
+ settle(resolve, reject, {
135
+ data: responseData,
136
+ headers: AxiosHeaders.from(response.headers),
137
+ status: response.status,
138
+ statusText: response.statusText,
139
+ config,
140
+ request
141
+ });
142
+ });
143
+ } catch (err) {
144
+ unsubscribe && unsubscribe();
145
+ if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) throw Object.assign(new AxiosError("Network Error", AxiosError.ERR_NETWORK, config, request, err && err.response), { cause: err.cause || err });
146
+ throw AxiosError.from(err, err && err.code, config, request, err && err.response);
147
+ }
148
+ };
149
+ };
150
+ const seedCache = /* @__PURE__ */ new Map();
151
+ const getFetch = (config) => {
152
+ let env = config && config.env || {};
153
+ const { fetch, Request, Response } = env;
154
+ const seeds = [
155
+ Request,
156
+ Response,
157
+ fetch
158
+ ];
159
+ let i = seeds.length, seed, target, map = seedCache;
160
+ while (i--) {
161
+ seed = seeds[i];
162
+ target = map.get(seed);
163
+ target === void 0 && map.set(seed, target = i ? /* @__PURE__ */ new Map() : factory(env));
164
+ map = target;
165
+ }
166
+ return target;
167
+ };
168
+ getFetch();
169
+ //#endregion
170
+ export { getFetch };
@@ -0,0 +1,106 @@
1
+ import utils_default from "../utils.js";
2
+ import AxiosError from "../core/AxiosError.js";
3
+ import transitional_default from "../defaults/transitional.js";
4
+ import platform_default from "../platform/index.js";
5
+ import AxiosHeaders from "../core/AxiosHeaders.js";
6
+ import CanceledError from "../cancel/CanceledError.js";
7
+ import settle from "../core/settle.js";
8
+ import parseProtocol from "../helpers/parseProtocol.js";
9
+ import { progressEventReducer } from "../helpers/progressEventReducer.js";
10
+ import resolveConfig_default from "../helpers/resolveConfig.js";
11
+ var xhr_default = typeof XMLHttpRequest !== "undefined" && function(config) {
12
+ return new Promise(function dispatchXhrRequest(resolve, reject) {
13
+ const _config = resolveConfig_default(config);
14
+ let requestData = _config.data;
15
+ const requestHeaders = AxiosHeaders.from(_config.headers).normalize();
16
+ let { responseType, onUploadProgress, onDownloadProgress } = _config;
17
+ let onCanceled;
18
+ let uploadThrottled, downloadThrottled;
19
+ let flushUpload, flushDownload;
20
+ function done() {
21
+ flushUpload && flushUpload();
22
+ flushDownload && flushDownload();
23
+ _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
24
+ _config.signal && _config.signal.removeEventListener("abort", onCanceled);
25
+ }
26
+ let request = new XMLHttpRequest();
27
+ request.open(_config.method.toUpperCase(), _config.url, true);
28
+ request.timeout = _config.timeout;
29
+ function onloadend() {
30
+ if (!request) return;
31
+ const responseHeaders = AxiosHeaders.from("getAllResponseHeaders" in request && request.getAllResponseHeaders());
32
+ settle(function _resolve(value) {
33
+ resolve(value);
34
+ done();
35
+ }, function _reject(err) {
36
+ reject(err);
37
+ done();
38
+ }, {
39
+ data: !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response,
40
+ status: request.status,
41
+ statusText: request.statusText,
42
+ headers: responseHeaders,
43
+ config,
44
+ request
45
+ });
46
+ request = null;
47
+ }
48
+ if ("onloadend" in request) request.onloadend = onloadend;
49
+ else request.onreadystatechange = function handleLoad() {
50
+ if (!request || request.readyState !== 4) return;
51
+ if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) return;
52
+ setTimeout(onloadend);
53
+ };
54
+ request.onabort = function handleAbort() {
55
+ if (!request) return;
56
+ reject(new AxiosError("Request aborted", AxiosError.ECONNABORTED, config, request));
57
+ request = null;
58
+ };
59
+ request.onerror = function handleError(event) {
60
+ const err = new AxiosError(event && event.message ? event.message : "Network Error", AxiosError.ERR_NETWORK, config, request);
61
+ err.event = event || null;
62
+ reject(err);
63
+ request = null;
64
+ };
65
+ request.ontimeout = function handleTimeout() {
66
+ let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
67
+ const transitional = _config.transitional || transitional_default;
68
+ if (_config.timeoutErrorMessage) timeoutErrorMessage = _config.timeoutErrorMessage;
69
+ reject(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config, request));
70
+ request = null;
71
+ };
72
+ requestData === void 0 && requestHeaders.setContentType(null);
73
+ if ("setRequestHeader" in request) utils_default.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
74
+ request.setRequestHeader(key, val);
75
+ });
76
+ if (!utils_default.isUndefined(_config.withCredentials)) request.withCredentials = !!_config.withCredentials;
77
+ if (responseType && responseType !== "json") request.responseType = _config.responseType;
78
+ if (onDownloadProgress) {
79
+ [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
80
+ request.addEventListener("progress", downloadThrottled);
81
+ }
82
+ if (onUploadProgress && request.upload) {
83
+ [uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
84
+ request.upload.addEventListener("progress", uploadThrottled);
85
+ request.upload.addEventListener("loadend", flushUpload);
86
+ }
87
+ if (_config.cancelToken || _config.signal) {
88
+ onCanceled = (cancel) => {
89
+ if (!request) return;
90
+ reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
91
+ request.abort();
92
+ request = null;
93
+ };
94
+ _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
95
+ if (_config.signal) _config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
96
+ }
97
+ const protocol = parseProtocol(_config.url);
98
+ if (protocol && platform_default.protocols.indexOf(protocol) === -1) {
99
+ reject(new AxiosError("Unsupported protocol " + protocol + ":", AxiosError.ERR_BAD_REQUEST, config));
100
+ return;
101
+ }
102
+ request.send(requestData || null);
103
+ });
104
+ };
105
+ //#endregion
106
+ export { xhr_default as default };
@@ -0,0 +1,57 @@
1
+ import bind from "./helpers/bind.js";
2
+ import utils_default from "./utils.js";
3
+ import AxiosError from "./core/AxiosError.js";
4
+ import toFormData from "./helpers/toFormData.js";
5
+ import formDataToJSON from "./helpers/formDataToJSON.js";
6
+ import defaults from "./defaults/index.js";
7
+ import AxiosHeaders from "./core/AxiosHeaders.js";
8
+ import isCancel from "./cancel/isCancel.js";
9
+ import CanceledError from "./cancel/CanceledError.js";
10
+ import mergeConfig from "./core/mergeConfig.js";
11
+ import adapters_default from "./adapters/adapters.js";
12
+ import { VERSION } from "./env/data.js";
13
+ import Axios from "./core/Axios.js";
14
+ import CancelToken from "./cancel/CancelToken.js";
15
+ import spread from "./helpers/spread.js";
16
+ import isAxiosError from "./helpers/isAxiosError.js";
17
+ import HttpStatusCode from "./helpers/HttpStatusCode.js";
18
+ //#region node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/axios.js
19
+ /**
20
+ * Create an instance of Axios
21
+ *
22
+ * @param {Object} defaultConfig The default config for the instance
23
+ *
24
+ * @returns {Axios} A new instance of Axios
25
+ */
26
+ function createInstance(defaultConfig) {
27
+ const context = new Axios(defaultConfig);
28
+ const instance = bind(Axios.prototype.request, context);
29
+ utils_default.extend(instance, Axios.prototype, context, { allOwnKeys: true });
30
+ utils_default.extend(instance, context, null, { allOwnKeys: true });
31
+ instance.create = function create(instanceConfig) {
32
+ return createInstance(mergeConfig(defaultConfig, instanceConfig));
33
+ };
34
+ return instance;
35
+ }
36
+ const axios = createInstance(defaults);
37
+ axios.Axios = Axios;
38
+ axios.CanceledError = CanceledError;
39
+ axios.CancelToken = CancelToken;
40
+ axios.isCancel = isCancel;
41
+ axios.VERSION = VERSION;
42
+ axios.toFormData = toFormData;
43
+ axios.AxiosError = AxiosError;
44
+ axios.Cancel = axios.CanceledError;
45
+ axios.all = function all(promises) {
46
+ return Promise.all(promises);
47
+ };
48
+ axios.spread = spread;
49
+ axios.isAxiosError = isAxiosError;
50
+ axios.mergeConfig = mergeConfig;
51
+ axios.AxiosHeaders = AxiosHeaders;
52
+ axios.formToJSON = (thing) => formDataToJSON(utils_default.isHTMLForm(thing) ? new FormData(thing) : thing);
53
+ axios.getAdapter = adapters_default.getAdapter;
54
+ axios.HttpStatusCode = HttpStatusCode;
55
+ axios.default = axios;
56
+ //#endregion
57
+ export { axios as default };
@@ -0,0 +1,90 @@
1
+ import CanceledError from "./CanceledError.js";
2
+ //#region node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/cancel/CancelToken.js
3
+ /**
4
+ * A `CancelToken` is an object that can be used to request cancellation of an operation.
5
+ *
6
+ * @param {Function} executor The executor function.
7
+ *
8
+ * @returns {CancelToken}
9
+ */
10
+ var CancelToken = class CancelToken {
11
+ constructor(executor) {
12
+ if (typeof executor !== "function") throw new TypeError("executor must be a function.");
13
+ let resolvePromise;
14
+ this.promise = new Promise(function promiseExecutor(resolve) {
15
+ resolvePromise = resolve;
16
+ });
17
+ const token = this;
18
+ this.promise.then((cancel) => {
19
+ if (!token._listeners) return;
20
+ let i = token._listeners.length;
21
+ while (i-- > 0) token._listeners[i](cancel);
22
+ token._listeners = null;
23
+ });
24
+ this.promise.then = (onfulfilled) => {
25
+ let _resolve;
26
+ const promise = new Promise((resolve) => {
27
+ token.subscribe(resolve);
28
+ _resolve = resolve;
29
+ }).then(onfulfilled);
30
+ promise.cancel = function reject() {
31
+ token.unsubscribe(_resolve);
32
+ };
33
+ return promise;
34
+ };
35
+ executor(function cancel(message, config, request) {
36
+ if (token.reason) return;
37
+ token.reason = new CanceledError(message, config, request);
38
+ resolvePromise(token.reason);
39
+ });
40
+ }
41
+ /**
42
+ * Throws a `CanceledError` if cancellation has been requested.
43
+ */
44
+ throwIfRequested() {
45
+ if (this.reason) throw this.reason;
46
+ }
47
+ /**
48
+ * Subscribe to the cancel signal
49
+ */
50
+ subscribe(listener) {
51
+ if (this.reason) {
52
+ listener(this.reason);
53
+ return;
54
+ }
55
+ if (this._listeners) this._listeners.push(listener);
56
+ else this._listeners = [listener];
57
+ }
58
+ /**
59
+ * Unsubscribe from the cancel signal
60
+ */
61
+ unsubscribe(listener) {
62
+ if (!this._listeners) return;
63
+ const index = this._listeners.indexOf(listener);
64
+ if (index !== -1) this._listeners.splice(index, 1);
65
+ }
66
+ toAbortSignal() {
67
+ const controller = new AbortController();
68
+ const abort = (err) => {
69
+ controller.abort(err);
70
+ };
71
+ this.subscribe(abort);
72
+ controller.signal.unsubscribe = () => this.unsubscribe(abort);
73
+ return controller.signal;
74
+ }
75
+ /**
76
+ * Returns an object that contains a new `CancelToken` and a function that, when called,
77
+ * cancels the `CancelToken`.
78
+ */
79
+ static source() {
80
+ let cancel;
81
+ return {
82
+ token: new CancelToken(function executor(c) {
83
+ cancel = c;
84
+ }),
85
+ cancel
86
+ };
87
+ }
88
+ };
89
+ //#endregion
90
+ export { CancelToken as default };
@@ -0,0 +1,20 @@
1
+ import AxiosError from "../core/AxiosError.js";
2
+ //#region node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/cancel/CanceledError.js
3
+ var CanceledError = class extends AxiosError {
4
+ /**
5
+ * A `CanceledError` is an object that is thrown when an operation is canceled.
6
+ *
7
+ * @param {string=} message The message.
8
+ * @param {Object=} config The config.
9
+ * @param {Object=} request The request.
10
+ *
11
+ * @returns {CanceledError} The created error.
12
+ */
13
+ constructor(message, config, request) {
14
+ super(message == null ? "canceled" : message, AxiosError.ERR_CANCELED, config, request);
15
+ this.name = "CanceledError";
16
+ this.__CANCEL__ = true;
17
+ }
18
+ };
19
+ //#endregion
20
+ export { CanceledError as default };
@@ -0,0 +1,6 @@
1
+ //#region node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/cancel/isCancel.js
2
+ function isCancel(value) {
3
+ return !!(value && value.__CANCEL__);
4
+ }
5
+ //#endregion
6
+ export { isCancel as default };