@viasoftbr/shared-ui 0.0.3 → 0.0.4

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/dist/hooks.cjs ADDED
@@ -0,0 +1,3182 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __export = (target, all3) => {
10
+ for (var name in all3)
11
+ __defProp(target, name, { get: all3[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var __publicField = (obj, key, value) => {
31
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
32
+ return value;
33
+ };
34
+
35
+ // src/hooks/index.tsx
36
+ var hooks_exports = {};
37
+ __export(hooks_exports, {
38
+ useApi: () => useApi,
39
+ useAvailableSubservices: () => useAvailableSubservices,
40
+ useSettings: () => useSettings
41
+ });
42
+ module.exports = __toCommonJS(hooks_exports);
43
+
44
+ // src/hooks/useSettings.ts
45
+ var import_react = require("react");
46
+ var import_react_query = require("@tanstack/react-query");
47
+
48
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/helpers/bind.js
49
+ function bind(fn, thisArg) {
50
+ return function wrap() {
51
+ return fn.apply(thisArg, arguments);
52
+ };
53
+ }
54
+
55
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/utils.js
56
+ var { toString } = Object.prototype;
57
+ var { getPrototypeOf } = Object;
58
+ var { iterator, toStringTag } = Symbol;
59
+ var kindOf = /* @__PURE__ */ ((cache) => (thing) => {
60
+ const str = toString.call(thing);
61
+ return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
62
+ })(/* @__PURE__ */ Object.create(null));
63
+ var kindOfTest = (type) => {
64
+ type = type.toLowerCase();
65
+ return (thing) => kindOf(thing) === type;
66
+ };
67
+ var typeOfTest = (type) => (thing) => typeof thing === type;
68
+ var { isArray } = Array;
69
+ var isUndefined = typeOfTest("undefined");
70
+ function isBuffer(val) {
71
+ return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
72
+ }
73
+ var isArrayBuffer = kindOfTest("ArrayBuffer");
74
+ function isArrayBufferView(val) {
75
+ let result;
76
+ if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
77
+ result = ArrayBuffer.isView(val);
78
+ } else {
79
+ result = val && val.buffer && isArrayBuffer(val.buffer);
80
+ }
81
+ return result;
82
+ }
83
+ var isString = typeOfTest("string");
84
+ var isFunction = typeOfTest("function");
85
+ var isNumber = typeOfTest("number");
86
+ var isObject = (thing) => thing !== null && typeof thing === "object";
87
+ var isBoolean = (thing) => thing === true || thing === false;
88
+ var isPlainObject = (val) => {
89
+ if (kindOf(val) !== "object") {
90
+ return false;
91
+ }
92
+ const prototype2 = getPrototypeOf(val);
93
+ return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(toStringTag in val) && !(iterator in val);
94
+ };
95
+ var isEmptyObject = (val) => {
96
+ if (!isObject(val) || isBuffer(val)) {
97
+ return false;
98
+ }
99
+ try {
100
+ return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
101
+ } catch (e) {
102
+ return false;
103
+ }
104
+ };
105
+ var isDate = kindOfTest("Date");
106
+ var isFile = kindOfTest("File");
107
+ var isBlob = kindOfTest("Blob");
108
+ var isFileList = kindOfTest("FileList");
109
+ var isStream = (val) => isObject(val) && isFunction(val.pipe);
110
+ var isFormData = (thing) => {
111
+ let kind;
112
+ return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
113
+ kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]"));
114
+ };
115
+ var isURLSearchParams = kindOfTest("URLSearchParams");
116
+ var [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest);
117
+ var trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
118
+ function forEach(obj, fn, { allOwnKeys = false } = {}) {
119
+ if (obj === null || typeof obj === "undefined") {
120
+ return;
121
+ }
122
+ let i;
123
+ let l;
124
+ if (typeof obj !== "object") {
125
+ obj = [obj];
126
+ }
127
+ if (isArray(obj)) {
128
+ for (i = 0, l = obj.length; i < l; i++) {
129
+ fn.call(null, obj[i], i, obj);
130
+ }
131
+ } else {
132
+ if (isBuffer(obj)) {
133
+ return;
134
+ }
135
+ const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
136
+ const len = keys.length;
137
+ let key;
138
+ for (i = 0; i < len; i++) {
139
+ key = keys[i];
140
+ fn.call(null, obj[key], key, obj);
141
+ }
142
+ }
143
+ }
144
+ function findKey(obj, key) {
145
+ if (isBuffer(obj)) {
146
+ return null;
147
+ }
148
+ key = key.toLowerCase();
149
+ const keys = Object.keys(obj);
150
+ let i = keys.length;
151
+ let _key;
152
+ while (i-- > 0) {
153
+ _key = keys[i];
154
+ if (key === _key.toLowerCase()) {
155
+ return _key;
156
+ }
157
+ }
158
+ return null;
159
+ }
160
+ var _global = (() => {
161
+ if (typeof globalThis !== "undefined")
162
+ return globalThis;
163
+ return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
164
+ })();
165
+ var isContextDefined = (context) => !isUndefined(context) && context !== _global;
166
+ function merge() {
167
+ const { caseless, skipUndefined } = isContextDefined(this) && this || {};
168
+ const result = {};
169
+ const assignValue = (val, key) => {
170
+ const targetKey = caseless && findKey(result, key) || key;
171
+ if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
172
+ result[targetKey] = merge(result[targetKey], val);
173
+ } else if (isPlainObject(val)) {
174
+ result[targetKey] = merge({}, val);
175
+ } else if (isArray(val)) {
176
+ result[targetKey] = val.slice();
177
+ } else if (!skipUndefined || !isUndefined(val)) {
178
+ result[targetKey] = val;
179
+ }
180
+ };
181
+ for (let i = 0, l = arguments.length; i < l; i++) {
182
+ arguments[i] && forEach(arguments[i], assignValue);
183
+ }
184
+ return result;
185
+ }
186
+ var extend = (a, b, thisArg, { allOwnKeys } = {}) => {
187
+ forEach(b, (val, key) => {
188
+ if (thisArg && isFunction(val)) {
189
+ Object.defineProperty(a, key, {
190
+ value: bind(val, thisArg),
191
+ writable: true,
192
+ enumerable: true,
193
+ configurable: true
194
+ });
195
+ } else {
196
+ Object.defineProperty(a, key, {
197
+ value: val,
198
+ writable: true,
199
+ enumerable: true,
200
+ configurable: true
201
+ });
202
+ }
203
+ }, { allOwnKeys });
204
+ return a;
205
+ };
206
+ var stripBOM = (content) => {
207
+ if (content.charCodeAt(0) === 65279) {
208
+ content = content.slice(1);
209
+ }
210
+ return content;
211
+ };
212
+ var inherits = (constructor, superConstructor, props, descriptors) => {
213
+ constructor.prototype = Object.create(superConstructor.prototype, descriptors);
214
+ Object.defineProperty(constructor.prototype, "constructor", {
215
+ value: constructor,
216
+ writable: true,
217
+ enumerable: false,
218
+ configurable: true
219
+ });
220
+ Object.defineProperty(constructor, "super", {
221
+ value: superConstructor.prototype
222
+ });
223
+ props && Object.assign(constructor.prototype, props);
224
+ };
225
+ var toFlatObject = (sourceObj, destObj, filter2, propFilter) => {
226
+ let props;
227
+ let i;
228
+ let prop;
229
+ const merged = {};
230
+ destObj = destObj || {};
231
+ if (sourceObj == null)
232
+ return destObj;
233
+ do {
234
+ props = Object.getOwnPropertyNames(sourceObj);
235
+ i = props.length;
236
+ while (i-- > 0) {
237
+ prop = props[i];
238
+ if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
239
+ destObj[prop] = sourceObj[prop];
240
+ merged[prop] = true;
241
+ }
242
+ }
243
+ sourceObj = filter2 !== false && getPrototypeOf(sourceObj);
244
+ } while (sourceObj && (!filter2 || filter2(sourceObj, destObj)) && sourceObj !== Object.prototype);
245
+ return destObj;
246
+ };
247
+ var endsWith = (str, searchString, position) => {
248
+ str = String(str);
249
+ if (position === void 0 || position > str.length) {
250
+ position = str.length;
251
+ }
252
+ position -= searchString.length;
253
+ const lastIndex = str.indexOf(searchString, position);
254
+ return lastIndex !== -1 && lastIndex === position;
255
+ };
256
+ var toArray = (thing) => {
257
+ if (!thing)
258
+ return null;
259
+ if (isArray(thing))
260
+ return thing;
261
+ let i = thing.length;
262
+ if (!isNumber(i))
263
+ return null;
264
+ const arr = new Array(i);
265
+ while (i-- > 0) {
266
+ arr[i] = thing[i];
267
+ }
268
+ return arr;
269
+ };
270
+ var isTypedArray = /* @__PURE__ */ ((TypedArray) => {
271
+ return (thing) => {
272
+ return TypedArray && thing instanceof TypedArray;
273
+ };
274
+ })(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
275
+ var forEachEntry = (obj, fn) => {
276
+ const generator = obj && obj[iterator];
277
+ const _iterator = generator.call(obj);
278
+ let result;
279
+ while ((result = _iterator.next()) && !result.done) {
280
+ const pair = result.value;
281
+ fn.call(obj, pair[0], pair[1]);
282
+ }
283
+ };
284
+ var matchAll = (regExp, str) => {
285
+ let matches;
286
+ const arr = [];
287
+ while ((matches = regExp.exec(str)) !== null) {
288
+ arr.push(matches);
289
+ }
290
+ return arr;
291
+ };
292
+ var isHTMLForm = kindOfTest("HTMLFormElement");
293
+ var toCamelCase = (str) => {
294
+ return str.toLowerCase().replace(
295
+ /[-_\s]([a-z\d])(\w*)/g,
296
+ function replacer(m, p1, p2) {
297
+ return p1.toUpperCase() + p2;
298
+ }
299
+ );
300
+ };
301
+ var hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
302
+ var isRegExp = kindOfTest("RegExp");
303
+ var reduceDescriptors = (obj, reducer) => {
304
+ const descriptors = Object.getOwnPropertyDescriptors(obj);
305
+ const reducedDescriptors = {};
306
+ forEach(descriptors, (descriptor, name) => {
307
+ let ret;
308
+ if ((ret = reducer(descriptor, name, obj)) !== false) {
309
+ reducedDescriptors[name] = ret || descriptor;
310
+ }
311
+ });
312
+ Object.defineProperties(obj, reducedDescriptors);
313
+ };
314
+ var freezeMethods = (obj) => {
315
+ reduceDescriptors(obj, (descriptor, name) => {
316
+ if (isFunction(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
317
+ return false;
318
+ }
319
+ const value = obj[name];
320
+ if (!isFunction(value))
321
+ return;
322
+ descriptor.enumerable = false;
323
+ if ("writable" in descriptor) {
324
+ descriptor.writable = false;
325
+ return;
326
+ }
327
+ if (!descriptor.set) {
328
+ descriptor.set = () => {
329
+ throw Error("Can not rewrite read-only method '" + name + "'");
330
+ };
331
+ }
332
+ });
333
+ };
334
+ var toObjectSet = (arrayOrString, delimiter) => {
335
+ const obj = {};
336
+ const define = (arr) => {
337
+ arr.forEach((value) => {
338
+ obj[value] = true;
339
+ });
340
+ };
341
+ isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
342
+ return obj;
343
+ };
344
+ var noop = () => {
345
+ };
346
+ var toFiniteNumber = (value, defaultValue) => {
347
+ return value != null && Number.isFinite(value = +value) ? value : defaultValue;
348
+ };
349
+ function isSpecCompliantForm(thing) {
350
+ return !!(thing && isFunction(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
351
+ }
352
+ var toJSONObject = (obj) => {
353
+ const stack = new Array(10);
354
+ const visit = (source, i) => {
355
+ if (isObject(source)) {
356
+ if (stack.indexOf(source) >= 0) {
357
+ return;
358
+ }
359
+ if (isBuffer(source)) {
360
+ return source;
361
+ }
362
+ if (!("toJSON" in source)) {
363
+ stack[i] = source;
364
+ const target = isArray(source) ? [] : {};
365
+ forEach(source, (value, key) => {
366
+ const reducedValue = visit(value, i + 1);
367
+ !isUndefined(reducedValue) && (target[key] = reducedValue);
368
+ });
369
+ stack[i] = void 0;
370
+ return target;
371
+ }
372
+ }
373
+ return source;
374
+ };
375
+ return visit(obj, 0);
376
+ };
377
+ var isAsyncFn = kindOfTest("AsyncFunction");
378
+ var isThenable = (thing) => thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
379
+ var _setImmediate = ((setImmediateSupported, postMessageSupported) => {
380
+ if (setImmediateSupported) {
381
+ return setImmediate;
382
+ }
383
+ return postMessageSupported ? ((token, callbacks) => {
384
+ _global.addEventListener("message", ({ source, data }) => {
385
+ if (source === _global && data === token) {
386
+ callbacks.length && callbacks.shift()();
387
+ }
388
+ }, false);
389
+ return (cb) => {
390
+ callbacks.push(cb);
391
+ _global.postMessage(token, "*");
392
+ };
393
+ })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
394
+ })(
395
+ typeof setImmediate === "function",
396
+ isFunction(_global.postMessage)
397
+ );
398
+ var asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
399
+ var isIterable = (thing) => thing != null && isFunction(thing[iterator]);
400
+ var utils_default = {
401
+ isArray,
402
+ isArrayBuffer,
403
+ isBuffer,
404
+ isFormData,
405
+ isArrayBufferView,
406
+ isString,
407
+ isNumber,
408
+ isBoolean,
409
+ isObject,
410
+ isPlainObject,
411
+ isEmptyObject,
412
+ isReadableStream,
413
+ isRequest,
414
+ isResponse,
415
+ isHeaders,
416
+ isUndefined,
417
+ isDate,
418
+ isFile,
419
+ isBlob,
420
+ isRegExp,
421
+ isFunction,
422
+ isStream,
423
+ isURLSearchParams,
424
+ isTypedArray,
425
+ isFileList,
426
+ forEach,
427
+ merge,
428
+ extend,
429
+ trim,
430
+ stripBOM,
431
+ inherits,
432
+ toFlatObject,
433
+ kindOf,
434
+ kindOfTest,
435
+ endsWith,
436
+ toArray,
437
+ forEachEntry,
438
+ matchAll,
439
+ isHTMLForm,
440
+ hasOwnProperty,
441
+ hasOwnProp: hasOwnProperty,
442
+ // an alias to avoid ESLint no-prototype-builtins detection
443
+ reduceDescriptors,
444
+ freezeMethods,
445
+ toObjectSet,
446
+ toCamelCase,
447
+ noop,
448
+ toFiniteNumber,
449
+ findKey,
450
+ global: _global,
451
+ isContextDefined,
452
+ isSpecCompliantForm,
453
+ toJSONObject,
454
+ isAsyncFn,
455
+ isThenable,
456
+ setImmediate: _setImmediate,
457
+ asap,
458
+ isIterable
459
+ };
460
+
461
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/core/AxiosError.js
462
+ var AxiosError = class _AxiosError extends Error {
463
+ static from(error, code, config, request, response, customProps) {
464
+ const axiosError = new _AxiosError(error.message, code || error.code, config, request, response);
465
+ axiosError.cause = error;
466
+ axiosError.name = error.name;
467
+ customProps && Object.assign(axiosError, customProps);
468
+ return axiosError;
469
+ }
470
+ /**
471
+ * Create an Error with the specified message, config, error code, request and response.
472
+ *
473
+ * @param {string} message The error message.
474
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
475
+ * @param {Object} [config] The config.
476
+ * @param {Object} [request] The request.
477
+ * @param {Object} [response] The response.
478
+ *
479
+ * @returns {Error} The created error.
480
+ */
481
+ constructor(message, code, config, request, response) {
482
+ super(message);
483
+ this.name = "AxiosError";
484
+ this.isAxiosError = true;
485
+ code && (this.code = code);
486
+ config && (this.config = config);
487
+ request && (this.request = request);
488
+ if (response) {
489
+ this.response = response;
490
+ this.status = response.status;
491
+ }
492
+ }
493
+ toJSON() {
494
+ return {
495
+ // Standard
496
+ message: this.message,
497
+ name: this.name,
498
+ // Microsoft
499
+ description: this.description,
500
+ number: this.number,
501
+ // Mozilla
502
+ fileName: this.fileName,
503
+ lineNumber: this.lineNumber,
504
+ columnNumber: this.columnNumber,
505
+ stack: this.stack,
506
+ // Axios
507
+ config: utils_default.toJSONObject(this.config),
508
+ code: this.code,
509
+ status: this.status
510
+ };
511
+ }
512
+ };
513
+ AxiosError.ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE";
514
+ AxiosError.ERR_BAD_OPTION = "ERR_BAD_OPTION";
515
+ AxiosError.ECONNABORTED = "ECONNABORTED";
516
+ AxiosError.ETIMEDOUT = "ETIMEDOUT";
517
+ AxiosError.ERR_NETWORK = "ERR_NETWORK";
518
+ AxiosError.ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS";
519
+ AxiosError.ERR_DEPRECATED = "ERR_DEPRECATED";
520
+ AxiosError.ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE";
521
+ AxiosError.ERR_BAD_REQUEST = "ERR_BAD_REQUEST";
522
+ AxiosError.ERR_CANCELED = "ERR_CANCELED";
523
+ AxiosError.ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";
524
+ AxiosError.ERR_INVALID_URL = "ERR_INVALID_URL";
525
+ var AxiosError_default = AxiosError;
526
+
527
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/helpers/null.js
528
+ var null_default = null;
529
+
530
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/helpers/toFormData.js
531
+ function isVisitable(thing) {
532
+ return utils_default.isPlainObject(thing) || utils_default.isArray(thing);
533
+ }
534
+ function removeBrackets(key) {
535
+ return utils_default.endsWith(key, "[]") ? key.slice(0, -2) : key;
536
+ }
537
+ function renderKey(path, key, dots) {
538
+ if (!path)
539
+ return key;
540
+ return path.concat(key).map(function each(token, i) {
541
+ token = removeBrackets(token);
542
+ return !dots && i ? "[" + token + "]" : token;
543
+ }).join(dots ? "." : "");
544
+ }
545
+ function isFlatArray(arr) {
546
+ return utils_default.isArray(arr) && !arr.some(isVisitable);
547
+ }
548
+ var predicates = utils_default.toFlatObject(utils_default, {}, null, function filter(prop) {
549
+ return /^is[A-Z]/.test(prop);
550
+ });
551
+ function toFormData(obj, formData, options) {
552
+ if (!utils_default.isObject(obj)) {
553
+ throw new TypeError("target must be an object");
554
+ }
555
+ formData = formData || new (null_default || FormData)();
556
+ options = utils_default.toFlatObject(options, {
557
+ metaTokens: true,
558
+ dots: false,
559
+ indexes: false
560
+ }, false, function defined(option, source) {
561
+ return !utils_default.isUndefined(source[option]);
562
+ });
563
+ const metaTokens = options.metaTokens;
564
+ const visitor = options.visitor || defaultVisitor;
565
+ const dots = options.dots;
566
+ const indexes = options.indexes;
567
+ const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
568
+ const useBlob = _Blob && utils_default.isSpecCompliantForm(formData);
569
+ if (!utils_default.isFunction(visitor)) {
570
+ throw new TypeError("visitor must be a function");
571
+ }
572
+ function convertValue(value) {
573
+ if (value === null)
574
+ return "";
575
+ if (utils_default.isDate(value)) {
576
+ return value.toISOString();
577
+ }
578
+ if (utils_default.isBoolean(value)) {
579
+ return value.toString();
580
+ }
581
+ if (!useBlob && utils_default.isBlob(value)) {
582
+ throw new AxiosError_default("Blob is not supported. Use a Buffer instead.");
583
+ }
584
+ if (utils_default.isArrayBuffer(value) || utils_default.isTypedArray(value)) {
585
+ return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
586
+ }
587
+ return value;
588
+ }
589
+ function defaultVisitor(value, key, path) {
590
+ let arr = value;
591
+ if (value && !path && typeof value === "object") {
592
+ if (utils_default.endsWith(key, "{}")) {
593
+ key = metaTokens ? key : key.slice(0, -2);
594
+ value = JSON.stringify(value);
595
+ } else if (utils_default.isArray(value) && isFlatArray(value) || (utils_default.isFileList(value) || utils_default.endsWith(key, "[]")) && (arr = utils_default.toArray(value))) {
596
+ key = removeBrackets(key);
597
+ arr.forEach(function each(el, index) {
598
+ !(utils_default.isUndefined(el) || el === null) && formData.append(
599
+ // eslint-disable-next-line no-nested-ternary
600
+ indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]",
601
+ convertValue(el)
602
+ );
603
+ });
604
+ return false;
605
+ }
606
+ }
607
+ if (isVisitable(value)) {
608
+ return true;
609
+ }
610
+ formData.append(renderKey(path, key, dots), convertValue(value));
611
+ return false;
612
+ }
613
+ const stack = [];
614
+ const exposedHelpers = Object.assign(predicates, {
615
+ defaultVisitor,
616
+ convertValue,
617
+ isVisitable
618
+ });
619
+ function build(value, path) {
620
+ if (utils_default.isUndefined(value))
621
+ return;
622
+ if (stack.indexOf(value) !== -1) {
623
+ throw Error("Circular reference detected in " + path.join("."));
624
+ }
625
+ stack.push(value);
626
+ utils_default.forEach(value, function each(el, key) {
627
+ const result = !(utils_default.isUndefined(el) || el === null) && visitor.call(
628
+ formData,
629
+ el,
630
+ utils_default.isString(key) ? key.trim() : key,
631
+ path,
632
+ exposedHelpers
633
+ );
634
+ if (result === true) {
635
+ build(el, path ? path.concat(key) : [key]);
636
+ }
637
+ });
638
+ stack.pop();
639
+ }
640
+ if (!utils_default.isObject(obj)) {
641
+ throw new TypeError("data must be an object");
642
+ }
643
+ build(obj);
644
+ return formData;
645
+ }
646
+ var toFormData_default = toFormData;
647
+
648
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/helpers/AxiosURLSearchParams.js
649
+ function encode(str) {
650
+ const charMap = {
651
+ "!": "%21",
652
+ "'": "%27",
653
+ "(": "%28",
654
+ ")": "%29",
655
+ "~": "%7E",
656
+ "%20": "+",
657
+ "%00": "\0"
658
+ };
659
+ return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
660
+ return charMap[match];
661
+ });
662
+ }
663
+ function AxiosURLSearchParams(params, options) {
664
+ this._pairs = [];
665
+ params && toFormData_default(params, this, options);
666
+ }
667
+ var prototype = AxiosURLSearchParams.prototype;
668
+ prototype.append = function append(name, value) {
669
+ this._pairs.push([name, value]);
670
+ };
671
+ prototype.toString = function toString2(encoder) {
672
+ const _encode = encoder ? function(value) {
673
+ return encoder.call(this, value, encode);
674
+ } : encode;
675
+ return this._pairs.map(function each(pair) {
676
+ return _encode(pair[0]) + "=" + _encode(pair[1]);
677
+ }, "").join("&");
678
+ };
679
+ var AxiosURLSearchParams_default = AxiosURLSearchParams;
680
+
681
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/helpers/buildURL.js
682
+ function encode2(val) {
683
+ return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
684
+ }
685
+ function buildURL(url, params, options) {
686
+ if (!params) {
687
+ return url;
688
+ }
689
+ const _encode = options && options.encode || encode2;
690
+ const _options = utils_default.isFunction(options) ? {
691
+ serialize: options
692
+ } : options;
693
+ const serializeFn = _options && _options.serialize;
694
+ let serializedParams;
695
+ if (serializeFn) {
696
+ serializedParams = serializeFn(params, _options);
697
+ } else {
698
+ serializedParams = utils_default.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams_default(params, _options).toString(_encode);
699
+ }
700
+ if (serializedParams) {
701
+ const hashmarkIndex = url.indexOf("#");
702
+ if (hashmarkIndex !== -1) {
703
+ url = url.slice(0, hashmarkIndex);
704
+ }
705
+ url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
706
+ }
707
+ return url;
708
+ }
709
+
710
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/core/InterceptorManager.js
711
+ var InterceptorManager = class {
712
+ constructor() {
713
+ this.handlers = [];
714
+ }
715
+ /**
716
+ * Add a new interceptor to the stack
717
+ *
718
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
719
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
720
+ * @param {Object} options The options for the interceptor, synchronous and runWhen
721
+ *
722
+ * @return {Number} An ID used to remove interceptor later
723
+ */
724
+ use(fulfilled, rejected, options) {
725
+ this.handlers.push({
726
+ fulfilled,
727
+ rejected,
728
+ synchronous: options ? options.synchronous : false,
729
+ runWhen: options ? options.runWhen : null
730
+ });
731
+ return this.handlers.length - 1;
732
+ }
733
+ /**
734
+ * Remove an interceptor from the stack
735
+ *
736
+ * @param {Number} id The ID that was returned by `use`
737
+ *
738
+ * @returns {void}
739
+ */
740
+ eject(id) {
741
+ if (this.handlers[id]) {
742
+ this.handlers[id] = null;
743
+ }
744
+ }
745
+ /**
746
+ * Clear all interceptors from the stack
747
+ *
748
+ * @returns {void}
749
+ */
750
+ clear() {
751
+ if (this.handlers) {
752
+ this.handlers = [];
753
+ }
754
+ }
755
+ /**
756
+ * Iterate over all the registered interceptors
757
+ *
758
+ * This method is particularly useful for skipping over any
759
+ * interceptors that may have become `null` calling `eject`.
760
+ *
761
+ * @param {Function} fn The function to call for each interceptor
762
+ *
763
+ * @returns {void}
764
+ */
765
+ forEach(fn) {
766
+ utils_default.forEach(this.handlers, function forEachHandler(h) {
767
+ if (h !== null) {
768
+ fn(h);
769
+ }
770
+ });
771
+ }
772
+ };
773
+ var InterceptorManager_default = InterceptorManager;
774
+
775
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/defaults/transitional.js
776
+ var transitional_default = {
777
+ silentJSONParsing: true,
778
+ forcedJSONParsing: true,
779
+ clarifyTimeoutError: false
780
+ };
781
+
782
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js
783
+ var URLSearchParams_default = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams_default;
784
+
785
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/platform/browser/classes/FormData.js
786
+ var FormData_default = typeof FormData !== "undefined" ? FormData : null;
787
+
788
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/platform/browser/classes/Blob.js
789
+ var Blob_default = typeof Blob !== "undefined" ? Blob : null;
790
+
791
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/platform/browser/index.js
792
+ var browser_default = {
793
+ isBrowser: true,
794
+ classes: {
795
+ URLSearchParams: URLSearchParams_default,
796
+ FormData: FormData_default,
797
+ Blob: Blob_default
798
+ },
799
+ protocols: ["http", "https", "file", "blob", "url", "data"]
800
+ };
801
+
802
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/platform/common/utils.js
803
+ var utils_exports = {};
804
+ __export(utils_exports, {
805
+ hasBrowserEnv: () => hasBrowserEnv,
806
+ hasStandardBrowserEnv: () => hasStandardBrowserEnv,
807
+ hasStandardBrowserWebWorkerEnv: () => hasStandardBrowserWebWorkerEnv,
808
+ navigator: () => _navigator,
809
+ origin: () => origin
810
+ });
811
+ var hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
812
+ var _navigator = typeof navigator === "object" && navigator || void 0;
813
+ var hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
814
+ var hasStandardBrowserWebWorkerEnv = (() => {
815
+ return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
816
+ self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
817
+ })();
818
+ var origin = hasBrowserEnv && window.location.href || "http://localhost";
819
+
820
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/platform/index.js
821
+ var platform_default = {
822
+ ...utils_exports,
823
+ ...browser_default
824
+ };
825
+
826
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/helpers/toURLEncodedForm.js
827
+ function toURLEncodedForm(data, options) {
828
+ return toFormData_default(data, new platform_default.classes.URLSearchParams(), {
829
+ visitor: function(value, key, path, helpers) {
830
+ if (platform_default.isNode && utils_default.isBuffer(value)) {
831
+ this.append(key, value.toString("base64"));
832
+ return false;
833
+ }
834
+ return helpers.defaultVisitor.apply(this, arguments);
835
+ },
836
+ ...options
837
+ });
838
+ }
839
+
840
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/helpers/formDataToJSON.js
841
+ function parsePropPath(name) {
842
+ return utils_default.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
843
+ return match[0] === "[]" ? "" : match[1] || match[0];
844
+ });
845
+ }
846
+ function arrayToObject(arr) {
847
+ const obj = {};
848
+ const keys = Object.keys(arr);
849
+ let i;
850
+ const len = keys.length;
851
+ let key;
852
+ for (i = 0; i < len; i++) {
853
+ key = keys[i];
854
+ obj[key] = arr[key];
855
+ }
856
+ return obj;
857
+ }
858
+ function formDataToJSON(formData) {
859
+ function buildPath(path, value, target, index) {
860
+ let name = path[index++];
861
+ if (name === "__proto__")
862
+ return true;
863
+ const isNumericKey = Number.isFinite(+name);
864
+ const isLast = index >= path.length;
865
+ name = !name && utils_default.isArray(target) ? target.length : name;
866
+ if (isLast) {
867
+ if (utils_default.hasOwnProp(target, name)) {
868
+ target[name] = [target[name], value];
869
+ } else {
870
+ target[name] = value;
871
+ }
872
+ return !isNumericKey;
873
+ }
874
+ if (!target[name] || !utils_default.isObject(target[name])) {
875
+ target[name] = [];
876
+ }
877
+ const result = buildPath(path, value, target[name], index);
878
+ if (result && utils_default.isArray(target[name])) {
879
+ target[name] = arrayToObject(target[name]);
880
+ }
881
+ return !isNumericKey;
882
+ }
883
+ if (utils_default.isFormData(formData) && utils_default.isFunction(formData.entries)) {
884
+ const obj = {};
885
+ utils_default.forEachEntry(formData, (name, value) => {
886
+ buildPath(parsePropPath(name), value, obj, 0);
887
+ });
888
+ return obj;
889
+ }
890
+ return null;
891
+ }
892
+ var formDataToJSON_default = formDataToJSON;
893
+
894
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/defaults/index.js
895
+ function stringifySafely(rawValue, parser, encoder) {
896
+ if (utils_default.isString(rawValue)) {
897
+ try {
898
+ (parser || JSON.parse)(rawValue);
899
+ return utils_default.trim(rawValue);
900
+ } catch (e) {
901
+ if (e.name !== "SyntaxError") {
902
+ throw e;
903
+ }
904
+ }
905
+ }
906
+ return (encoder || JSON.stringify)(rawValue);
907
+ }
908
+ var defaults = {
909
+ transitional: transitional_default,
910
+ adapter: ["xhr", "http", "fetch"],
911
+ transformRequest: [function transformRequest(data, headers) {
912
+ const contentType = headers.getContentType() || "";
913
+ const hasJSONContentType = contentType.indexOf("application/json") > -1;
914
+ const isObjectPayload = utils_default.isObject(data);
915
+ if (isObjectPayload && utils_default.isHTMLForm(data)) {
916
+ data = new FormData(data);
917
+ }
918
+ const isFormData2 = utils_default.isFormData(data);
919
+ if (isFormData2) {
920
+ return hasJSONContentType ? JSON.stringify(formDataToJSON_default(data)) : data;
921
+ }
922
+ if (utils_default.isArrayBuffer(data) || utils_default.isBuffer(data) || utils_default.isStream(data) || utils_default.isFile(data) || utils_default.isBlob(data) || utils_default.isReadableStream(data)) {
923
+ return data;
924
+ }
925
+ if (utils_default.isArrayBufferView(data)) {
926
+ return data.buffer;
927
+ }
928
+ if (utils_default.isURLSearchParams(data)) {
929
+ headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
930
+ return data.toString();
931
+ }
932
+ let isFileList2;
933
+ if (isObjectPayload) {
934
+ if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
935
+ return toURLEncodedForm(data, this.formSerializer).toString();
936
+ }
937
+ if ((isFileList2 = utils_default.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
938
+ const _FormData = this.env && this.env.FormData;
939
+ return toFormData_default(
940
+ isFileList2 ? { "files[]": data } : data,
941
+ _FormData && new _FormData(),
942
+ this.formSerializer
943
+ );
944
+ }
945
+ }
946
+ if (isObjectPayload || hasJSONContentType) {
947
+ headers.setContentType("application/json", false);
948
+ return stringifySafely(data);
949
+ }
950
+ return data;
951
+ }],
952
+ transformResponse: [function transformResponse(data) {
953
+ const transitional2 = this.transitional || defaults.transitional;
954
+ const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
955
+ const JSONRequested = this.responseType === "json";
956
+ if (utils_default.isResponse(data) || utils_default.isReadableStream(data)) {
957
+ return data;
958
+ }
959
+ if (data && utils_default.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
960
+ const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
961
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
962
+ try {
963
+ return JSON.parse(data, this.parseReviver);
964
+ } catch (e) {
965
+ if (strictJSONParsing) {
966
+ if (e.name === "SyntaxError") {
967
+ throw AxiosError_default.from(e, AxiosError_default.ERR_BAD_RESPONSE, this, null, this.response);
968
+ }
969
+ throw e;
970
+ }
971
+ }
972
+ }
973
+ return data;
974
+ }],
975
+ /**
976
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
977
+ * timeout is not created.
978
+ */
979
+ timeout: 0,
980
+ xsrfCookieName: "XSRF-TOKEN",
981
+ xsrfHeaderName: "X-XSRF-TOKEN",
982
+ maxContentLength: -1,
983
+ maxBodyLength: -1,
984
+ env: {
985
+ FormData: platform_default.classes.FormData,
986
+ Blob: platform_default.classes.Blob
987
+ },
988
+ validateStatus: function validateStatus(status) {
989
+ return status >= 200 && status < 300;
990
+ },
991
+ headers: {
992
+ common: {
993
+ "Accept": "application/json, text/plain, */*",
994
+ "Content-Type": void 0
995
+ }
996
+ }
997
+ };
998
+ utils_default.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
999
+ defaults.headers[method] = {};
1000
+ });
1001
+ var defaults_default = defaults;
1002
+
1003
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/helpers/parseHeaders.js
1004
+ var ignoreDuplicateOf = utils_default.toObjectSet([
1005
+ "age",
1006
+ "authorization",
1007
+ "content-length",
1008
+ "content-type",
1009
+ "etag",
1010
+ "expires",
1011
+ "from",
1012
+ "host",
1013
+ "if-modified-since",
1014
+ "if-unmodified-since",
1015
+ "last-modified",
1016
+ "location",
1017
+ "max-forwards",
1018
+ "proxy-authorization",
1019
+ "referer",
1020
+ "retry-after",
1021
+ "user-agent"
1022
+ ]);
1023
+ var parseHeaders_default = (rawHeaders) => {
1024
+ const parsed = {};
1025
+ let key;
1026
+ let val;
1027
+ let i;
1028
+ rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
1029
+ i = line.indexOf(":");
1030
+ key = line.substring(0, i).trim().toLowerCase();
1031
+ val = line.substring(i + 1).trim();
1032
+ if (!key || parsed[key] && ignoreDuplicateOf[key]) {
1033
+ return;
1034
+ }
1035
+ if (key === "set-cookie") {
1036
+ if (parsed[key]) {
1037
+ parsed[key].push(val);
1038
+ } else {
1039
+ parsed[key] = [val];
1040
+ }
1041
+ } else {
1042
+ parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
1043
+ }
1044
+ });
1045
+ return parsed;
1046
+ };
1047
+
1048
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/core/AxiosHeaders.js
1049
+ var $internals = Symbol("internals");
1050
+ function normalizeHeader(header) {
1051
+ return header && String(header).trim().toLowerCase();
1052
+ }
1053
+ function normalizeValue(value) {
1054
+ if (value === false || value == null) {
1055
+ return value;
1056
+ }
1057
+ return utils_default.isArray(value) ? value.map(normalizeValue) : String(value);
1058
+ }
1059
+ function parseTokens(str) {
1060
+ const tokens = /* @__PURE__ */ Object.create(null);
1061
+ const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
1062
+ let match;
1063
+ while (match = tokensRE.exec(str)) {
1064
+ tokens[match[1]] = match[2];
1065
+ }
1066
+ return tokens;
1067
+ }
1068
+ var isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
1069
+ function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
1070
+ if (utils_default.isFunction(filter2)) {
1071
+ return filter2.call(this, value, header);
1072
+ }
1073
+ if (isHeaderNameFilter) {
1074
+ value = header;
1075
+ }
1076
+ if (!utils_default.isString(value))
1077
+ return;
1078
+ if (utils_default.isString(filter2)) {
1079
+ return value.indexOf(filter2) !== -1;
1080
+ }
1081
+ if (utils_default.isRegExp(filter2)) {
1082
+ return filter2.test(value);
1083
+ }
1084
+ }
1085
+ function formatHeader(header) {
1086
+ return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
1087
+ return char.toUpperCase() + str;
1088
+ });
1089
+ }
1090
+ function buildAccessors(obj, header) {
1091
+ const accessorName = utils_default.toCamelCase(" " + header);
1092
+ ["get", "set", "has"].forEach((methodName) => {
1093
+ Object.defineProperty(obj, methodName + accessorName, {
1094
+ value: function(arg1, arg2, arg3) {
1095
+ return this[methodName].call(this, header, arg1, arg2, arg3);
1096
+ },
1097
+ configurable: true
1098
+ });
1099
+ });
1100
+ }
1101
+ var AxiosHeaders = class {
1102
+ constructor(headers) {
1103
+ headers && this.set(headers);
1104
+ }
1105
+ set(header, valueOrRewrite, rewrite) {
1106
+ const self2 = this;
1107
+ function setHeader(_value, _header, _rewrite) {
1108
+ const lHeader = normalizeHeader(_header);
1109
+ if (!lHeader) {
1110
+ throw new Error("header name must be a non-empty string");
1111
+ }
1112
+ const key = utils_default.findKey(self2, lHeader);
1113
+ if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
1114
+ self2[key || _header] = normalizeValue(_value);
1115
+ }
1116
+ }
1117
+ const setHeaders = (headers, _rewrite) => utils_default.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
1118
+ if (utils_default.isPlainObject(header) || header instanceof this.constructor) {
1119
+ setHeaders(header, valueOrRewrite);
1120
+ } else if (utils_default.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1121
+ setHeaders(parseHeaders_default(header), valueOrRewrite);
1122
+ } else if (utils_default.isObject(header) && utils_default.isIterable(header)) {
1123
+ let obj = {}, dest, key;
1124
+ for (const entry of header) {
1125
+ if (!utils_default.isArray(entry)) {
1126
+ throw TypeError("Object iterator must return a key-value pair");
1127
+ }
1128
+ obj[key = entry[0]] = (dest = obj[key]) ? utils_default.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
1129
+ }
1130
+ setHeaders(obj, valueOrRewrite);
1131
+ } else {
1132
+ header != null && setHeader(valueOrRewrite, header, rewrite);
1133
+ }
1134
+ return this;
1135
+ }
1136
+ get(header, parser) {
1137
+ header = normalizeHeader(header);
1138
+ if (header) {
1139
+ const key = utils_default.findKey(this, header);
1140
+ if (key) {
1141
+ const value = this[key];
1142
+ if (!parser) {
1143
+ return value;
1144
+ }
1145
+ if (parser === true) {
1146
+ return parseTokens(value);
1147
+ }
1148
+ if (utils_default.isFunction(parser)) {
1149
+ return parser.call(this, value, key);
1150
+ }
1151
+ if (utils_default.isRegExp(parser)) {
1152
+ return parser.exec(value);
1153
+ }
1154
+ throw new TypeError("parser must be boolean|regexp|function");
1155
+ }
1156
+ }
1157
+ }
1158
+ has(header, matcher) {
1159
+ header = normalizeHeader(header);
1160
+ if (header) {
1161
+ const key = utils_default.findKey(this, header);
1162
+ return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
1163
+ }
1164
+ return false;
1165
+ }
1166
+ delete(header, matcher) {
1167
+ const self2 = this;
1168
+ let deleted = false;
1169
+ function deleteHeader(_header) {
1170
+ _header = normalizeHeader(_header);
1171
+ if (_header) {
1172
+ const key = utils_default.findKey(self2, _header);
1173
+ if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
1174
+ delete self2[key];
1175
+ deleted = true;
1176
+ }
1177
+ }
1178
+ }
1179
+ if (utils_default.isArray(header)) {
1180
+ header.forEach(deleteHeader);
1181
+ } else {
1182
+ deleteHeader(header);
1183
+ }
1184
+ return deleted;
1185
+ }
1186
+ clear(matcher) {
1187
+ const keys = Object.keys(this);
1188
+ let i = keys.length;
1189
+ let deleted = false;
1190
+ while (i--) {
1191
+ const key = keys[i];
1192
+ if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
1193
+ delete this[key];
1194
+ deleted = true;
1195
+ }
1196
+ }
1197
+ return deleted;
1198
+ }
1199
+ normalize(format) {
1200
+ const self2 = this;
1201
+ const headers = {};
1202
+ utils_default.forEach(this, (value, header) => {
1203
+ const key = utils_default.findKey(headers, header);
1204
+ if (key) {
1205
+ self2[key] = normalizeValue(value);
1206
+ delete self2[header];
1207
+ return;
1208
+ }
1209
+ const normalized = format ? formatHeader(header) : String(header).trim();
1210
+ if (normalized !== header) {
1211
+ delete self2[header];
1212
+ }
1213
+ self2[normalized] = normalizeValue(value);
1214
+ headers[normalized] = true;
1215
+ });
1216
+ return this;
1217
+ }
1218
+ concat(...targets) {
1219
+ return this.constructor.concat(this, ...targets);
1220
+ }
1221
+ toJSON(asStrings) {
1222
+ const obj = /* @__PURE__ */ Object.create(null);
1223
+ utils_default.forEach(this, (value, header) => {
1224
+ value != null && value !== false && (obj[header] = asStrings && utils_default.isArray(value) ? value.join(", ") : value);
1225
+ });
1226
+ return obj;
1227
+ }
1228
+ [Symbol.iterator]() {
1229
+ return Object.entries(this.toJSON())[Symbol.iterator]();
1230
+ }
1231
+ toString() {
1232
+ return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
1233
+ }
1234
+ getSetCookie() {
1235
+ return this.get("set-cookie") || [];
1236
+ }
1237
+ get [Symbol.toStringTag]() {
1238
+ return "AxiosHeaders";
1239
+ }
1240
+ static from(thing) {
1241
+ return thing instanceof this ? thing : new this(thing);
1242
+ }
1243
+ static concat(first, ...targets) {
1244
+ const computed = new this(first);
1245
+ targets.forEach((target) => computed.set(target));
1246
+ return computed;
1247
+ }
1248
+ static accessor(header) {
1249
+ const internals = this[$internals] = this[$internals] = {
1250
+ accessors: {}
1251
+ };
1252
+ const accessors = internals.accessors;
1253
+ const prototype2 = this.prototype;
1254
+ function defineAccessor(_header) {
1255
+ const lHeader = normalizeHeader(_header);
1256
+ if (!accessors[lHeader]) {
1257
+ buildAccessors(prototype2, _header);
1258
+ accessors[lHeader] = true;
1259
+ }
1260
+ }
1261
+ utils_default.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
1262
+ return this;
1263
+ }
1264
+ };
1265
+ AxiosHeaders.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
1266
+ utils_default.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
1267
+ let mapped = key[0].toUpperCase() + key.slice(1);
1268
+ return {
1269
+ get: () => value,
1270
+ set(headerValue) {
1271
+ this[mapped] = headerValue;
1272
+ }
1273
+ };
1274
+ });
1275
+ utils_default.freezeMethods(AxiosHeaders);
1276
+ var AxiosHeaders_default = AxiosHeaders;
1277
+
1278
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/core/transformData.js
1279
+ function transformData(fns, response) {
1280
+ const config = this || defaults_default;
1281
+ const context = response || config;
1282
+ const headers = AxiosHeaders_default.from(context.headers);
1283
+ let data = context.data;
1284
+ utils_default.forEach(fns, function transform(fn) {
1285
+ data = fn.call(config, data, headers.normalize(), response ? response.status : void 0);
1286
+ });
1287
+ headers.normalize();
1288
+ return data;
1289
+ }
1290
+
1291
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/cancel/isCancel.js
1292
+ function isCancel(value) {
1293
+ return !!(value && value.__CANCEL__);
1294
+ }
1295
+
1296
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/cancel/CanceledError.js
1297
+ var CanceledError = class extends AxiosError_default {
1298
+ /**
1299
+ * A `CanceledError` is an object that is thrown when an operation is canceled.
1300
+ *
1301
+ * @param {string=} message The message.
1302
+ * @param {Object=} config The config.
1303
+ * @param {Object=} request The request.
1304
+ *
1305
+ * @returns {CanceledError} The created error.
1306
+ */
1307
+ constructor(message, config, request) {
1308
+ super(message == null ? "canceled" : message, AxiosError_default.ERR_CANCELED, config, request);
1309
+ this.name = "CanceledError";
1310
+ this.__CANCEL__ = true;
1311
+ }
1312
+ };
1313
+ var CanceledError_default = CanceledError;
1314
+
1315
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/core/settle.js
1316
+ function settle(resolve, reject, response) {
1317
+ const validateStatus2 = response.config.validateStatus;
1318
+ if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
1319
+ resolve(response);
1320
+ } else {
1321
+ reject(new AxiosError_default(
1322
+ "Request failed with status code " + response.status,
1323
+ [AxiosError_default.ERR_BAD_REQUEST, AxiosError_default.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
1324
+ response.config,
1325
+ response.request,
1326
+ response
1327
+ ));
1328
+ }
1329
+ }
1330
+
1331
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/helpers/parseProtocol.js
1332
+ function parseProtocol(url) {
1333
+ const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
1334
+ return match && match[1] || "";
1335
+ }
1336
+
1337
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/helpers/speedometer.js
1338
+ function speedometer(samplesCount, min) {
1339
+ samplesCount = samplesCount || 10;
1340
+ const bytes = new Array(samplesCount);
1341
+ const timestamps = new Array(samplesCount);
1342
+ let head = 0;
1343
+ let tail = 0;
1344
+ let firstSampleTS;
1345
+ min = min !== void 0 ? min : 1e3;
1346
+ return function push(chunkLength) {
1347
+ const now = Date.now();
1348
+ const startedAt = timestamps[tail];
1349
+ if (!firstSampleTS) {
1350
+ firstSampleTS = now;
1351
+ }
1352
+ bytes[head] = chunkLength;
1353
+ timestamps[head] = now;
1354
+ let i = tail;
1355
+ let bytesCount = 0;
1356
+ while (i !== head) {
1357
+ bytesCount += bytes[i++];
1358
+ i = i % samplesCount;
1359
+ }
1360
+ head = (head + 1) % samplesCount;
1361
+ if (head === tail) {
1362
+ tail = (tail + 1) % samplesCount;
1363
+ }
1364
+ if (now - firstSampleTS < min) {
1365
+ return;
1366
+ }
1367
+ const passed = startedAt && now - startedAt;
1368
+ return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
1369
+ };
1370
+ }
1371
+ var speedometer_default = speedometer;
1372
+
1373
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/helpers/throttle.js
1374
+ function throttle(fn, freq) {
1375
+ let timestamp = 0;
1376
+ let threshold = 1e3 / freq;
1377
+ let lastArgs;
1378
+ let timer;
1379
+ const invoke = (args, now = Date.now()) => {
1380
+ timestamp = now;
1381
+ lastArgs = null;
1382
+ if (timer) {
1383
+ clearTimeout(timer);
1384
+ timer = null;
1385
+ }
1386
+ fn(...args);
1387
+ };
1388
+ const throttled = (...args) => {
1389
+ const now = Date.now();
1390
+ const passed = now - timestamp;
1391
+ if (passed >= threshold) {
1392
+ invoke(args, now);
1393
+ } else {
1394
+ lastArgs = args;
1395
+ if (!timer) {
1396
+ timer = setTimeout(() => {
1397
+ timer = null;
1398
+ invoke(lastArgs);
1399
+ }, threshold - passed);
1400
+ }
1401
+ }
1402
+ };
1403
+ const flush = () => lastArgs && invoke(lastArgs);
1404
+ return [throttled, flush];
1405
+ }
1406
+ var throttle_default = throttle;
1407
+
1408
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/helpers/progressEventReducer.js
1409
+ var progressEventReducer = (listener, isDownloadStream, freq = 3) => {
1410
+ let bytesNotified = 0;
1411
+ const _speedometer = speedometer_default(50, 250);
1412
+ return throttle_default((e) => {
1413
+ const loaded = e.loaded;
1414
+ const total = e.lengthComputable ? e.total : void 0;
1415
+ const progressBytes = loaded - bytesNotified;
1416
+ const rate = _speedometer(progressBytes);
1417
+ const inRange = loaded <= total;
1418
+ bytesNotified = loaded;
1419
+ const data = {
1420
+ loaded,
1421
+ total,
1422
+ progress: total ? loaded / total : void 0,
1423
+ bytes: progressBytes,
1424
+ rate: rate ? rate : void 0,
1425
+ estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
1426
+ event: e,
1427
+ lengthComputable: total != null,
1428
+ [isDownloadStream ? "download" : "upload"]: true
1429
+ };
1430
+ listener(data);
1431
+ }, freq);
1432
+ };
1433
+ var progressEventDecorator = (total, throttled) => {
1434
+ const lengthComputable = total != null;
1435
+ return [(loaded) => throttled[0]({
1436
+ lengthComputable,
1437
+ total,
1438
+ loaded
1439
+ }), throttled[1]];
1440
+ };
1441
+ var asyncDecorator = (fn) => (...args) => utils_default.asap(() => fn(...args));
1442
+
1443
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/helpers/isURLSameOrigin.js
1444
+ var isURLSameOrigin_default = platform_default.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url) => {
1445
+ url = new URL(url, platform_default.origin);
1446
+ return origin2.protocol === url.protocol && origin2.host === url.host && (isMSIE || origin2.port === url.port);
1447
+ })(
1448
+ new URL(platform_default.origin),
1449
+ platform_default.navigator && /(msie|trident)/i.test(platform_default.navigator.userAgent)
1450
+ ) : () => true;
1451
+
1452
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/helpers/cookies.js
1453
+ var cookies_default = platform_default.hasStandardBrowserEnv ? (
1454
+ // Standard browser envs support document.cookie
1455
+ {
1456
+ write(name, value, expires, path, domain, secure, sameSite) {
1457
+ if (typeof document === "undefined")
1458
+ return;
1459
+ const cookie = [`${name}=${encodeURIComponent(value)}`];
1460
+ if (utils_default.isNumber(expires)) {
1461
+ cookie.push(`expires=${new Date(expires).toUTCString()}`);
1462
+ }
1463
+ if (utils_default.isString(path)) {
1464
+ cookie.push(`path=${path}`);
1465
+ }
1466
+ if (utils_default.isString(domain)) {
1467
+ cookie.push(`domain=${domain}`);
1468
+ }
1469
+ if (secure === true) {
1470
+ cookie.push("secure");
1471
+ }
1472
+ if (utils_default.isString(sameSite)) {
1473
+ cookie.push(`SameSite=${sameSite}`);
1474
+ }
1475
+ document.cookie = cookie.join("; ");
1476
+ },
1477
+ read(name) {
1478
+ if (typeof document === "undefined")
1479
+ return null;
1480
+ const match = document.cookie.match(new RegExp("(?:^|; )" + name + "=([^;]*)"));
1481
+ return match ? decodeURIComponent(match[1]) : null;
1482
+ },
1483
+ remove(name) {
1484
+ this.write(name, "", Date.now() - 864e5, "/");
1485
+ }
1486
+ }
1487
+ ) : (
1488
+ // Non-standard browser env (web workers, react-native) lack needed support.
1489
+ {
1490
+ write() {
1491
+ },
1492
+ read() {
1493
+ return null;
1494
+ },
1495
+ remove() {
1496
+ }
1497
+ }
1498
+ );
1499
+
1500
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/helpers/isAbsoluteURL.js
1501
+ function isAbsoluteURL(url) {
1502
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
1503
+ }
1504
+
1505
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/helpers/combineURLs.js
1506
+ function combineURLs(baseURL, relativeURL) {
1507
+ return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
1508
+ }
1509
+
1510
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/core/buildFullPath.js
1511
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
1512
+ let isRelativeUrl = !isAbsoluteURL(requestedURL);
1513
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
1514
+ return combineURLs(baseURL, requestedURL);
1515
+ }
1516
+ return requestedURL;
1517
+ }
1518
+
1519
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/core/mergeConfig.js
1520
+ var headersToObject = (thing) => thing instanceof AxiosHeaders_default ? { ...thing } : thing;
1521
+ function mergeConfig(config1, config2) {
1522
+ config2 = config2 || {};
1523
+ const config = {};
1524
+ function getMergedValue(target, source, prop, caseless) {
1525
+ if (utils_default.isPlainObject(target) && utils_default.isPlainObject(source)) {
1526
+ return utils_default.merge.call({ caseless }, target, source);
1527
+ } else if (utils_default.isPlainObject(source)) {
1528
+ return utils_default.merge({}, source);
1529
+ } else if (utils_default.isArray(source)) {
1530
+ return source.slice();
1531
+ }
1532
+ return source;
1533
+ }
1534
+ function mergeDeepProperties(a, b, prop, caseless) {
1535
+ if (!utils_default.isUndefined(b)) {
1536
+ return getMergedValue(a, b, prop, caseless);
1537
+ } else if (!utils_default.isUndefined(a)) {
1538
+ return getMergedValue(void 0, a, prop, caseless);
1539
+ }
1540
+ }
1541
+ function valueFromConfig2(a, b) {
1542
+ if (!utils_default.isUndefined(b)) {
1543
+ return getMergedValue(void 0, b);
1544
+ }
1545
+ }
1546
+ function defaultToConfig2(a, b) {
1547
+ if (!utils_default.isUndefined(b)) {
1548
+ return getMergedValue(void 0, b);
1549
+ } else if (!utils_default.isUndefined(a)) {
1550
+ return getMergedValue(void 0, a);
1551
+ }
1552
+ }
1553
+ function mergeDirectKeys(a, b, prop) {
1554
+ if (prop in config2) {
1555
+ return getMergedValue(a, b);
1556
+ } else if (prop in config1) {
1557
+ return getMergedValue(void 0, a);
1558
+ }
1559
+ }
1560
+ const mergeMap = {
1561
+ url: valueFromConfig2,
1562
+ method: valueFromConfig2,
1563
+ data: valueFromConfig2,
1564
+ baseURL: defaultToConfig2,
1565
+ transformRequest: defaultToConfig2,
1566
+ transformResponse: defaultToConfig2,
1567
+ paramsSerializer: defaultToConfig2,
1568
+ timeout: defaultToConfig2,
1569
+ timeoutMessage: defaultToConfig2,
1570
+ withCredentials: defaultToConfig2,
1571
+ withXSRFToken: defaultToConfig2,
1572
+ adapter: defaultToConfig2,
1573
+ responseType: defaultToConfig2,
1574
+ xsrfCookieName: defaultToConfig2,
1575
+ xsrfHeaderName: defaultToConfig2,
1576
+ onUploadProgress: defaultToConfig2,
1577
+ onDownloadProgress: defaultToConfig2,
1578
+ decompress: defaultToConfig2,
1579
+ maxContentLength: defaultToConfig2,
1580
+ maxBodyLength: defaultToConfig2,
1581
+ beforeRedirect: defaultToConfig2,
1582
+ transport: defaultToConfig2,
1583
+ httpAgent: defaultToConfig2,
1584
+ httpsAgent: defaultToConfig2,
1585
+ cancelToken: defaultToConfig2,
1586
+ socketPath: defaultToConfig2,
1587
+ responseEncoding: defaultToConfig2,
1588
+ validateStatus: mergeDirectKeys,
1589
+ headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
1590
+ };
1591
+ utils_default.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
1592
+ const merge2 = mergeMap[prop] || mergeDeepProperties;
1593
+ const configValue = merge2(config1[prop], config2[prop], prop);
1594
+ utils_default.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
1595
+ });
1596
+ return config;
1597
+ }
1598
+
1599
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/helpers/resolveConfig.js
1600
+ var resolveConfig_default = (config) => {
1601
+ const newConfig = mergeConfig({}, config);
1602
+ let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
1603
+ newConfig.headers = headers = AxiosHeaders_default.from(headers);
1604
+ newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
1605
+ if (auth) {
1606
+ headers.set(
1607
+ "Authorization",
1608
+ "Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : ""))
1609
+ );
1610
+ }
1611
+ if (utils_default.isFormData(data)) {
1612
+ if (platform_default.hasStandardBrowserEnv || platform_default.hasStandardBrowserWebWorkerEnv) {
1613
+ headers.setContentType(void 0);
1614
+ } else if (utils_default.isFunction(data.getHeaders)) {
1615
+ const formHeaders = data.getHeaders();
1616
+ const allowedHeaders = ["content-type", "content-length"];
1617
+ Object.entries(formHeaders).forEach(([key, val]) => {
1618
+ if (allowedHeaders.includes(key.toLowerCase())) {
1619
+ headers.set(key, val);
1620
+ }
1621
+ });
1622
+ }
1623
+ }
1624
+ if (platform_default.hasStandardBrowserEnv) {
1625
+ withXSRFToken && utils_default.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
1626
+ if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin_default(newConfig.url)) {
1627
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies_default.read(xsrfCookieName);
1628
+ if (xsrfValue) {
1629
+ headers.set(xsrfHeaderName, xsrfValue);
1630
+ }
1631
+ }
1632
+ }
1633
+ return newConfig;
1634
+ };
1635
+
1636
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/adapters/xhr.js
1637
+ var isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
1638
+ var xhr_default = isXHRAdapterSupported && function(config) {
1639
+ return new Promise(function dispatchXhrRequest(resolve, reject) {
1640
+ const _config = resolveConfig_default(config);
1641
+ let requestData = _config.data;
1642
+ const requestHeaders = AxiosHeaders_default.from(_config.headers).normalize();
1643
+ let { responseType, onUploadProgress, onDownloadProgress } = _config;
1644
+ let onCanceled;
1645
+ let uploadThrottled, downloadThrottled;
1646
+ let flushUpload, flushDownload;
1647
+ function done() {
1648
+ flushUpload && flushUpload();
1649
+ flushDownload && flushDownload();
1650
+ _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
1651
+ _config.signal && _config.signal.removeEventListener("abort", onCanceled);
1652
+ }
1653
+ let request = new XMLHttpRequest();
1654
+ request.open(_config.method.toUpperCase(), _config.url, true);
1655
+ request.timeout = _config.timeout;
1656
+ function onloadend() {
1657
+ if (!request) {
1658
+ return;
1659
+ }
1660
+ const responseHeaders = AxiosHeaders_default.from(
1661
+ "getAllResponseHeaders" in request && request.getAllResponseHeaders()
1662
+ );
1663
+ const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
1664
+ const response = {
1665
+ data: responseData,
1666
+ status: request.status,
1667
+ statusText: request.statusText,
1668
+ headers: responseHeaders,
1669
+ config,
1670
+ request
1671
+ };
1672
+ settle(function _resolve(value) {
1673
+ resolve(value);
1674
+ done();
1675
+ }, function _reject(err) {
1676
+ reject(err);
1677
+ done();
1678
+ }, response);
1679
+ request = null;
1680
+ }
1681
+ if ("onloadend" in request) {
1682
+ request.onloadend = onloadend;
1683
+ } else {
1684
+ request.onreadystatechange = function handleLoad() {
1685
+ if (!request || request.readyState !== 4) {
1686
+ return;
1687
+ }
1688
+ if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
1689
+ return;
1690
+ }
1691
+ setTimeout(onloadend);
1692
+ };
1693
+ }
1694
+ request.onabort = function handleAbort() {
1695
+ if (!request) {
1696
+ return;
1697
+ }
1698
+ reject(new AxiosError_default("Request aborted", AxiosError_default.ECONNABORTED, config, request));
1699
+ request = null;
1700
+ };
1701
+ request.onerror = function handleError(event) {
1702
+ const msg = event && event.message ? event.message : "Network Error";
1703
+ const err = new AxiosError_default(msg, AxiosError_default.ERR_NETWORK, config, request);
1704
+ err.event = event || null;
1705
+ reject(err);
1706
+ request = null;
1707
+ };
1708
+ request.ontimeout = function handleTimeout() {
1709
+ let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
1710
+ const transitional2 = _config.transitional || transitional_default;
1711
+ if (_config.timeoutErrorMessage) {
1712
+ timeoutErrorMessage = _config.timeoutErrorMessage;
1713
+ }
1714
+ reject(new AxiosError_default(
1715
+ timeoutErrorMessage,
1716
+ transitional2.clarifyTimeoutError ? AxiosError_default.ETIMEDOUT : AxiosError_default.ECONNABORTED,
1717
+ config,
1718
+ request
1719
+ ));
1720
+ request = null;
1721
+ };
1722
+ requestData === void 0 && requestHeaders.setContentType(null);
1723
+ if ("setRequestHeader" in request) {
1724
+ utils_default.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
1725
+ request.setRequestHeader(key, val);
1726
+ });
1727
+ }
1728
+ if (!utils_default.isUndefined(_config.withCredentials)) {
1729
+ request.withCredentials = !!_config.withCredentials;
1730
+ }
1731
+ if (responseType && responseType !== "json") {
1732
+ request.responseType = _config.responseType;
1733
+ }
1734
+ if (onDownloadProgress) {
1735
+ [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
1736
+ request.addEventListener("progress", downloadThrottled);
1737
+ }
1738
+ if (onUploadProgress && request.upload) {
1739
+ [uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
1740
+ request.upload.addEventListener("progress", uploadThrottled);
1741
+ request.upload.addEventListener("loadend", flushUpload);
1742
+ }
1743
+ if (_config.cancelToken || _config.signal) {
1744
+ onCanceled = (cancel) => {
1745
+ if (!request) {
1746
+ return;
1747
+ }
1748
+ reject(!cancel || cancel.type ? new CanceledError_default(null, config, request) : cancel);
1749
+ request.abort();
1750
+ request = null;
1751
+ };
1752
+ _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
1753
+ if (_config.signal) {
1754
+ _config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
1755
+ }
1756
+ }
1757
+ const protocol = parseProtocol(_config.url);
1758
+ if (protocol && platform_default.protocols.indexOf(protocol) === -1) {
1759
+ reject(new AxiosError_default("Unsupported protocol " + protocol + ":", AxiosError_default.ERR_BAD_REQUEST, config));
1760
+ return;
1761
+ }
1762
+ request.send(requestData || null);
1763
+ });
1764
+ };
1765
+
1766
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/helpers/composeSignals.js
1767
+ var composeSignals = (signals, timeout) => {
1768
+ const { length } = signals = signals ? signals.filter(Boolean) : [];
1769
+ if (timeout || length) {
1770
+ let controller = new AbortController();
1771
+ let aborted;
1772
+ const onabort = function(reason) {
1773
+ if (!aborted) {
1774
+ aborted = true;
1775
+ unsubscribe();
1776
+ const err = reason instanceof Error ? reason : this.reason;
1777
+ controller.abort(err instanceof AxiosError_default ? err : new CanceledError_default(err instanceof Error ? err.message : err));
1778
+ }
1779
+ };
1780
+ let timer = timeout && setTimeout(() => {
1781
+ timer = null;
1782
+ onabort(new AxiosError_default(`timeout of ${timeout}ms exceeded`, AxiosError_default.ETIMEDOUT));
1783
+ }, timeout);
1784
+ const unsubscribe = () => {
1785
+ if (signals) {
1786
+ timer && clearTimeout(timer);
1787
+ timer = null;
1788
+ signals.forEach((signal2) => {
1789
+ signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
1790
+ });
1791
+ signals = null;
1792
+ }
1793
+ };
1794
+ signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
1795
+ const { signal } = controller;
1796
+ signal.unsubscribe = () => utils_default.asap(unsubscribe);
1797
+ return signal;
1798
+ }
1799
+ };
1800
+ var composeSignals_default = composeSignals;
1801
+
1802
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/helpers/trackStream.js
1803
+ var streamChunk = function* (chunk, chunkSize) {
1804
+ let len = chunk.byteLength;
1805
+ if (!chunkSize || len < chunkSize) {
1806
+ yield chunk;
1807
+ return;
1808
+ }
1809
+ let pos = 0;
1810
+ let end;
1811
+ while (pos < len) {
1812
+ end = pos + chunkSize;
1813
+ yield chunk.slice(pos, end);
1814
+ pos = end;
1815
+ }
1816
+ };
1817
+ var readBytes = async function* (iterable, chunkSize) {
1818
+ for await (const chunk of readStream(iterable)) {
1819
+ yield* streamChunk(chunk, chunkSize);
1820
+ }
1821
+ };
1822
+ var readStream = async function* (stream) {
1823
+ if (stream[Symbol.asyncIterator]) {
1824
+ yield* stream;
1825
+ return;
1826
+ }
1827
+ const reader = stream.getReader();
1828
+ try {
1829
+ for (; ; ) {
1830
+ const { done, value } = await reader.read();
1831
+ if (done) {
1832
+ break;
1833
+ }
1834
+ yield value;
1835
+ }
1836
+ } finally {
1837
+ await reader.cancel();
1838
+ }
1839
+ };
1840
+ var trackStream = (stream, chunkSize, onProgress, onFinish) => {
1841
+ const iterator2 = readBytes(stream, chunkSize);
1842
+ let bytes = 0;
1843
+ let done;
1844
+ let _onFinish = (e) => {
1845
+ if (!done) {
1846
+ done = true;
1847
+ onFinish && onFinish(e);
1848
+ }
1849
+ };
1850
+ return new ReadableStream({
1851
+ async pull(controller) {
1852
+ try {
1853
+ const { done: done2, value } = await iterator2.next();
1854
+ if (done2) {
1855
+ _onFinish();
1856
+ controller.close();
1857
+ return;
1858
+ }
1859
+ let len = value.byteLength;
1860
+ if (onProgress) {
1861
+ let loadedBytes = bytes += len;
1862
+ onProgress(loadedBytes);
1863
+ }
1864
+ controller.enqueue(new Uint8Array(value));
1865
+ } catch (err) {
1866
+ _onFinish(err);
1867
+ throw err;
1868
+ }
1869
+ },
1870
+ cancel(reason) {
1871
+ _onFinish(reason);
1872
+ return iterator2.return();
1873
+ }
1874
+ }, {
1875
+ highWaterMark: 2
1876
+ });
1877
+ };
1878
+
1879
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/adapters/fetch.js
1880
+ var DEFAULT_CHUNK_SIZE = 64 * 1024;
1881
+ var { isFunction: isFunction2 } = utils_default;
1882
+ var globalFetchAPI = (({ Request, Response }) => ({
1883
+ Request,
1884
+ Response
1885
+ }))(utils_default.global);
1886
+ var {
1887
+ ReadableStream: ReadableStream2,
1888
+ TextEncoder
1889
+ } = utils_default.global;
1890
+ var test = (fn, ...args) => {
1891
+ try {
1892
+ return !!fn(...args);
1893
+ } catch (e) {
1894
+ return false;
1895
+ }
1896
+ };
1897
+ var factory = (env) => {
1898
+ env = utils_default.merge.call({
1899
+ skipUndefined: true
1900
+ }, globalFetchAPI, env);
1901
+ const { fetch: envFetch, Request, Response } = env;
1902
+ const isFetchSupported = envFetch ? isFunction2(envFetch) : typeof fetch === "function";
1903
+ const isRequestSupported = isFunction2(Request);
1904
+ const isResponseSupported = isFunction2(Response);
1905
+ if (!isFetchSupported) {
1906
+ return false;
1907
+ }
1908
+ const isReadableStreamSupported = isFetchSupported && isFunction2(ReadableStream2);
1909
+ const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
1910
+ const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
1911
+ let duplexAccessed = false;
1912
+ const hasContentType = new Request(platform_default.origin, {
1913
+ body: new ReadableStream2(),
1914
+ method: "POST",
1915
+ get duplex() {
1916
+ duplexAccessed = true;
1917
+ return "half";
1918
+ }
1919
+ }).headers.has("Content-Type");
1920
+ return duplexAccessed && !hasContentType;
1921
+ });
1922
+ const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils_default.isReadableStream(new Response("").body));
1923
+ const resolvers = {
1924
+ stream: supportsResponseStream && ((res) => res.body)
1925
+ };
1926
+ isFetchSupported && (() => {
1927
+ ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
1928
+ !resolvers[type] && (resolvers[type] = (res, config) => {
1929
+ let method = res && res[type];
1930
+ if (method) {
1931
+ return method.call(res);
1932
+ }
1933
+ throw new AxiosError_default(`Response type '${type}' is not supported`, AxiosError_default.ERR_NOT_SUPPORT, config);
1934
+ });
1935
+ });
1936
+ })();
1937
+ const getBodyLength = async (body) => {
1938
+ if (body == null) {
1939
+ return 0;
1940
+ }
1941
+ if (utils_default.isBlob(body)) {
1942
+ return body.size;
1943
+ }
1944
+ if (utils_default.isSpecCompliantForm(body)) {
1945
+ const _request = new Request(platform_default.origin, {
1946
+ method: "POST",
1947
+ body
1948
+ });
1949
+ return (await _request.arrayBuffer()).byteLength;
1950
+ }
1951
+ if (utils_default.isArrayBufferView(body) || utils_default.isArrayBuffer(body)) {
1952
+ return body.byteLength;
1953
+ }
1954
+ if (utils_default.isURLSearchParams(body)) {
1955
+ body = body + "";
1956
+ }
1957
+ if (utils_default.isString(body)) {
1958
+ return (await encodeText(body)).byteLength;
1959
+ }
1960
+ };
1961
+ const resolveBodyLength = async (headers, body) => {
1962
+ const length = utils_default.toFiniteNumber(headers.getContentLength());
1963
+ return length == null ? getBodyLength(body) : length;
1964
+ };
1965
+ return async (config) => {
1966
+ let {
1967
+ url,
1968
+ method,
1969
+ data,
1970
+ signal,
1971
+ cancelToken,
1972
+ timeout,
1973
+ onDownloadProgress,
1974
+ onUploadProgress,
1975
+ responseType,
1976
+ headers,
1977
+ withCredentials = "same-origin",
1978
+ fetchOptions
1979
+ } = resolveConfig_default(config);
1980
+ let _fetch = envFetch || fetch;
1981
+ responseType = responseType ? (responseType + "").toLowerCase() : "text";
1982
+ let composedSignal = composeSignals_default([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
1983
+ let request = null;
1984
+ const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
1985
+ composedSignal.unsubscribe();
1986
+ });
1987
+ let requestContentLength;
1988
+ try {
1989
+ if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
1990
+ let _request = new Request(url, {
1991
+ method: "POST",
1992
+ body: data,
1993
+ duplex: "half"
1994
+ });
1995
+ let contentTypeHeader;
1996
+ if (utils_default.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
1997
+ headers.setContentType(contentTypeHeader);
1998
+ }
1999
+ if (_request.body) {
2000
+ const [onProgress, flush] = progressEventDecorator(
2001
+ requestContentLength,
2002
+ progressEventReducer(asyncDecorator(onUploadProgress))
2003
+ );
2004
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
2005
+ }
2006
+ }
2007
+ if (!utils_default.isString(withCredentials)) {
2008
+ withCredentials = withCredentials ? "include" : "omit";
2009
+ }
2010
+ const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
2011
+ const resolvedOptions = {
2012
+ ...fetchOptions,
2013
+ signal: composedSignal,
2014
+ method: method.toUpperCase(),
2015
+ headers: headers.normalize().toJSON(),
2016
+ body: data,
2017
+ duplex: "half",
2018
+ credentials: isCredentialsSupported ? withCredentials : void 0
2019
+ };
2020
+ request = isRequestSupported && new Request(url, resolvedOptions);
2021
+ let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
2022
+ const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
2023
+ if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
2024
+ const options = {};
2025
+ ["status", "statusText", "headers"].forEach((prop) => {
2026
+ options[prop] = response[prop];
2027
+ });
2028
+ const responseContentLength = utils_default.toFiniteNumber(response.headers.get("content-length"));
2029
+ const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
2030
+ responseContentLength,
2031
+ progressEventReducer(asyncDecorator(onDownloadProgress), true)
2032
+ ) || [];
2033
+ response = new Response(
2034
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
2035
+ flush && flush();
2036
+ unsubscribe && unsubscribe();
2037
+ }),
2038
+ options
2039
+ );
2040
+ }
2041
+ responseType = responseType || "text";
2042
+ let responseData = await resolvers[utils_default.findKey(resolvers, responseType) || "text"](response, config);
2043
+ !isStreamResponse && unsubscribe && unsubscribe();
2044
+ return await new Promise((resolve, reject) => {
2045
+ settle(resolve, reject, {
2046
+ data: responseData,
2047
+ headers: AxiosHeaders_default.from(response.headers),
2048
+ status: response.status,
2049
+ statusText: response.statusText,
2050
+ config,
2051
+ request
2052
+ });
2053
+ });
2054
+ } catch (err) {
2055
+ unsubscribe && unsubscribe();
2056
+ if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
2057
+ throw Object.assign(
2058
+ new AxiosError_default("Network Error", AxiosError_default.ERR_NETWORK, config, request),
2059
+ {
2060
+ cause: err.cause || err
2061
+ }
2062
+ );
2063
+ }
2064
+ throw AxiosError_default.from(err, err && err.code, config, request);
2065
+ }
2066
+ };
2067
+ };
2068
+ var seedCache = /* @__PURE__ */ new Map();
2069
+ var getFetch = (config) => {
2070
+ let env = config && config.env || {};
2071
+ const { fetch: fetch2, Request, Response } = env;
2072
+ const seeds = [
2073
+ Request,
2074
+ Response,
2075
+ fetch2
2076
+ ];
2077
+ let len = seeds.length, i = len, seed, target, map = seedCache;
2078
+ while (i--) {
2079
+ seed = seeds[i];
2080
+ target = map.get(seed);
2081
+ target === void 0 && map.set(seed, target = i ? /* @__PURE__ */ new Map() : factory(env));
2082
+ map = target;
2083
+ }
2084
+ return target;
2085
+ };
2086
+ var adapter = getFetch();
2087
+
2088
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/adapters/adapters.js
2089
+ var knownAdapters = {
2090
+ http: null_default,
2091
+ xhr: xhr_default,
2092
+ fetch: {
2093
+ get: getFetch
2094
+ }
2095
+ };
2096
+ utils_default.forEach(knownAdapters, (fn, value) => {
2097
+ if (fn) {
2098
+ try {
2099
+ Object.defineProperty(fn, "name", { value });
2100
+ } catch (e) {
2101
+ }
2102
+ Object.defineProperty(fn, "adapterName", { value });
2103
+ }
2104
+ });
2105
+ var renderReason = (reason) => `- ${reason}`;
2106
+ var isResolvedHandle = (adapter2) => utils_default.isFunction(adapter2) || adapter2 === null || adapter2 === false;
2107
+ function getAdapter(adapters, config) {
2108
+ adapters = utils_default.isArray(adapters) ? adapters : [adapters];
2109
+ const { length } = adapters;
2110
+ let nameOrAdapter;
2111
+ let adapter2;
2112
+ const rejectedReasons = {};
2113
+ for (let i = 0; i < length; i++) {
2114
+ nameOrAdapter = adapters[i];
2115
+ let id;
2116
+ adapter2 = nameOrAdapter;
2117
+ if (!isResolvedHandle(nameOrAdapter)) {
2118
+ adapter2 = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
2119
+ if (adapter2 === void 0) {
2120
+ throw new AxiosError_default(`Unknown adapter '${id}'`);
2121
+ }
2122
+ }
2123
+ if (adapter2 && (utils_default.isFunction(adapter2) || (adapter2 = adapter2.get(config)))) {
2124
+ break;
2125
+ }
2126
+ rejectedReasons[id || "#" + i] = adapter2;
2127
+ }
2128
+ if (!adapter2) {
2129
+ const reasons = Object.entries(rejectedReasons).map(
2130
+ ([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
2131
+ );
2132
+ let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
2133
+ throw new AxiosError_default(
2134
+ `There is no suitable adapter to dispatch the request ` + s,
2135
+ "ERR_NOT_SUPPORT"
2136
+ );
2137
+ }
2138
+ return adapter2;
2139
+ }
2140
+ var adapters_default = {
2141
+ /**
2142
+ * Resolve an adapter from a list of adapter names or functions.
2143
+ * @type {Function}
2144
+ */
2145
+ getAdapter,
2146
+ /**
2147
+ * Exposes all known adapters
2148
+ * @type {Object<string, Function|Object>}
2149
+ */
2150
+ adapters: knownAdapters
2151
+ };
2152
+
2153
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/core/dispatchRequest.js
2154
+ function throwIfCancellationRequested(config) {
2155
+ if (config.cancelToken) {
2156
+ config.cancelToken.throwIfRequested();
2157
+ }
2158
+ if (config.signal && config.signal.aborted) {
2159
+ throw new CanceledError_default(null, config);
2160
+ }
2161
+ }
2162
+ function dispatchRequest(config) {
2163
+ throwIfCancellationRequested(config);
2164
+ config.headers = AxiosHeaders_default.from(config.headers);
2165
+ config.data = transformData.call(
2166
+ config,
2167
+ config.transformRequest
2168
+ );
2169
+ if (["post", "put", "patch"].indexOf(config.method) !== -1) {
2170
+ config.headers.setContentType("application/x-www-form-urlencoded", false);
2171
+ }
2172
+ const adapter2 = adapters_default.getAdapter(config.adapter || defaults_default.adapter, config);
2173
+ return adapter2(config).then(function onAdapterResolution(response) {
2174
+ throwIfCancellationRequested(config);
2175
+ response.data = transformData.call(
2176
+ config,
2177
+ config.transformResponse,
2178
+ response
2179
+ );
2180
+ response.headers = AxiosHeaders_default.from(response.headers);
2181
+ return response;
2182
+ }, function onAdapterRejection(reason) {
2183
+ if (!isCancel(reason)) {
2184
+ throwIfCancellationRequested(config);
2185
+ if (reason && reason.response) {
2186
+ reason.response.data = transformData.call(
2187
+ config,
2188
+ config.transformResponse,
2189
+ reason.response
2190
+ );
2191
+ reason.response.headers = AxiosHeaders_default.from(reason.response.headers);
2192
+ }
2193
+ }
2194
+ return Promise.reject(reason);
2195
+ });
2196
+ }
2197
+
2198
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/env/data.js
2199
+ var VERSION = "1.13.4";
2200
+
2201
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/helpers/validator.js
2202
+ var validators = {};
2203
+ ["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
2204
+ validators[type] = function validator(thing) {
2205
+ return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
2206
+ };
2207
+ });
2208
+ var deprecatedWarnings = {};
2209
+ validators.transitional = function transitional(validator, version, message) {
2210
+ function formatMessage(opt, desc) {
2211
+ return "[Axios v" + VERSION + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
2212
+ }
2213
+ return (value, opt, opts) => {
2214
+ if (validator === false) {
2215
+ throw new AxiosError_default(
2216
+ formatMessage(opt, " has been removed" + (version ? " in " + version : "")),
2217
+ AxiosError_default.ERR_DEPRECATED
2218
+ );
2219
+ }
2220
+ if (version && !deprecatedWarnings[opt]) {
2221
+ deprecatedWarnings[opt] = true;
2222
+ console.warn(
2223
+ formatMessage(
2224
+ opt,
2225
+ " has been deprecated since v" + version + " and will be removed in the near future"
2226
+ )
2227
+ );
2228
+ }
2229
+ return validator ? validator(value, opt, opts) : true;
2230
+ };
2231
+ };
2232
+ validators.spelling = function spelling(correctSpelling) {
2233
+ return (value, opt) => {
2234
+ console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
2235
+ return true;
2236
+ };
2237
+ };
2238
+ function assertOptions(options, schema, allowUnknown) {
2239
+ if (typeof options !== "object") {
2240
+ throw new AxiosError_default("options must be an object", AxiosError_default.ERR_BAD_OPTION_VALUE);
2241
+ }
2242
+ const keys = Object.keys(options);
2243
+ let i = keys.length;
2244
+ while (i-- > 0) {
2245
+ const opt = keys[i];
2246
+ const validator = schema[opt];
2247
+ if (validator) {
2248
+ const value = options[opt];
2249
+ const result = value === void 0 || validator(value, opt, options);
2250
+ if (result !== true) {
2251
+ throw new AxiosError_default("option " + opt + " must be " + result, AxiosError_default.ERR_BAD_OPTION_VALUE);
2252
+ }
2253
+ continue;
2254
+ }
2255
+ if (allowUnknown !== true) {
2256
+ throw new AxiosError_default("Unknown option " + opt, AxiosError_default.ERR_BAD_OPTION);
2257
+ }
2258
+ }
2259
+ }
2260
+ var validator_default = {
2261
+ assertOptions,
2262
+ validators
2263
+ };
2264
+
2265
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/core/Axios.js
2266
+ var validators2 = validator_default.validators;
2267
+ var Axios = class {
2268
+ constructor(instanceConfig) {
2269
+ this.defaults = instanceConfig || {};
2270
+ this.interceptors = {
2271
+ request: new InterceptorManager_default(),
2272
+ response: new InterceptorManager_default()
2273
+ };
2274
+ }
2275
+ /**
2276
+ * Dispatch a request
2277
+ *
2278
+ * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
2279
+ * @param {?Object} config
2280
+ *
2281
+ * @returns {Promise} The Promise to be fulfilled
2282
+ */
2283
+ async request(configOrUrl, config) {
2284
+ try {
2285
+ return await this._request(configOrUrl, config);
2286
+ } catch (err) {
2287
+ if (err instanceof Error) {
2288
+ let dummy = {};
2289
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
2290
+ const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
2291
+ try {
2292
+ if (!err.stack) {
2293
+ err.stack = stack;
2294
+ } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
2295
+ err.stack += "\n" + stack;
2296
+ }
2297
+ } catch (e) {
2298
+ }
2299
+ }
2300
+ throw err;
2301
+ }
2302
+ }
2303
+ _request(configOrUrl, config) {
2304
+ if (typeof configOrUrl === "string") {
2305
+ config = config || {};
2306
+ config.url = configOrUrl;
2307
+ } else {
2308
+ config = configOrUrl || {};
2309
+ }
2310
+ config = mergeConfig(this.defaults, config);
2311
+ const { transitional: transitional2, paramsSerializer, headers } = config;
2312
+ if (transitional2 !== void 0) {
2313
+ validator_default.assertOptions(transitional2, {
2314
+ silentJSONParsing: validators2.transitional(validators2.boolean),
2315
+ forcedJSONParsing: validators2.transitional(validators2.boolean),
2316
+ clarifyTimeoutError: validators2.transitional(validators2.boolean)
2317
+ }, false);
2318
+ }
2319
+ if (paramsSerializer != null) {
2320
+ if (utils_default.isFunction(paramsSerializer)) {
2321
+ config.paramsSerializer = {
2322
+ serialize: paramsSerializer
2323
+ };
2324
+ } else {
2325
+ validator_default.assertOptions(paramsSerializer, {
2326
+ encode: validators2.function,
2327
+ serialize: validators2.function
2328
+ }, true);
2329
+ }
2330
+ }
2331
+ if (config.allowAbsoluteUrls !== void 0) {
2332
+ } else if (this.defaults.allowAbsoluteUrls !== void 0) {
2333
+ config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
2334
+ } else {
2335
+ config.allowAbsoluteUrls = true;
2336
+ }
2337
+ validator_default.assertOptions(config, {
2338
+ baseUrl: validators2.spelling("baseURL"),
2339
+ withXsrfToken: validators2.spelling("withXSRFToken")
2340
+ }, true);
2341
+ config.method = (config.method || this.defaults.method || "get").toLowerCase();
2342
+ let contextHeaders = headers && utils_default.merge(
2343
+ headers.common,
2344
+ headers[config.method]
2345
+ );
2346
+ headers && utils_default.forEach(
2347
+ ["delete", "get", "head", "post", "put", "patch", "common"],
2348
+ (method) => {
2349
+ delete headers[method];
2350
+ }
2351
+ );
2352
+ config.headers = AxiosHeaders_default.concat(contextHeaders, headers);
2353
+ const requestInterceptorChain = [];
2354
+ let synchronousRequestInterceptors = true;
2355
+ this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
2356
+ if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
2357
+ return;
2358
+ }
2359
+ synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
2360
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
2361
+ });
2362
+ const responseInterceptorChain = [];
2363
+ this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
2364
+ responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
2365
+ });
2366
+ let promise;
2367
+ let i = 0;
2368
+ let len;
2369
+ if (!synchronousRequestInterceptors) {
2370
+ const chain = [dispatchRequest.bind(this), void 0];
2371
+ chain.unshift(...requestInterceptorChain);
2372
+ chain.push(...responseInterceptorChain);
2373
+ len = chain.length;
2374
+ promise = Promise.resolve(config);
2375
+ while (i < len) {
2376
+ promise = promise.then(chain[i++], chain[i++]);
2377
+ }
2378
+ return promise;
2379
+ }
2380
+ len = requestInterceptorChain.length;
2381
+ let newConfig = config;
2382
+ while (i < len) {
2383
+ const onFulfilled = requestInterceptorChain[i++];
2384
+ const onRejected = requestInterceptorChain[i++];
2385
+ try {
2386
+ newConfig = onFulfilled(newConfig);
2387
+ } catch (error) {
2388
+ onRejected.call(this, error);
2389
+ break;
2390
+ }
2391
+ }
2392
+ try {
2393
+ promise = dispatchRequest.call(this, newConfig);
2394
+ } catch (error) {
2395
+ return Promise.reject(error);
2396
+ }
2397
+ i = 0;
2398
+ len = responseInterceptorChain.length;
2399
+ while (i < len) {
2400
+ promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
2401
+ }
2402
+ return promise;
2403
+ }
2404
+ getUri(config) {
2405
+ config = mergeConfig(this.defaults, config);
2406
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
2407
+ return buildURL(fullPath, config.params, config.paramsSerializer);
2408
+ }
2409
+ };
2410
+ utils_default.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
2411
+ Axios.prototype[method] = function(url, config) {
2412
+ return this.request(mergeConfig(config || {}, {
2413
+ method,
2414
+ url,
2415
+ data: (config || {}).data
2416
+ }));
2417
+ };
2418
+ });
2419
+ utils_default.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
2420
+ function generateHTTPMethod(isForm) {
2421
+ return function httpMethod(url, data, config) {
2422
+ return this.request(mergeConfig(config || {}, {
2423
+ method,
2424
+ headers: isForm ? {
2425
+ "Content-Type": "multipart/form-data"
2426
+ } : {},
2427
+ url,
2428
+ data
2429
+ }));
2430
+ };
2431
+ }
2432
+ Axios.prototype[method] = generateHTTPMethod();
2433
+ Axios.prototype[method + "Form"] = generateHTTPMethod(true);
2434
+ });
2435
+ var Axios_default = Axios;
2436
+
2437
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/cancel/CancelToken.js
2438
+ var CancelToken = class _CancelToken {
2439
+ constructor(executor) {
2440
+ if (typeof executor !== "function") {
2441
+ throw new TypeError("executor must be a function.");
2442
+ }
2443
+ let resolvePromise;
2444
+ this.promise = new Promise(function promiseExecutor(resolve) {
2445
+ resolvePromise = resolve;
2446
+ });
2447
+ const token = this;
2448
+ this.promise.then((cancel) => {
2449
+ if (!token._listeners)
2450
+ return;
2451
+ let i = token._listeners.length;
2452
+ while (i-- > 0) {
2453
+ token._listeners[i](cancel);
2454
+ }
2455
+ token._listeners = null;
2456
+ });
2457
+ this.promise.then = (onfulfilled) => {
2458
+ let _resolve;
2459
+ const promise = new Promise((resolve) => {
2460
+ token.subscribe(resolve);
2461
+ _resolve = resolve;
2462
+ }).then(onfulfilled);
2463
+ promise.cancel = function reject() {
2464
+ token.unsubscribe(_resolve);
2465
+ };
2466
+ return promise;
2467
+ };
2468
+ executor(function cancel(message, config, request) {
2469
+ if (token.reason) {
2470
+ return;
2471
+ }
2472
+ token.reason = new CanceledError_default(message, config, request);
2473
+ resolvePromise(token.reason);
2474
+ });
2475
+ }
2476
+ /**
2477
+ * Throws a `CanceledError` if cancellation has been requested.
2478
+ */
2479
+ throwIfRequested() {
2480
+ if (this.reason) {
2481
+ throw this.reason;
2482
+ }
2483
+ }
2484
+ /**
2485
+ * Subscribe to the cancel signal
2486
+ */
2487
+ subscribe(listener) {
2488
+ if (this.reason) {
2489
+ listener(this.reason);
2490
+ return;
2491
+ }
2492
+ if (this._listeners) {
2493
+ this._listeners.push(listener);
2494
+ } else {
2495
+ this._listeners = [listener];
2496
+ }
2497
+ }
2498
+ /**
2499
+ * Unsubscribe from the cancel signal
2500
+ */
2501
+ unsubscribe(listener) {
2502
+ if (!this._listeners) {
2503
+ return;
2504
+ }
2505
+ const index = this._listeners.indexOf(listener);
2506
+ if (index !== -1) {
2507
+ this._listeners.splice(index, 1);
2508
+ }
2509
+ }
2510
+ toAbortSignal() {
2511
+ const controller = new AbortController();
2512
+ const abort = (err) => {
2513
+ controller.abort(err);
2514
+ };
2515
+ this.subscribe(abort);
2516
+ controller.signal.unsubscribe = () => this.unsubscribe(abort);
2517
+ return controller.signal;
2518
+ }
2519
+ /**
2520
+ * Returns an object that contains a new `CancelToken` and a function that, when called,
2521
+ * cancels the `CancelToken`.
2522
+ */
2523
+ static source() {
2524
+ let cancel;
2525
+ const token = new _CancelToken(function executor(c) {
2526
+ cancel = c;
2527
+ });
2528
+ return {
2529
+ token,
2530
+ cancel
2531
+ };
2532
+ }
2533
+ };
2534
+ var CancelToken_default = CancelToken;
2535
+
2536
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/helpers/spread.js
2537
+ function spread(callback) {
2538
+ return function wrap(arr) {
2539
+ return callback.apply(null, arr);
2540
+ };
2541
+ }
2542
+
2543
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/helpers/isAxiosError.js
2544
+ function isAxiosError(payload) {
2545
+ return utils_default.isObject(payload) && payload.isAxiosError === true;
2546
+ }
2547
+
2548
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/helpers/HttpStatusCode.js
2549
+ var HttpStatusCode = {
2550
+ Continue: 100,
2551
+ SwitchingProtocols: 101,
2552
+ Processing: 102,
2553
+ EarlyHints: 103,
2554
+ Ok: 200,
2555
+ Created: 201,
2556
+ Accepted: 202,
2557
+ NonAuthoritativeInformation: 203,
2558
+ NoContent: 204,
2559
+ ResetContent: 205,
2560
+ PartialContent: 206,
2561
+ MultiStatus: 207,
2562
+ AlreadyReported: 208,
2563
+ ImUsed: 226,
2564
+ MultipleChoices: 300,
2565
+ MovedPermanently: 301,
2566
+ Found: 302,
2567
+ SeeOther: 303,
2568
+ NotModified: 304,
2569
+ UseProxy: 305,
2570
+ Unused: 306,
2571
+ TemporaryRedirect: 307,
2572
+ PermanentRedirect: 308,
2573
+ BadRequest: 400,
2574
+ Unauthorized: 401,
2575
+ PaymentRequired: 402,
2576
+ Forbidden: 403,
2577
+ NotFound: 404,
2578
+ MethodNotAllowed: 405,
2579
+ NotAcceptable: 406,
2580
+ ProxyAuthenticationRequired: 407,
2581
+ RequestTimeout: 408,
2582
+ Conflict: 409,
2583
+ Gone: 410,
2584
+ LengthRequired: 411,
2585
+ PreconditionFailed: 412,
2586
+ PayloadTooLarge: 413,
2587
+ UriTooLong: 414,
2588
+ UnsupportedMediaType: 415,
2589
+ RangeNotSatisfiable: 416,
2590
+ ExpectationFailed: 417,
2591
+ ImATeapot: 418,
2592
+ MisdirectedRequest: 421,
2593
+ UnprocessableEntity: 422,
2594
+ Locked: 423,
2595
+ FailedDependency: 424,
2596
+ TooEarly: 425,
2597
+ UpgradeRequired: 426,
2598
+ PreconditionRequired: 428,
2599
+ TooManyRequests: 429,
2600
+ RequestHeaderFieldsTooLarge: 431,
2601
+ UnavailableForLegalReasons: 451,
2602
+ InternalServerError: 500,
2603
+ NotImplemented: 501,
2604
+ BadGateway: 502,
2605
+ ServiceUnavailable: 503,
2606
+ GatewayTimeout: 504,
2607
+ HttpVersionNotSupported: 505,
2608
+ VariantAlsoNegotiates: 506,
2609
+ InsufficientStorage: 507,
2610
+ LoopDetected: 508,
2611
+ NotExtended: 510,
2612
+ NetworkAuthenticationRequired: 511,
2613
+ WebServerIsDown: 521,
2614
+ ConnectionTimedOut: 522,
2615
+ OriginIsUnreachable: 523,
2616
+ TimeoutOccurred: 524,
2617
+ SslHandshakeFailed: 525,
2618
+ InvalidSslCertificate: 526
2619
+ };
2620
+ Object.entries(HttpStatusCode).forEach(([key, value]) => {
2621
+ HttpStatusCode[value] = key;
2622
+ });
2623
+ var HttpStatusCode_default = HttpStatusCode;
2624
+
2625
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/axios.js
2626
+ function createInstance(defaultConfig) {
2627
+ const context = new Axios_default(defaultConfig);
2628
+ const instance = bind(Axios_default.prototype.request, context);
2629
+ utils_default.extend(instance, Axios_default.prototype, context, { allOwnKeys: true });
2630
+ utils_default.extend(instance, context, null, { allOwnKeys: true });
2631
+ instance.create = function create(instanceConfig) {
2632
+ return createInstance(mergeConfig(defaultConfig, instanceConfig));
2633
+ };
2634
+ return instance;
2635
+ }
2636
+ var axios = createInstance(defaults_default);
2637
+ axios.Axios = Axios_default;
2638
+ axios.CanceledError = CanceledError_default;
2639
+ axios.CancelToken = CancelToken_default;
2640
+ axios.isCancel = isCancel;
2641
+ axios.VERSION = VERSION;
2642
+ axios.toFormData = toFormData_default;
2643
+ axios.AxiosError = AxiosError_default;
2644
+ axios.Cancel = axios.CanceledError;
2645
+ axios.all = function all(promises) {
2646
+ return Promise.all(promises);
2647
+ };
2648
+ axios.spread = spread;
2649
+ axios.isAxiosError = isAxiosError;
2650
+ axios.mergeConfig = mergeConfig;
2651
+ axios.AxiosHeaders = AxiosHeaders_default;
2652
+ axios.formToJSON = (thing) => formDataToJSON_default(utils_default.isHTMLForm(thing) ? new FormData(thing) : thing);
2653
+ axios.getAdapter = adapters_default.getAdapter;
2654
+ axios.HttpStatusCode = HttpStatusCode_default;
2655
+ axios.default = axios;
2656
+ var axios_default = axios;
2657
+
2658
+ // node_modules/.pnpm/axios@1.13.4/node_modules/axios/index.js
2659
+ var {
2660
+ Axios: Axios2,
2661
+ AxiosError: AxiosError2,
2662
+ CanceledError: CanceledError2,
2663
+ isCancel: isCancel2,
2664
+ CancelToken: CancelToken2,
2665
+ VERSION: VERSION2,
2666
+ all: all2,
2667
+ Cancel,
2668
+ isAxiosError: isAxiosError2,
2669
+ spread: spread2,
2670
+ toFormData: toFormData2,
2671
+ AxiosHeaders: AxiosHeaders2,
2672
+ HttpStatusCode: HttpStatusCode2,
2673
+ formToJSON,
2674
+ getAdapter: getAdapter2,
2675
+ mergeConfig: mergeConfig2
2676
+ } = axios_default;
2677
+
2678
+ // src/services/api.ts
2679
+ var import_meta = {};
2680
+ var normalizeOrigin = (raw) => {
2681
+ if (!raw)
2682
+ return "";
2683
+ if (/^https?:\/\//i.test(raw) || /^wss?:\/\//i.test(raw))
2684
+ return raw.replace(/\/$/, "");
2685
+ return `http://${raw.replace(/\/$/, "")}`;
2686
+ };
2687
+ var getApiOrigin = () => {
2688
+ try {
2689
+ if (typeof import_meta !== "undefined" && import_meta.env?.VITE_API_BASE_URL) {
2690
+ return normalizeOrigin(import_meta.env.VITE_API_BASE_URL);
2691
+ }
2692
+ } catch (e) {
2693
+ }
2694
+ if (typeof window !== "undefined") {
2695
+ const win = window;
2696
+ if (win.__VIASOFT_API_BASE_URL)
2697
+ return normalizeOrigin(win.__VIASOFT_API_BASE_URL);
2698
+ if (window.location && window.location.origin)
2699
+ return window.location.origin.replace(/\/$/, "");
2700
+ }
2701
+ return "http://localhost:3000";
2702
+ };
2703
+ var apiOrigin = getApiOrigin();
2704
+ var api = axios_default.create({
2705
+ baseURL: apiOrigin,
2706
+ timeout: 1e4
2707
+ });
2708
+ var authApi = axios_default.create({
2709
+ baseURL: apiOrigin,
2710
+ timeout: 1e4
2711
+ });
2712
+ function getAccessToken() {
2713
+ try {
2714
+ return localStorage.getItem("accessToken");
2715
+ } catch {
2716
+ return null;
2717
+ }
2718
+ }
2719
+ function setAccessToken(token) {
2720
+ try {
2721
+ if (token)
2722
+ localStorage.setItem("accessToken", token);
2723
+ else
2724
+ localStorage.removeItem("accessToken");
2725
+ } catch {
2726
+ }
2727
+ }
2728
+ function getRefreshToken() {
2729
+ try {
2730
+ return localStorage.getItem("refreshToken");
2731
+ } catch {
2732
+ return null;
2733
+ }
2734
+ }
2735
+ function setRefreshToken(token) {
2736
+ try {
2737
+ if (token)
2738
+ localStorage.setItem("refreshToken", token);
2739
+ else
2740
+ localStorage.removeItem("refreshToken");
2741
+ } catch {
2742
+ }
2743
+ }
2744
+ function clearTokens() {
2745
+ setAccessToken(null);
2746
+ setRefreshToken(null);
2747
+ }
2748
+ authApi.interceptors.request.use((config) => {
2749
+ const token = getAccessToken();
2750
+ if (token && config) {
2751
+ config.headers = config.headers || {};
2752
+ config.headers.Authorization = `Bearer ${token}`;
2753
+ }
2754
+ return config;
2755
+ });
2756
+ var isRefreshing = false;
2757
+ var refreshPromise = null;
2758
+ async function doRefreshOnce() {
2759
+ if (isRefreshing && refreshPromise)
2760
+ return refreshPromise;
2761
+ const rt = getRefreshToken();
2762
+ if (!rt)
2763
+ return null;
2764
+ isRefreshing = true;
2765
+ refreshPromise = authApi.post(
2766
+ "/refresh",
2767
+ { refreshToken: rt },
2768
+ { headers: { "Content-Type": "application/json" } }
2769
+ ).then((r) => r.data).catch(() => null).finally(() => {
2770
+ isRefreshing = false;
2771
+ refreshPromise = null;
2772
+ });
2773
+ return refreshPromise;
2774
+ }
2775
+ authApi.interceptors.response.use(
2776
+ (r) => r,
2777
+ async (err) => {
2778
+ const originalRequest = err.config || {};
2779
+ if (err.response?.status === 401 && !originalRequest._retry) {
2780
+ originalRequest._retry = true;
2781
+ const refreshed = await doRefreshOnce();
2782
+ if (!refreshed) {
2783
+ clearTokens();
2784
+ return Promise.reject(err);
2785
+ }
2786
+ setAccessToken(refreshed.token);
2787
+ setRefreshToken(refreshed.refreshToken);
2788
+ originalRequest.headers = originalRequest.headers || {};
2789
+ originalRequest.headers.Authorization = `Bearer ${refreshed.token}`;
2790
+ return authApi(originalRequest);
2791
+ }
2792
+ return Promise.reject(err);
2793
+ }
2794
+ );
2795
+ function formatAxiosError(err) {
2796
+ if (err instanceof AxiosError2) {
2797
+ const status = err.response?.status;
2798
+ const data = err.response?.data;
2799
+ return new Error(
2800
+ `Request failed${status ? ` (status ${status})` : ""}: ${err.message || JSON.stringify(data) || "unknown"}`
2801
+ );
2802
+ }
2803
+ return err instanceof Error ? err : new Error(String(err));
2804
+ }
2805
+ var fetchApi = {
2806
+ getJson: async (path, params, headers) => {
2807
+ try {
2808
+ const response = await (path.includes("/auth") ? authApi : api).get(path.replace("/auth", ""), { params, headers });
2809
+ return response.data;
2810
+ } catch (e) {
2811
+ throw formatAxiosError(e);
2812
+ }
2813
+ },
2814
+ getText: async (path, params, headers) => {
2815
+ try {
2816
+ const response = await (path.includes("/auth") ? authApi : api).get(path.replace("/auth", ""), {
2817
+ params,
2818
+ headers,
2819
+ responseType: "text"
2820
+ });
2821
+ return response.data;
2822
+ } catch (e) {
2823
+ throw formatAxiosError(e);
2824
+ }
2825
+ },
2826
+ getVoid: async (path, params, headers) => {
2827
+ try {
2828
+ await (path.includes("/auth") ? authApi : api).get(path.replace("/auth", ""), { params, headers });
2829
+ } catch (e) {
2830
+ throw formatAxiosError(e);
2831
+ }
2832
+ },
2833
+ postJson: async (path, payload, headers) => {
2834
+ try {
2835
+ const response = await (path.includes("/auth") ? authApi : api).post(path.replace("/auth", ""), payload, { headers });
2836
+ return response.data;
2837
+ } catch (e) {
2838
+ throw formatAxiosError(e);
2839
+ }
2840
+ },
2841
+ patchJson: async (path, payload, headers) => {
2842
+ try {
2843
+ const response = await (path.includes("/auth") ? authApi : api).patch(path.replace("/auth", ""), payload, { headers });
2844
+ return response.data;
2845
+ } catch (e) {
2846
+ throw formatAxiosError(e);
2847
+ }
2848
+ },
2849
+ putJson: async (path, payload, headers) => {
2850
+ try {
2851
+ const response = await (path.includes("/auth") ? authApi : api).put(path.replace("/auth", ""), payload, { headers });
2852
+ return response.data;
2853
+ } catch (e) {
2854
+ throw formatAxiosError(e);
2855
+ }
2856
+ },
2857
+ deleteJson: async (path, headers) => {
2858
+ try {
2859
+ const response = await (path.includes("/auth") ? authApi : api).delete(path.replace("/auth", ""), { headers });
2860
+ return response.data;
2861
+ } catch (e) {
2862
+ throw formatAxiosError(e);
2863
+ }
2864
+ },
2865
+ deleteVoid: async (path, headers) => {
2866
+ try {
2867
+ await (path.includes("/auth") ? authApi : api).delete(path.replace("/auth", ""), { headers });
2868
+ } catch (e) {
2869
+ throw formatAxiosError(e);
2870
+ }
2871
+ }
2872
+ };
2873
+
2874
+ // src/services/loadRemoteModule.ts
2875
+ var React = __toESM(require("react"), 1);
2876
+ var ReactDOM = __toESM(require("react-dom"), 1);
2877
+
2878
+ // src/services/metadataLoader.ts
2879
+ var MetadataLoader = class {
2880
+ constructor() {
2881
+ __publicField(this, "metadataCache", /* @__PURE__ */ new Map());
2882
+ }
2883
+ async loadMetadata(metadataUrl) {
2884
+ if (this.metadataCache.has(metadataUrl)) {
2885
+ return this.metadataCache.get(metadataUrl) || [];
2886
+ }
2887
+ try {
2888
+ const response = await fetch(metadataUrl);
2889
+ console.log(response);
2890
+ if (!response.ok) {
2891
+ throw new Error(`Failed to fetch metadata: ${response.statusText}`);
2892
+ }
2893
+ const data = await response.json();
2894
+ let metadata;
2895
+ if (Array.isArray(data)) {
2896
+ metadata = data;
2897
+ } else if (data.pages && Array.isArray(data.pages)) {
2898
+ metadata = data.pages;
2899
+ } else {
2900
+ throw new Error(
2901
+ "Invalid metadata format: expected array or object with pages property"
2902
+ );
2903
+ }
2904
+ metadata.forEach((page, index) => {
2905
+ if (!page.id || !page.name || !page.path || !page.url) {
2906
+ throw new Error(
2907
+ `Invalid page metadata at index ${index}: missing required fields`
2908
+ );
2909
+ }
2910
+ });
2911
+ this.metadataCache.set(metadataUrl, metadata);
2912
+ return metadata;
2913
+ } catch (error) {
2914
+ console.warn(`Failed to load metadata from ${metadataUrl}:`, error);
2915
+ return [];
2916
+ }
2917
+ }
2918
+ async loadFromDirectory(directoryUrl) {
2919
+ try {
2920
+ const manifestUrl = `${directoryUrl}/manifest.json`;
2921
+ return await this.loadMetadata(manifestUrl);
2922
+ } catch (error) {
2923
+ throw new Error(
2924
+ `Directory manifest not found at ${directoryUrl}/manifest.json: ${error}`
2925
+ );
2926
+ }
2927
+ }
2928
+ clearCache() {
2929
+ this.metadataCache.clear();
2930
+ }
2931
+ getCachedMetadata(metadataUrl) {
2932
+ return this.metadataCache.get(metadataUrl);
2933
+ }
2934
+ };
2935
+ var metadataLoader = new MetadataLoader();
2936
+
2937
+ // src/services/registry.ts
2938
+ var PluginRegistryImpl = class {
2939
+ constructor() {
2940
+ __publicField(this, "components", /* @__PURE__ */ new Map());
2941
+ __publicField(this, "services", /* @__PURE__ */ new Map());
2942
+ __publicField(this, "routes", []);
2943
+ __publicField(this, "pages", []);
2944
+ }
2945
+ registerComponent(name, component) {
2946
+ if (!name || !component)
2947
+ return;
2948
+ this.components.set(name, component);
2949
+ }
2950
+ getComponent(name) {
2951
+ return this.components.get(name);
2952
+ }
2953
+ registerService(name, service) {
2954
+ if (!name || service === void 0)
2955
+ return;
2956
+ this.services.set(name, service);
2957
+ }
2958
+ getService(name) {
2959
+ return this.services.get(name);
2960
+ }
2961
+ registerRoute(route) {
2962
+ if (!route || !route.path)
2963
+ return;
2964
+ this.routes.push(route);
2965
+ }
2966
+ getRoutes() {
2967
+ return [...this.routes];
2968
+ }
2969
+ registerPage(page) {
2970
+ if (!page || !page.id || !page.component)
2971
+ return;
2972
+ const existing = this.pages.findIndex((p) => p.id === page.id);
2973
+ if (existing >= 0) {
2974
+ this.pages[existing] = page;
2975
+ } else {
2976
+ this.pages.push(page);
2977
+ }
2978
+ this.components.set(page.id, page.component);
2979
+ }
2980
+ getPages() {
2981
+ return [...this.pages];
2982
+ }
2983
+ };
2984
+ var registry = new PluginRegistryImpl();
2985
+
2986
+ // src/services/hostConfig.ts
2987
+ var HostConfigLoader = class {
2988
+ constructor() {
2989
+ __publicField(this, "cache");
2990
+ }
2991
+ async loadHostConfig(url = "/config/host.json") {
2992
+ if (this.cache)
2993
+ return this.cache;
2994
+ try {
2995
+ const res = await fetch(url);
2996
+ if (!res.ok)
2997
+ throw new Error(`HTTP ${res.status}: ${res.statusText}`);
2998
+ const data = await res.json();
2999
+ this.cache = data;
3000
+ return data;
3001
+ } catch (err) {
3002
+ const fallback = {
3003
+ pluginsManifestUrl: "/plugins/manifest.json",
3004
+ defaultRoute: "/",
3005
+ staticRoutes: [],
3006
+ features: {}
3007
+ };
3008
+ this.cache = fallback;
3009
+ return fallback;
3010
+ }
3011
+ }
3012
+ clearCache() {
3013
+ this.cache = void 0;
3014
+ }
3015
+ };
3016
+ var hostConfigLoader = new HostConfigLoader();
3017
+
3018
+ // src/services/discovery.ts
3019
+ var discoveryService = {
3020
+ /**
3021
+ * GET /services/available (authenticated)
3022
+ * Returns whatever the backend provides about available services/subservices.
3023
+ */
3024
+ available: async () => {
3025
+ try {
3026
+ const data = await fetchApi.getJson("/auth/services/available");
3027
+ return data;
3028
+ } catch (err) {
3029
+ console.error("Failed to fetch available services:", err);
3030
+ throw err;
3031
+ }
3032
+ }
3033
+ };
3034
+
3035
+ // src/hooks/useSettings.ts
3036
+ function useSettings(defaultSettings, options) {
3037
+ const {
3038
+ queryKey,
3039
+ fetchPath,
3040
+ savePath = fetchPath,
3041
+ fetchParams,
3042
+ transform = (data2) => data2,
3043
+ toPayload = (settings2) => settings2,
3044
+ saveMethod = "patch",
3045
+ enabled = true,
3046
+ refetchInterval
3047
+ } = options;
3048
+ const queryClient = (0, import_react_query.useQueryClient)();
3049
+ const [settings, setSettings] = (0, import_react.useState)(defaultSettings);
3050
+ const [savedSettings, setSavedSettings] = (0, import_react.useState)(defaultSettings);
3051
+ const {
3052
+ data,
3053
+ isLoading,
3054
+ error: fetchError,
3055
+ refetch
3056
+ } = (0, import_react_query.useQuery)({
3057
+ queryKey,
3058
+ queryFn: async () => {
3059
+ const raw = await fetchApi.getJson(fetchPath, fetchParams);
3060
+ return transform(raw);
3061
+ },
3062
+ enabled,
3063
+ refetchInterval
3064
+ });
3065
+ (0, import_react.useEffect)(() => {
3066
+ if (data) {
3067
+ setSettings(data);
3068
+ setSavedSettings(data);
3069
+ }
3070
+ }, [data]);
3071
+ const saveMutation = (0, import_react_query.useMutation)({
3072
+ mutationFn: async (payload) => {
3073
+ switch (saveMethod) {
3074
+ case "put":
3075
+ return fetchApi.putJson(savePath, payload);
3076
+ case "post":
3077
+ return fetchApi.postJson(savePath, payload);
3078
+ default:
3079
+ return fetchApi.patchJson(savePath, payload);
3080
+ }
3081
+ },
3082
+ onSuccess: () => {
3083
+ setSavedSettings(settings);
3084
+ queryClient.invalidateQueries({ queryKey });
3085
+ }
3086
+ });
3087
+ const isDirty = (0, import_react.useMemo)(
3088
+ () => JSON.stringify(settings) !== JSON.stringify(savedSettings),
3089
+ [settings, savedSettings]
3090
+ );
3091
+ const updateField = (0, import_react.useCallback)((key, value) => {
3092
+ setSettings((prev) => ({ ...prev, [key]: value }));
3093
+ }, []);
3094
+ const updateSettings = (0, import_react.useCallback)((partial) => {
3095
+ setSettings((prev) => ({ ...prev, ...partial }));
3096
+ }, []);
3097
+ const discard = (0, import_react.useCallback)(() => {
3098
+ setSettings(savedSettings);
3099
+ }, [savedSettings]);
3100
+ const save = (0, import_react.useCallback)(async () => {
3101
+ const payload = toPayload(settings);
3102
+ await saveMutation.mutateAsync(payload);
3103
+ }, [settings, toPayload, saveMutation]);
3104
+ return {
3105
+ settings,
3106
+ savedSettings,
3107
+ updateField,
3108
+ updateSettings,
3109
+ discard,
3110
+ save,
3111
+ isDirty,
3112
+ isLoading,
3113
+ isSaving: saveMutation.isPending,
3114
+ error: fetchError || saveMutation.error || null,
3115
+ refetch
3116
+ };
3117
+ }
3118
+
3119
+ // src/hooks/useApi.ts
3120
+ var import_react_query2 = require("@tanstack/react-query");
3121
+ function useApi(type, key, path, params, enabled = true, refetchInterval) {
3122
+ return (0, import_react_query2.useQuery)({
3123
+ queryKey: key,
3124
+ queryFn: () => {
3125
+ switch (type) {
3126
+ case "json":
3127
+ return fetchApi.getJson(path, params);
3128
+ case "text":
3129
+ return fetchApi.getText(path, params);
3130
+ default:
3131
+ return fetchApi.getJson(path, params);
3132
+ }
3133
+ },
3134
+ enabled,
3135
+ refetchInterval
3136
+ });
3137
+ }
3138
+
3139
+ // src/hooks/useAvailableSubservices.ts
3140
+ var import_react2 = require("react");
3141
+ function useAvailableSubservices(serviceKey, fallbackCount = 4) {
3142
+ const [options, setOptions] = (0, import_react2.useState)(
3143
+ Array.from({ length: fallbackCount }).map((_, i) => ({ label: `Channel ${i + 1}`, value: `${i}` }))
3144
+ );
3145
+ const [loading, setLoading] = (0, import_react2.useState)(false);
3146
+ (0, import_react2.useEffect)(() => {
3147
+ let mounted = true;
3148
+ (async () => {
3149
+ setLoading(true);
3150
+ try {
3151
+ const data = await discoveryService.available();
3152
+ if (!mounted)
3153
+ return;
3154
+ let list;
3155
+ if (data && Array.isArray(data[serviceKey]))
3156
+ list = data[serviceKey];
3157
+ else if (data && data.services && Array.isArray(data.services[serviceKey]))
3158
+ list = data.services[serviceKey];
3159
+ else if (data && Array.isArray(data.available)) {
3160
+ const found = data.available.find((s) => s.service === serviceKey || s.key === serviceKey || s.id === serviceKey);
3161
+ if (found && Array.isArray(found.subservices))
3162
+ list = found.subservices;
3163
+ }
3164
+ if (Array.isArray(list) && list.length > 0) {
3165
+ const mapped = list.map((item, idx) => ({
3166
+ label: item.label || item.name || `Channel ${idx + 1}`,
3167
+ value: `${idx}`
3168
+ }));
3169
+ setOptions(mapped);
3170
+ }
3171
+ } catch (e) {
3172
+ } finally {
3173
+ if (mounted)
3174
+ setLoading(false);
3175
+ }
3176
+ })();
3177
+ return () => {
3178
+ mounted = false;
3179
+ };
3180
+ }, [serviceKey, fallbackCount]);
3181
+ return { options, loading };
3182
+ }