@stacksjs/browser 0.70.22 → 0.70.23

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.
@@ -0,0 +1,103 @@
1
+ declare interface Params {
2
+ [key: string]: any
3
+ }
4
+ declare interface ApiFetch {
5
+ get: (url: string, params?: Params, header?: Headers) => Promise<FetchResponse>
6
+ post: (url: string, params?: Params, header?: Headers) => Promise<FetchResponse>
7
+ destroy: (url: string, params?: Params, header?: Headers) => Promise<FetchResponse>
8
+ patch: (url: string, params?: Params, header?: Headers) => Promise<FetchResponse>
9
+ put: (url: string, params?: Params, header?: Headers) => Promise<FetchResponse>
10
+ setToken: (authToken: string) => void
11
+ baseURL: '/' | string
12
+ loading: boolean
13
+ token: string
14
+ }
15
+ declare type FetchResponse = string | Blob | ArrayBuffer | ReadableStream<Uint8Array>
16
+
17
+ let loading = false
18
+ let token = ''
19
+ const baseURL = '/'
20
+
21
+ async function get(url: string, params?: Params, headers?: Headers): Promise<FetchResponse> {
22
+ if (headers) {
23
+ if (token)
24
+ headers.set('Authorization', `Bearer ${token}`)
25
+ }
26
+
27
+ return await ofetch(url, { method: 'GET', baseURL, params, headers })
28
+ }
29
+
30
+ async function post(url: string, params?: Params, headers?: Headers): Promise<any> {
31
+ if (headers) {
32
+ if (token)
33
+ headers.set('Authorization', `Bearer ${token}`)
34
+ }
35
+
36
+ loading = true
37
+
38
+ try {
39
+ const result: string | FetchResponse | Blob | ArrayBuffer | ReadableStream<Uint8Array> = await ofetch(url, {
40
+ method: 'POST',
41
+ baseURL,
42
+ params,
43
+ headers,
44
+ })
45
+
46
+ loading = false
47
+ return result
48
+ }
49
+ catch (err: any) {
50
+ loading = false
51
+
52
+ throw err
53
+ }
54
+ }
55
+
56
+ async function patch(url: string, params?: Params, headers?: Headers): Promise<FetchResponse> {
57
+ if (headers) {
58
+ if (token)
59
+ headers.set('Authorization', `Bearer ${token}`)
60
+ }
61
+
62
+ loading = true
63
+
64
+ return await ofetch(url, {
65
+ method: 'PATCH',
66
+ baseURL,
67
+ params,
68
+ headers,
69
+ })
70
+ }
71
+
72
+ async function put(url: string, params?: Params, headers?: Headers): Promise<FetchResponse> {
73
+ if (headers) {
74
+ if (token)
75
+ headers.set('Authorization', `Bearer ${token}`)
76
+ }
77
+
78
+ loading = true
79
+
80
+ return await ofetch(url, {
81
+ method: 'PUT',
82
+ baseURL,
83
+ params,
84
+ headers,
85
+ })
86
+ }
87
+
88
+ async function destroy(url: string, params?: Params, headers?: Headers): Promise<FetchResponse> {
89
+ if (headers) {
90
+ if (token)
91
+ headers.set('Authorization', `Bearer ${token}`)
92
+ }
93
+
94
+ loading = true
95
+
96
+ return await ofetch(url, {
97
+ method: 'DELETE',
98
+ baseURL,
99
+ params,
100
+ headers,
101
+ })
102
+ }
103
+ declare function setToken(authToken: string): void;
package/dist/index.js CHANGED
@@ -1403,14 +1403,681 @@ function debounce(fn, wait = 25, options = {}) {
1403
1403
  async function _applyPromised(fn, _this, args) {
1404
1404
  return await fn.apply(_this, args);
1405
1405
  }
1406
- // src/utils/function.ts
1407
- function batchInvoke(functions) {
1408
- functions.forEach((fn) => fn?.());
1409
- }
1410
- function tap(value, callback) {
1411
- callback(value);
1406
+ // ../../../../node_modules/destr/dist/index.mjs
1407
+ var suspectProtoRx = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/;
1408
+ var suspectConstructorRx = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
1409
+ var JsonSigRx = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;
1410
+ function jsonParseTransform(key, value) {
1411
+ if (key === "__proto__" || key === "constructor" && value && typeof value === "object" && "prototype" in value) {
1412
+ warnKeyDropped(key);
1413
+ return;
1414
+ }
1412
1415
  return value;
1413
1416
  }
1417
+ function warnKeyDropped(key) {
1418
+ console.warn(`[destr] Dropping "${key}" key to prevent prototype pollution.`);
1419
+ }
1420
+ function destr(value, options = {}) {
1421
+ if (typeof value !== "string") {
1422
+ return value;
1423
+ }
1424
+ const _value = value.trim();
1425
+ if (value[0] === '"' && value.endsWith('"') && !value.includes("\\")) {
1426
+ return _value.slice(1, -1);
1427
+ }
1428
+ if (_value.length <= 9) {
1429
+ const _lval = _value.toLowerCase();
1430
+ if (_lval === "true") {
1431
+ return true;
1432
+ }
1433
+ if (_lval === "false") {
1434
+ return false;
1435
+ }
1436
+ if (_lval === "undefined") {
1437
+ return;
1438
+ }
1439
+ if (_lval === "null") {
1440
+ return null;
1441
+ }
1442
+ if (_lval === "nan") {
1443
+ return Number.NaN;
1444
+ }
1445
+ if (_lval === "infinity") {
1446
+ return Number.POSITIVE_INFINITY;
1447
+ }
1448
+ if (_lval === "-infinity") {
1449
+ return Number.NEGATIVE_INFINITY;
1450
+ }
1451
+ }
1452
+ if (!JsonSigRx.test(value)) {
1453
+ if (options.strict) {
1454
+ throw new SyntaxError("[destr] Invalid JSON");
1455
+ }
1456
+ return value;
1457
+ }
1458
+ try {
1459
+ if (suspectProtoRx.test(value) || suspectConstructorRx.test(value)) {
1460
+ if (options.strict) {
1461
+ throw new Error("[destr] Possible prototype pollution");
1462
+ }
1463
+ return JSON.parse(value, jsonParseTransform);
1464
+ }
1465
+ return JSON.parse(value);
1466
+ } catch (error) {
1467
+ if (options.strict) {
1468
+ throw error;
1469
+ }
1470
+ return value;
1471
+ }
1472
+ }
1473
+
1474
+ // ../../../../node_modules/ufo/dist/index.mjs
1475
+ var r = String.fromCharCode;
1476
+ var HASH_RE = /#/g;
1477
+ var AMPERSAND_RE = /&/g;
1478
+ var SLASH_RE = /\//g;
1479
+ var EQUAL_RE = /=/g;
1480
+ var PLUS_RE = /\+/g;
1481
+ var ENC_CARET_RE = /%5e/gi;
1482
+ var ENC_BACKTICK_RE = /%60/gi;
1483
+ var ENC_PIPE_RE = /%7c/gi;
1484
+ var ENC_SPACE_RE = /%20/gi;
1485
+ function encode(text) {
1486
+ return encodeURI("" + text).replace(ENC_PIPE_RE, "|");
1487
+ }
1488
+ function encodeQueryValue(input) {
1489
+ return encode(typeof input === "string" ? input : JSON.stringify(input)).replace(PLUS_RE, "%2B").replace(ENC_SPACE_RE, "+").replace(HASH_RE, "%23").replace(AMPERSAND_RE, "%26").replace(ENC_BACKTICK_RE, "`").replace(ENC_CARET_RE, "^").replace(SLASH_RE, "%2F");
1490
+ }
1491
+ function encodeQueryKey(text) {
1492
+ return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
1493
+ }
1494
+ function decode(text = "") {
1495
+ try {
1496
+ return decodeURIComponent("" + text);
1497
+ } catch {
1498
+ return "" + text;
1499
+ }
1500
+ }
1501
+ function decodeQueryKey(text) {
1502
+ return decode(text.replace(PLUS_RE, " "));
1503
+ }
1504
+ function decodeQueryValue(text) {
1505
+ return decode(text.replace(PLUS_RE, " "));
1506
+ }
1507
+ function parseQuery(parametersString = "") {
1508
+ const object = {};
1509
+ if (parametersString[0] === "?") {
1510
+ parametersString = parametersString.slice(1);
1511
+ }
1512
+ for (const parameter of parametersString.split("&")) {
1513
+ const s = parameter.match(/([^=]+)=?(.*)/) || [];
1514
+ if (s.length < 2) {
1515
+ continue;
1516
+ }
1517
+ const key = decodeQueryKey(s[1]);
1518
+ if (key === "__proto__" || key === "constructor") {
1519
+ continue;
1520
+ }
1521
+ const value = decodeQueryValue(s[2] || "");
1522
+ if (object[key] === undefined) {
1523
+ object[key] = value;
1524
+ } else if (Array.isArray(object[key])) {
1525
+ object[key].push(value);
1526
+ } else {
1527
+ object[key] = [object[key], value];
1528
+ }
1529
+ }
1530
+ return object;
1531
+ }
1532
+ function encodeQueryItem(key, value) {
1533
+ if (typeof value === "number" || typeof value === "boolean") {
1534
+ value = String(value);
1535
+ }
1536
+ if (!value) {
1537
+ return encodeQueryKey(key);
1538
+ }
1539
+ if (Array.isArray(value)) {
1540
+ return value.map((_value) => `${encodeQueryKey(key)}=${encodeQueryValue(_value)}`).join("&");
1541
+ }
1542
+ return `${encodeQueryKey(key)}=${encodeQueryValue(value)}`;
1543
+ }
1544
+ function stringifyQuery(query) {
1545
+ return Object.keys(query).filter((k) => query[k] !== undefined).map((k) => encodeQueryItem(k, query[k])).filter(Boolean).join("&");
1546
+ }
1547
+ var PROTOCOL_STRICT_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{1,2})/;
1548
+ var PROTOCOL_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{2})?/;
1549
+ var PROTOCOL_RELATIVE_REGEX = /^([/\\]\s*){2,}[^/\\]/;
1550
+ var TRAILING_SLASH_RE = /\/$|\/\?|\/#/;
1551
+ var JOIN_LEADING_SLASH_RE = /^\.?\//;
1552
+ function hasProtocol(inputString, opts = {}) {
1553
+ if (typeof opts === "boolean") {
1554
+ opts = { acceptRelative: opts };
1555
+ }
1556
+ if (opts.strict) {
1557
+ return PROTOCOL_STRICT_REGEX.test(inputString);
1558
+ }
1559
+ return PROTOCOL_REGEX.test(inputString) || (opts.acceptRelative ? PROTOCOL_RELATIVE_REGEX.test(inputString) : false);
1560
+ }
1561
+ function hasTrailingSlash(input = "", respectQueryAndFragment) {
1562
+ if (!respectQueryAndFragment) {
1563
+ return input.endsWith("/");
1564
+ }
1565
+ return TRAILING_SLASH_RE.test(input);
1566
+ }
1567
+ function withoutTrailingSlash(input = "", respectQueryAndFragment) {
1568
+ if (!respectQueryAndFragment) {
1569
+ return (hasTrailingSlash(input) ? input.slice(0, -1) : input) || "/";
1570
+ }
1571
+ if (!hasTrailingSlash(input, true)) {
1572
+ return input || "/";
1573
+ }
1574
+ let path = input;
1575
+ let fragment = "";
1576
+ const fragmentIndex = input.indexOf("#");
1577
+ if (fragmentIndex >= 0) {
1578
+ path = input.slice(0, fragmentIndex);
1579
+ fragment = input.slice(fragmentIndex);
1580
+ }
1581
+ const [s0, ...s] = path.split("?");
1582
+ const cleanPath = s0.endsWith("/") ? s0.slice(0, -1) : s0;
1583
+ return (cleanPath || "/") + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
1584
+ }
1585
+ function withTrailingSlash(input = "", respectQueryAndFragment) {
1586
+ if (!respectQueryAndFragment) {
1587
+ return input.endsWith("/") ? input : input + "/";
1588
+ }
1589
+ if (hasTrailingSlash(input, true)) {
1590
+ return input || "/";
1591
+ }
1592
+ let path = input;
1593
+ let fragment = "";
1594
+ const fragmentIndex = input.indexOf("#");
1595
+ if (fragmentIndex >= 0) {
1596
+ path = input.slice(0, fragmentIndex);
1597
+ fragment = input.slice(fragmentIndex);
1598
+ if (!path) {
1599
+ return fragment;
1600
+ }
1601
+ }
1602
+ const [s0, ...s] = path.split("?");
1603
+ return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
1604
+ }
1605
+ function withBase(input, base) {
1606
+ if (isEmptyURL(base) || hasProtocol(input)) {
1607
+ return input;
1608
+ }
1609
+ const _base = withoutTrailingSlash(base);
1610
+ if (input.startsWith(_base)) {
1611
+ return input;
1612
+ }
1613
+ return joinURL(_base, input);
1614
+ }
1615
+ function withQuery(input, query) {
1616
+ const parsed = parseURL(input);
1617
+ const mergedQuery = { ...parseQuery(parsed.search), ...query };
1618
+ parsed.search = stringifyQuery(mergedQuery);
1619
+ return stringifyParsedURL(parsed);
1620
+ }
1621
+ function isEmptyURL(url) {
1622
+ return !url || url === "/";
1623
+ }
1624
+ function isNonEmptyURL(url) {
1625
+ return url && url !== "/";
1626
+ }
1627
+ function joinURL(base, ...input) {
1628
+ let url = base || "";
1629
+ for (const segment of input.filter((url2) => isNonEmptyURL(url2))) {
1630
+ if (url) {
1631
+ const _segment = segment.replace(JOIN_LEADING_SLASH_RE, "");
1632
+ url = withTrailingSlash(url) + _segment;
1633
+ } else {
1634
+ url = segment;
1635
+ }
1636
+ }
1637
+ return url;
1638
+ }
1639
+ var protocolRelative = Symbol.for("ufo:protocolRelative");
1640
+ function parseURL(input = "", defaultProto) {
1641
+ const _specialProtoMatch = input.match(/^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i);
1642
+ if (_specialProtoMatch) {
1643
+ const [, _proto, _pathname = ""] = _specialProtoMatch;
1644
+ return {
1645
+ protocol: _proto.toLowerCase(),
1646
+ pathname: _pathname,
1647
+ href: _proto + _pathname,
1648
+ auth: "",
1649
+ host: "",
1650
+ search: "",
1651
+ hash: ""
1652
+ };
1653
+ }
1654
+ if (!hasProtocol(input, { acceptRelative: true })) {
1655
+ return defaultProto ? parseURL(defaultProto + input) : parsePath(input);
1656
+ }
1657
+ const [, protocol = "", auth, hostAndPath = ""] = input.replace(/\\/g, "/").match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/) || [];
1658
+ let [, host = "", path = ""] = hostAndPath.match(/([^#/?]*)(.*)?/) || [];
1659
+ if (protocol === "file:") {
1660
+ path = path.replace(/\/(?=[A-Za-z]:)/, "");
1661
+ }
1662
+ const { pathname, search, hash } = parsePath(path);
1663
+ return {
1664
+ protocol: protocol.toLowerCase(),
1665
+ auth: auth ? auth.slice(0, Math.max(0, auth.length - 1)) : "",
1666
+ host,
1667
+ pathname,
1668
+ search,
1669
+ hash,
1670
+ [protocolRelative]: !protocol
1671
+ };
1672
+ }
1673
+ function parsePath(input = "") {
1674
+ const [pathname = "", search = "", hash = ""] = (input.match(/([^#?]*)(\?[^#]*)?(#.*)?/) || []).splice(1);
1675
+ return {
1676
+ pathname,
1677
+ search,
1678
+ hash
1679
+ };
1680
+ }
1681
+ function stringifyParsedURL(parsed) {
1682
+ const pathname = parsed.pathname || "";
1683
+ const search = parsed.search ? (parsed.search.startsWith("?") ? "" : "?") + parsed.search : "";
1684
+ const hash = parsed.hash || "";
1685
+ const auth = parsed.auth ? parsed.auth + "@" : "";
1686
+ const host = parsed.host || "";
1687
+ const proto = parsed.protocol || parsed[protocolRelative] ? (parsed.protocol || "") + "//" : "";
1688
+ return proto + auth + host + pathname + search + hash;
1689
+ }
1690
+
1691
+ // ../../../../node_modules/ofetch/dist/shared/ofetch.03887fc3.mjs
1692
+ class FetchError extends Error {
1693
+ constructor(message, opts) {
1694
+ super(message, opts);
1695
+ this.name = "FetchError";
1696
+ if (opts?.cause && !this.cause) {
1697
+ this.cause = opts.cause;
1698
+ }
1699
+ }
1700
+ }
1701
+ function createFetchError(ctx) {
1702
+ const errorMessage = ctx.error?.message || ctx.error?.toString() || "";
1703
+ const method = ctx.request?.method || ctx.options?.method || "GET";
1704
+ const url = ctx.request?.url || String(ctx.request) || "/";
1705
+ const requestStr = `[${method}] ${JSON.stringify(url)}`;
1706
+ const statusStr = ctx.response ? `${ctx.response.status} ${ctx.response.statusText}` : "<no response>";
1707
+ const message = `${requestStr}: ${statusStr}${errorMessage ? ` ${errorMessage}` : ""}`;
1708
+ const fetchError = new FetchError(message, ctx.error ? { cause: ctx.error } : undefined);
1709
+ for (const key of ["request", "options", "response"]) {
1710
+ Object.defineProperty(fetchError, key, {
1711
+ get() {
1712
+ return ctx[key];
1713
+ }
1714
+ });
1715
+ }
1716
+ for (const [key, refKey] of [
1717
+ ["data", "_data"],
1718
+ ["status", "status"],
1719
+ ["statusCode", "status"],
1720
+ ["statusText", "statusText"],
1721
+ ["statusMessage", "statusText"]
1722
+ ]) {
1723
+ Object.defineProperty(fetchError, key, {
1724
+ get() {
1725
+ return ctx.response && ctx.response[refKey];
1726
+ }
1727
+ });
1728
+ }
1729
+ return fetchError;
1730
+ }
1731
+ var payloadMethods = new Set(Object.freeze(["PATCH", "POST", "PUT", "DELETE"]));
1732
+ function isPayloadMethod(method = "GET") {
1733
+ return payloadMethods.has(method.toUpperCase());
1734
+ }
1735
+ function isJSONSerializable(value) {
1736
+ if (value === undefined) {
1737
+ return false;
1738
+ }
1739
+ const t = typeof value;
1740
+ if (t === "string" || t === "number" || t === "boolean" || t === null) {
1741
+ return true;
1742
+ }
1743
+ if (t !== "object") {
1744
+ return false;
1745
+ }
1746
+ if (Array.isArray(value)) {
1747
+ return true;
1748
+ }
1749
+ if (value.buffer) {
1750
+ return false;
1751
+ }
1752
+ return value.constructor && value.constructor.name === "Object" || typeof value.toJSON === "function";
1753
+ }
1754
+ var textTypes = /* @__PURE__ */ new Set([
1755
+ "image/svg",
1756
+ "application/xml",
1757
+ "application/xhtml",
1758
+ "application/html"
1759
+ ]);
1760
+ var JSON_RE = /^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;
1761
+ function detectResponseType(_contentType = "") {
1762
+ if (!_contentType) {
1763
+ return "json";
1764
+ }
1765
+ const contentType = _contentType.split(";").shift() || "";
1766
+ if (JSON_RE.test(contentType)) {
1767
+ return "json";
1768
+ }
1769
+ if (textTypes.has(contentType) || contentType.startsWith("text/")) {
1770
+ return "text";
1771
+ }
1772
+ return "blob";
1773
+ }
1774
+ function resolveFetchOptions(request, input, defaults, Headers2) {
1775
+ const headers = mergeHeaders(input?.headers ?? request?.headers, defaults?.headers, Headers2);
1776
+ let query;
1777
+ if (defaults?.query || defaults?.params || input?.params || input?.query) {
1778
+ query = {
1779
+ ...defaults?.params,
1780
+ ...defaults?.query,
1781
+ ...input?.params,
1782
+ ...input?.query
1783
+ };
1784
+ }
1785
+ return {
1786
+ ...defaults,
1787
+ ...input,
1788
+ query,
1789
+ params: query,
1790
+ headers
1791
+ };
1792
+ }
1793
+ function mergeHeaders(input, defaults, Headers2) {
1794
+ if (!defaults) {
1795
+ return new Headers2(input);
1796
+ }
1797
+ const headers = new Headers2(defaults);
1798
+ if (input) {
1799
+ for (const [key, value] of Symbol.iterator in input || Array.isArray(input) ? input : new Headers2(input)) {
1800
+ headers.set(key, value);
1801
+ }
1802
+ }
1803
+ return headers;
1804
+ }
1805
+ async function callHooks(context, hooks) {
1806
+ if (hooks) {
1807
+ if (Array.isArray(hooks)) {
1808
+ for (const hook of hooks) {
1809
+ await hook(context);
1810
+ }
1811
+ } else {
1812
+ await hooks(context);
1813
+ }
1814
+ }
1815
+ }
1816
+ var retryStatusCodes = /* @__PURE__ */ new Set([
1817
+ 408,
1818
+ 409,
1819
+ 425,
1820
+ 429,
1821
+ 500,
1822
+ 502,
1823
+ 503,
1824
+ 504
1825
+ ]);
1826
+ var nullBodyResponses = /* @__PURE__ */ new Set([101, 204, 205, 304]);
1827
+ function createFetch(globalOptions = {}) {
1828
+ const {
1829
+ fetch = globalThis.fetch,
1830
+ Headers: Headers2 = globalThis.Headers,
1831
+ AbortController: AbortController2 = globalThis.AbortController
1832
+ } = globalOptions;
1833
+ async function onError3(context) {
1834
+ const isAbort = context.error && context.error.name === "AbortError" && !context.options.timeout || false;
1835
+ if (context.options.retry !== false && !isAbort) {
1836
+ let retries;
1837
+ if (typeof context.options.retry === "number") {
1838
+ retries = context.options.retry;
1839
+ } else {
1840
+ retries = isPayloadMethod(context.options.method) ? 0 : 1;
1841
+ }
1842
+ const responseCode = context.response && context.response.status || 500;
1843
+ if (retries > 0 && (Array.isArray(context.options.retryStatusCodes) ? context.options.retryStatusCodes.includes(responseCode) : retryStatusCodes.has(responseCode))) {
1844
+ const retryDelay = typeof context.options.retryDelay === "function" ? context.options.retryDelay(context) : context.options.retryDelay || 0;
1845
+ if (retryDelay > 0) {
1846
+ await new Promise((resolve) => setTimeout(resolve, retryDelay));
1847
+ }
1848
+ return $fetchRaw(context.request, {
1849
+ ...context.options,
1850
+ retry: retries - 1
1851
+ });
1852
+ }
1853
+ }
1854
+ const error = createFetchError(context);
1855
+ if (Error.captureStackTrace) {
1856
+ Error.captureStackTrace(error, $fetchRaw);
1857
+ }
1858
+ throw error;
1859
+ }
1860
+ const $fetchRaw = async function $fetchRaw2(_request, _options = {}) {
1861
+ const context = {
1862
+ request: _request,
1863
+ options: resolveFetchOptions(_request, _options, globalOptions.defaults, Headers2),
1864
+ response: undefined,
1865
+ error: undefined
1866
+ };
1867
+ if (context.options.method) {
1868
+ context.options.method = context.options.method.toUpperCase();
1869
+ }
1870
+ if (context.options.onRequest) {
1871
+ await callHooks(context, context.options.onRequest);
1872
+ }
1873
+ if (typeof context.request === "string") {
1874
+ if (context.options.baseURL) {
1875
+ context.request = withBase(context.request, context.options.baseURL);
1876
+ }
1877
+ if (context.options.query) {
1878
+ context.request = withQuery(context.request, context.options.query);
1879
+ delete context.options.query;
1880
+ }
1881
+ if ("query" in context.options) {
1882
+ delete context.options.query;
1883
+ }
1884
+ if ("params" in context.options) {
1885
+ delete context.options.params;
1886
+ }
1887
+ }
1888
+ if (context.options.body && isPayloadMethod(context.options.method)) {
1889
+ if (isJSONSerializable(context.options.body)) {
1890
+ context.options.body = typeof context.options.body === "string" ? context.options.body : JSON.stringify(context.options.body);
1891
+ context.options.headers = new Headers2(context.options.headers || {});
1892
+ if (!context.options.headers.has("content-type")) {
1893
+ context.options.headers.set("content-type", "application/json");
1894
+ }
1895
+ if (!context.options.headers.has("accept")) {
1896
+ context.options.headers.set("accept", "application/json");
1897
+ }
1898
+ } else if ("pipeTo" in context.options.body && typeof context.options.body.pipeTo === "function" || typeof context.options.body.pipe === "function") {
1899
+ if (!("duplex" in context.options)) {
1900
+ context.options.duplex = "half";
1901
+ }
1902
+ }
1903
+ }
1904
+ let abortTimeout;
1905
+ if (!context.options.signal && context.options.timeout) {
1906
+ const controller = new AbortController2;
1907
+ abortTimeout = setTimeout(() => {
1908
+ const error = new Error("[TimeoutError]: The operation was aborted due to timeout");
1909
+ error.name = "TimeoutError";
1910
+ error.code = 23;
1911
+ controller.abort(error);
1912
+ }, context.options.timeout);
1913
+ context.options.signal = controller.signal;
1914
+ }
1915
+ try {
1916
+ context.response = await fetch(context.request, context.options);
1917
+ } catch (error) {
1918
+ context.error = error;
1919
+ if (context.options.onRequestError) {
1920
+ await callHooks(context, context.options.onRequestError);
1921
+ }
1922
+ return await onError3(context);
1923
+ } finally {
1924
+ if (abortTimeout) {
1925
+ clearTimeout(abortTimeout);
1926
+ }
1927
+ }
1928
+ const hasBody = (context.response.body || context.response._bodyInit) && !nullBodyResponses.has(context.response.status) && context.options.method !== "HEAD";
1929
+ if (hasBody) {
1930
+ const responseType = (context.options.parseResponse ? "json" : context.options.responseType) || detectResponseType(context.response.headers.get("content-type") || "");
1931
+ switch (responseType) {
1932
+ case "json": {
1933
+ const data = await context.response.text();
1934
+ const parseFunction = context.options.parseResponse || destr;
1935
+ context.response._data = parseFunction(data);
1936
+ break;
1937
+ }
1938
+ case "stream": {
1939
+ context.response._data = context.response.body || context.response._bodyInit;
1940
+ break;
1941
+ }
1942
+ default: {
1943
+ context.response._data = await context.response[responseType]();
1944
+ }
1945
+ }
1946
+ }
1947
+ if (context.options.onResponse) {
1948
+ await callHooks(context, context.options.onResponse);
1949
+ }
1950
+ if (!context.options.ignoreResponseError && context.response.status >= 400 && context.response.status < 600) {
1951
+ if (context.options.onResponseError) {
1952
+ await callHooks(context, context.options.onResponseError);
1953
+ }
1954
+ return await onError3(context);
1955
+ }
1956
+ return context.response;
1957
+ };
1958
+ const $fetch = async function $fetch2(request, options) {
1959
+ const r2 = await $fetchRaw(request, options);
1960
+ return r2._data;
1961
+ };
1962
+ $fetch.raw = $fetchRaw;
1963
+ $fetch.native = (...args) => fetch(...args);
1964
+ $fetch.create = (defaultOptions = {}, customGlobalOptions = {}) => createFetch({
1965
+ ...globalOptions,
1966
+ ...customGlobalOptions,
1967
+ defaults: {
1968
+ ...globalOptions.defaults,
1969
+ ...customGlobalOptions.defaults,
1970
+ ...defaultOptions
1971
+ }
1972
+ });
1973
+ return $fetch;
1974
+ }
1975
+
1976
+ // ../../../../node_modules/ofetch/dist/index.mjs
1977
+ var _globalThis = function() {
1978
+ if (typeof globalThis !== "undefined") {
1979
+ return globalThis;
1980
+ }
1981
+ if (typeof self !== "undefined") {
1982
+ return self;
1983
+ }
1984
+ if (typeof window !== "undefined") {
1985
+ return window;
1986
+ }
1987
+ if (typeof global !== "undefined") {
1988
+ return global;
1989
+ }
1990
+ throw new Error("unable to locate global object");
1991
+ }();
1992
+ var fetch = _globalThis.fetch ? (...args) => _globalThis.fetch(...args) : () => Promise.reject(new Error("[ofetch] global.fetch is not supported!"));
1993
+ var Headers2 = _globalThis.Headers;
1994
+ var AbortController2 = _globalThis.AbortController;
1995
+ var ofetch = createFetch({ fetch, Headers: Headers2, AbortController: AbortController2 });
1996
+
1997
+ // src/utils/fetch.ts
1998
+ var loading = false;
1999
+ var token = "";
2000
+ var baseURL = "/";
2001
+ async function get(url, params, headers) {
2002
+ if (headers) {
2003
+ if (token)
2004
+ headers.set("Authorization", `Bearer ${token}`);
2005
+ }
2006
+ return await ofetch(url, { method: "GET", baseURL, params, headers });
2007
+ }
2008
+ async function post(url, params, headers) {
2009
+ if (headers) {
2010
+ if (token)
2011
+ headers.set("Authorization", `Bearer ${token}`);
2012
+ }
2013
+ loading = true;
2014
+ try {
2015
+ const result = await ofetch(url, {
2016
+ method: "POST",
2017
+ baseURL,
2018
+ params,
2019
+ headers
2020
+ });
2021
+ loading = false;
2022
+ return result;
2023
+ } catch (err) {
2024
+ loading = false;
2025
+ throw err;
2026
+ }
2027
+ }
2028
+ async function patch(url, params, headers) {
2029
+ if (headers) {
2030
+ if (token)
2031
+ headers.set("Authorization", `Bearer ${token}`);
2032
+ }
2033
+ loading = true;
2034
+ return await ofetch(url, {
2035
+ method: "PATCH",
2036
+ baseURL,
2037
+ params,
2038
+ headers
2039
+ });
2040
+ }
2041
+ async function put(url, params, headers) {
2042
+ if (headers) {
2043
+ if (token)
2044
+ headers.set("Authorization", `Bearer ${token}`);
2045
+ }
2046
+ loading = true;
2047
+ return await ofetch(url, {
2048
+ method: "PUT",
2049
+ baseURL,
2050
+ params,
2051
+ headers
2052
+ });
2053
+ }
2054
+ async function destroy(url, params, headers) {
2055
+ if (headers) {
2056
+ if (token)
2057
+ headers.set("Authorization", `Bearer ${token}`);
2058
+ }
2059
+ loading = true;
2060
+ return await ofetch(url, {
2061
+ method: "DELETE",
2062
+ baseURL,
2063
+ params,
2064
+ headers
2065
+ });
2066
+ }
2067
+ function setToken(authToken) {
2068
+ token = authToken;
2069
+ }
2070
+ var Fetch = {
2071
+ get,
2072
+ post,
2073
+ patch,
2074
+ put,
2075
+ destroy,
2076
+ baseURL,
2077
+ token,
2078
+ setToken,
2079
+ loading
2080
+ };
1414
2081
  // src/utils/guards.ts
1415
2082
  function notNullish(v) {
1416
2083
  return v != null;
@@ -1506,9 +2173,9 @@ var toNumber = (val) => {
1506
2173
  const n = isString(val) ? Number(val) : NaN;
1507
2174
  return isNaN(n) ? val : n;
1508
2175
  };
1509
- var _globalThis;
2176
+ var _globalThis2;
1510
2177
  var getGlobalThis = () => {
1511
- return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
2178
+ return _globalThis2 || (_globalThis2 = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
1512
2179
  };
1513
2180
  function normalizeStyle(value) {
1514
2181
  if (isArray(value)) {
@@ -2576,7 +3243,7 @@ function createInstrumentations(readonly, shallow) {
2576
3243
  value = toRaw(value);
2577
3244
  }
2578
3245
  const target = toRaw(this);
2579
- const { has, get } = getProto(target);
3246
+ const { has, get: get2 } = getProto(target);
2580
3247
  let hadKey = has.call(target, key);
2581
3248
  if (!hadKey) {
2582
3249
  key = toRaw(key);
@@ -2584,7 +3251,7 @@ function createInstrumentations(readonly, shallow) {
2584
3251
  } else if (true) {
2585
3252
  checkIdentityKeys(target, has, key);
2586
3253
  }
2587
- const oldValue = get.call(target, key);
3254
+ const oldValue = get2.call(target, key);
2588
3255
  target.set(key, value);
2589
3256
  if (!hadKey) {
2590
3257
  trigger(target, "add", key, value);
@@ -2595,7 +3262,7 @@ function createInstrumentations(readonly, shallow) {
2595
3262
  },
2596
3263
  delete(key) {
2597
3264
  const target = toRaw(this);
2598
- const { has, get } = getProto(target);
3265
+ const { has, get: get2 } = getProto(target);
2599
3266
  let hadKey = has.call(target, key);
2600
3267
  if (!hadKey) {
2601
3268
  key = toRaw(key);
@@ -2603,7 +3270,7 @@ function createInstrumentations(readonly, shallow) {
2603
3270
  } else if (true) {
2604
3271
  checkIdentityKeys(target, has, key);
2605
3272
  }
2606
- const oldValue = get ? get.call(target, key) : undefined;
3273
+ const oldValue = get2 ? get2.call(target, key) : undefined;
2607
3274
  const result = target.delete(key);
2608
3275
  if (hadKey) {
2609
3276
  trigger(target, "delete", key, undefined, oldValue);
@@ -2749,8 +3416,8 @@ function markRaw(value) {
2749
3416
  }
2750
3417
  var toReactive = (value) => isObject(value) ? reactive(value) : value;
2751
3418
  var toReadonly = (value) => isObject(value) ? readonly(value) : value;
2752
- function isRef(r) {
2753
- return r ? r["__v_isRef"] === true : false;
3419
+ function isRef(r2) {
3420
+ return r2 ? r2["__v_isRef"] === true : false;
2754
3421
  }
2755
3422
  function ref(value) {
2756
3423
  return createRef(value, false);
@@ -2830,8 +3497,8 @@ class CustomRefImpl {
2830
3497
  this["__v_isRef"] = true;
2831
3498
  this._value = undefined;
2832
3499
  const dep = this.dep = new Dep;
2833
- const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
2834
- this._get = get;
3500
+ const { get: get2, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
3501
+ this._get = get2;
2835
3502
  this._set = set;
2836
3503
  }
2837
3504
  get value() {
@@ -5384,7 +6051,7 @@ function computedWithControl(source, fn) {
5384
6051
  trigger2();
5385
6052
  };
5386
6053
  watch2(source, update, { flush: "sync" });
5387
- const get = typeof fn === "function" ? fn : fn.get;
6054
+ const get2 = typeof fn === "function" ? fn : fn.get;
5388
6055
  const set = typeof fn === "function" ? undefined : fn.set;
5389
6056
  const result = customRef((_track, _trigger) => {
5390
6057
  track2 = _track;
@@ -5392,7 +6059,7 @@ function computedWithControl(source, fn) {
5392
6059
  return {
5393
6060
  get() {
5394
6061
  if (dirty.value) {
5395
- v = get(v);
6062
+ v = get2(v);
5396
6063
  dirty.value = false;
5397
6064
  }
5398
6065
  track2();
@@ -5641,8 +6308,8 @@ function getIsIOS() {
5641
6308
  function toRef2(...args) {
5642
6309
  if (args.length !== 1)
5643
6310
  return toRef(...args);
5644
- const r = args[0];
5645
- return typeof r === "function" ? readonly(customRef(() => ({ get: r, set: noop }))) : ref(r);
6311
+ const r2 = args[0];
6312
+ return typeof r2 === "function" ? readonly(customRef(() => ({ get: r2, set: noop }))) : ref(r2);
5646
6313
  }
5647
6314
  var resolveRef = toRef2;
5648
6315
  function reactivePick(obj, ...keys) {
@@ -5923,14 +6590,14 @@ function refWithControl(initial, options = {}) {
5923
6590
  trigger2 = _trigger;
5924
6591
  return {
5925
6592
  get() {
5926
- return get();
6593
+ return get2();
5927
6594
  },
5928
6595
  set(v) {
5929
6596
  set(v);
5930
6597
  }
5931
6598
  };
5932
6599
  });
5933
- function get(tracking = true) {
6600
+ function get2(tracking = true) {
5934
6601
  if (tracking)
5935
6602
  track2();
5936
6603
  return source;
@@ -5947,12 +6614,12 @@ function refWithControl(initial, options = {}) {
5947
6614
  if (triggering)
5948
6615
  trigger2();
5949
6616
  }
5950
- const untrackedGet = () => get(false);
6617
+ const untrackedGet = () => get2(false);
5951
6618
  const silentSet = (v) => set(v, false);
5952
- const peek = () => get(false);
6619
+ const peek = () => get2(false);
5953
6620
  const lay = (v) => set(v, false);
5954
6621
  return extendRef(ref2, {
5955
- get,
6622
+ get: get2,
5956
6623
  set,
5957
6624
  untrackedGet,
5958
6625
  silentSet,
@@ -6079,11 +6746,11 @@ function tryOnUnmounted(fn, target) {
6079
6746
  if (instance)
6080
6747
  onUnmounted(fn, target);
6081
6748
  }
6082
- function createUntil(r, isNot = false) {
6749
+ function createUntil(r2, isNot = false) {
6083
6750
  function toMatch(condition, { flush = "sync", deep = false, timeout, throwOnTimeout } = {}) {
6084
6751
  let stop2 = null;
6085
6752
  const watcher = new Promise((resolve) => {
6086
- stop2 = watch2(r, (v) => {
6753
+ stop2 = watch2(r2, (v) => {
6087
6754
  if (condition(v) !== isNot) {
6088
6755
  if (stop2)
6089
6756
  stop2();
@@ -6099,7 +6766,7 @@ function createUntil(r, isNot = false) {
6099
6766
  });
6100
6767
  const promises = [watcher];
6101
6768
  if (timeout != null) {
6102
- promises.push(promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r)).finally(() => stop2 == null ? undefined : stop2()));
6769
+ promises.push(promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r2)).finally(() => stop2 == null ? undefined : stop2()));
6103
6770
  }
6104
6771
  return Promise.race(promises);
6105
6772
  }
@@ -6109,7 +6776,7 @@ function createUntil(r, isNot = false) {
6109
6776
  const { flush = "sync", deep = false, timeout, throwOnTimeout } = options != null ? options : {};
6110
6777
  let stop2 = null;
6111
6778
  const watcher = new Promise((resolve) => {
6112
- stop2 = watch2([r, value], ([v1, v2]) => {
6779
+ stop2 = watch2([r2, value], ([v1, v2]) => {
6113
6780
  if (isNot !== (v1 === v2)) {
6114
6781
  if (stop2)
6115
6782
  stop2();
@@ -6125,9 +6792,9 @@ function createUntil(r, isNot = false) {
6125
6792
  });
6126
6793
  const promises = [watcher];
6127
6794
  if (timeout != null) {
6128
- promises.push(promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r)).finally(() => {
6795
+ promises.push(promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r2)).finally(() => {
6129
6796
  stop2 == null || stop2();
6130
- return toValue(r);
6797
+ return toValue(r2);
6131
6798
  }));
6132
6799
  }
6133
6800
  return Promise.race(promises);
@@ -6160,14 +6827,14 @@ function createUntil(r, isNot = false) {
6160
6827
  return count >= n;
6161
6828
  }, options);
6162
6829
  }
6163
- if (Array.isArray(toValue(r))) {
6830
+ if (Array.isArray(toValue(r2))) {
6164
6831
  const instance = {
6165
6832
  toMatch,
6166
6833
  toContains,
6167
6834
  changed,
6168
6835
  changedTimes,
6169
6836
  get not() {
6170
- return createUntil(r, !isNot);
6837
+ return createUntil(r2, !isNot);
6171
6838
  }
6172
6839
  };
6173
6840
  return instance;
@@ -6182,14 +6849,14 @@ function createUntil(r, isNot = false) {
6182
6849
  changed,
6183
6850
  changedTimes,
6184
6851
  get not() {
6185
- return createUntil(r, !isNot);
6852
+ return createUntil(r2, !isNot);
6186
6853
  }
6187
6854
  };
6188
6855
  return instance;
6189
6856
  }
6190
6857
  }
6191
- function until(r) {
6192
- return createUntil(r);
6858
+ function until(r2) {
6859
+ return createUntil(r2);
6193
6860
  }
6194
6861
  function defaultComparator(value, othVal) {
6195
6862
  return value === othVal;
@@ -6284,13 +6951,13 @@ function useCounter(initialValue = 0, options = {}) {
6284
6951
  } = options;
6285
6952
  const inc = (delta = 1) => count.value = Math.max(Math.min(max, count.value + delta), min);
6286
6953
  const dec = (delta = 1) => count.value = Math.min(Math.max(min, count.value - delta), max);
6287
- const get = () => count.value;
6954
+ const get2 = () => count.value;
6288
6955
  const set = (val) => count.value = Math.max(min, Math.min(max, val));
6289
6956
  const reset = (val = _initialValue) => {
6290
6957
  _initialValue = val;
6291
6958
  return set(val);
6292
6959
  };
6293
- return { count, inc, dec, get, set, reset };
6960
+ return { count, inc, dec, get: get2, set, reset };
6294
6961
  }
6295
6962
  var REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[T\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/i;
6296
6963
  var REGEX_FORMAT = /[YMDHhms]o|\[([^\]]+)\]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|z{1,4}|SSS/g;
@@ -8707,7 +9374,7 @@ function useBroadcastChannel(options) {
8707
9374
  const channel = ref();
8708
9375
  const data = ref();
8709
9376
  const error = shallowRef(null);
8710
- const post = (data2) => {
9377
+ const post2 = (data2) => {
8711
9378
  if (channel.value)
8712
9379
  channel.value.postMessage(data2);
8713
9380
  };
@@ -8741,7 +9408,7 @@ function useBroadcastChannel(options) {
8741
9408
  isSupported,
8742
9409
  channel,
8743
9410
  data,
8744
- post,
9411
+ post: post2,
8745
9412
  close,
8746
9413
  error,
8747
9414
  isClosed
@@ -10476,7 +11143,7 @@ function combineCallbacks(combination, ...callbacks) {
10476
11143
  };
10477
11144
  }
10478
11145
  }
10479
- function createFetch(config = {}) {
11146
+ function createFetch2(config = {}) {
10480
11147
  const _combination = config.combination || "chain";
10481
11148
  const _options = config.options || {};
10482
11149
  const _fetchOptions = config.fetchOptions || {};
@@ -10547,7 +11214,7 @@ function useFetch(url, ...args) {
10547
11214
  options = { ...options, ...args[1] };
10548
11215
  }
10549
11216
  const {
10550
- fetch = (_a = defaultWindow) == null ? undefined : _a.fetch,
11217
+ fetch: fetch2 = (_a = defaultWindow) == null ? undefined : _a.fetch,
10551
11218
  initialData,
10552
11219
  timeout
10553
11220
  } = options;
@@ -10575,7 +11242,7 @@ function useFetch(url, ...args) {
10575
11242
  };
10576
11243
  }
10577
11244
  };
10578
- const loading = (isLoading) => {
11245
+ const loading2 = (isLoading) => {
10579
11246
  isFetching.value = isLoading;
10580
11247
  isFinished.value = !isLoading;
10581
11248
  };
@@ -10585,7 +11252,7 @@ function useFetch(url, ...args) {
10585
11252
  const execute = async (throwOnFailed = false) => {
10586
11253
  var _a2, _b;
10587
11254
  abort();
10588
- loading(true);
11255
+ loading2(true);
10589
11256
  error.value = null;
10590
11257
  statusCode.value = null;
10591
11258
  aborted.value = false;
@@ -10618,14 +11285,14 @@ function useFetch(url, ...args) {
10618
11285
  };
10619
11286
  if (options.beforeFetch)
10620
11287
  Object.assign(context, await options.beforeFetch(context));
10621
- if (isCanceled || !fetch) {
10622
- loading(false);
11288
+ if (isCanceled || !fetch2) {
11289
+ loading2(false);
10623
11290
  return Promise.resolve(null);
10624
11291
  }
10625
11292
  let responseData = null;
10626
11293
  if (timer)
10627
11294
  timer.start();
10628
- return fetch(context.url, {
11295
+ return fetch2(context.url, {
10629
11296
  ...defaultFetchOptions,
10630
11297
  ...context.options,
10631
11298
  headers: {
@@ -10671,7 +11338,7 @@ function useFetch(url, ...args) {
10671
11338
  return null;
10672
11339
  }).finally(() => {
10673
11340
  if (currentExecuteCounter === executeCounter)
10674
- loading(false);
11341
+ loading2(false);
10675
11342
  if (timer)
10676
11343
  timer.stop();
10677
11344
  finallyEvent.trigger(null);
@@ -11322,7 +11989,7 @@ function useIdle(timeout = oneMinute, options = {}) {
11322
11989
  async function loadImage(options) {
11323
11990
  return new Promise((resolve, reject) => {
11324
11991
  const img = new Image;
11325
- const { src, srcset, sizes, class: clazz, loading, crossorigin, referrerPolicy, width, height, decoding, fetchPriority, ismap, usemap } = options;
11992
+ const { src, srcset, sizes, class: clazz, loading: loading2, crossorigin, referrerPolicy, width, height, decoding, fetchPriority, ismap, usemap } = options;
11326
11993
  img.src = src;
11327
11994
  if (srcset != null)
11328
11995
  img.srcset = srcset;
@@ -11330,8 +11997,8 @@ async function loadImage(options) {
11330
11997
  img.sizes = sizes;
11331
11998
  if (clazz != null)
11332
11999
  img.className = clazz;
11333
- if (loading != null)
11334
- img.loading = loading;
12000
+ if (loading2 != null)
12001
+ img.loading = loading2;
11335
12002
  if (crossorigin != null)
11336
12003
  img.crossOrigin = crossorigin;
11337
12004
  if (referrerPolicy != null)
@@ -11681,8 +12348,8 @@ function useMagicKeys(options = {}) {
11681
12348
  refs[prop] = shallowRef(false);
11682
12349
  }
11683
12350
  }
11684
- const r = Reflect.get(target2, prop, rec);
11685
- return useReactive ? toValue(r) : r;
12351
+ const r2 = Reflect.get(target2, prop, rec);
12352
+ return useReactive ? toValue(r2) : r2;
11686
12353
  }
11687
12354
  });
11688
12355
  return proxy;
@@ -13142,7 +13809,7 @@ function useStepper(steps, initialStep) {
13142
13809
  return stepsRef.value[index2];
13143
13810
  return stepsRef.value[stepNames.value[index2]];
13144
13811
  }
13145
- function get(step) {
13812
+ function get2(step) {
13146
13813
  if (!stepNames.value.includes(step))
13147
13814
  return;
13148
13815
  return at(stepNames.value.indexOf(step));
@@ -13190,7 +13857,7 @@ function useStepper(steps, initialStep) {
13190
13857
  isFirst,
13191
13858
  isLast,
13192
13859
  at,
13193
- get,
13860
+ get: get2,
13194
13861
  goTo,
13195
13862
  goToNext,
13196
13863
  goToPrevious,
@@ -14530,7 +15197,7 @@ function useWebWorker(arg0, workerOptions, options) {
14530
15197
  } = options != null ? options : {};
14531
15198
  const data = ref(null);
14532
15199
  const worker = shallowRef();
14533
- const post = (...args) => {
15200
+ const post2 = (...args) => {
14534
15201
  if (!worker.value)
14535
15202
  return;
14536
15203
  worker.value.postMessage(...args);
@@ -14557,7 +15224,7 @@ function useWebWorker(arg0, workerOptions, options) {
14557
15224
  }
14558
15225
  return {
14559
15226
  data,
14560
- post,
15227
+ post: post2,
14561
15228
  terminate,
14562
15229
  worker
14563
15230
  };
@@ -15050,15 +15717,15 @@ function tagDedupeKey(tag) {
15050
15717
  return false;
15051
15718
  }
15052
15719
  var sepSub = "%separator";
15053
- function sub(p2, token, isJson = false) {
15720
+ function sub(p2, token2, isJson = false) {
15054
15721
  let val;
15055
- if (token === "s" || token === "pageTitle") {
15722
+ if (token2 === "s" || token2 === "pageTitle") {
15056
15723
  val = p2.pageTitle;
15057
- } else if (token.includes(".")) {
15058
- const dotIndex = token.indexOf(".");
15059
- val = p2[token.substring(0, dotIndex)]?.[token.substring(dotIndex + 1)];
15724
+ } else if (token2.includes(".")) {
15725
+ const dotIndex = token2.indexOf(".");
15726
+ val = p2[token2.substring(0, dotIndex)]?.[token2.substring(dotIndex + 1)];
15060
15727
  } else {
15061
- val = p2[token];
15728
+ val = p2[token2];
15062
15729
  }
15063
15730
  if (val !== undefined) {
15064
15731
  return isJson ? (val || "").replace(/"/g, "\\\"") : val || "";
@@ -15078,12 +15745,12 @@ function processTemplateParams(s, p2, sep, isJson = false) {
15078
15745
  return s;
15079
15746
  }
15080
15747
  const hasSepSub = s.includes(sepSub);
15081
- s = s.replace(/%\w+(?:\.\w+)?/g, (token) => {
15082
- if (token === sepSub || !tokens2.includes(token)) {
15083
- return token;
15748
+ s = s.replace(/%\w+(?:\.\w+)?/g, (token2) => {
15749
+ if (token2 === sepSub || !tokens2.includes(token2)) {
15750
+ return token2;
15084
15751
  }
15085
- const re = sub(p2, token.slice(1), isJson);
15086
- return re !== undefined ? re : token;
15752
+ const re = sub(p2, token2.slice(1), isJson);
15753
+ return re !== undefined ? re : token2;
15087
15754
  }).trim();
15088
15755
  if (hasSepSub) {
15089
15756
  if (s.endsWith(sepSub))
@@ -15893,8 +16560,8 @@ scriptProxy[ScriptProxyTarget] = true;
15893
16560
 
15894
16561
  // ../../../../node_modules/@vueuse/head/node_modules/@unhead/vue/dist/shared/vue.ziyDaVMR.mjs
15895
16562
  var Vue3 = version[0] === "3";
15896
- function resolveUnref2(r) {
15897
- return typeof r === "function" ? r() : unref(r);
16563
+ function resolveUnref2(r2) {
16564
+ return typeof r2 === "function" ? r2() : unref(r2);
15898
16565
  }
15899
16566
  function resolveUnrefHeadInput(ref2) {
15900
16567
  if (ref2 instanceof Promise || ref2 instanceof Date || ref2 instanceof RegExp)
@@ -15903,7 +16570,7 @@ function resolveUnrefHeadInput(ref2) {
15903
16570
  if (!ref2 || !root)
15904
16571
  return root;
15905
16572
  if (Array.isArray(root))
15906
- return root.map((r) => resolveUnrefHeadInput(r));
16573
+ return root.map((r2) => resolveUnrefHeadInput(r2));
15907
16574
  if (typeof root === "object") {
15908
16575
  const resolved = {};
15909
16576
  for (const k2 in root) {
@@ -16502,7 +17169,6 @@ export {
16502
17169
  refThrottled as throttledRef,
16503
17170
  throttle,
16504
17171
  templateRef,
16505
- tap,
16506
17172
  tab,
16507
17173
  syncRefs,
16508
17174
  syncRef,
@@ -16598,7 +17264,7 @@ export {
16598
17264
  createHead3 as createHead,
16599
17265
  createGlobalState,
16600
17266
  createGenericProjection,
16601
- createFetch,
17267
+ createFetch2 as createFetch,
16602
17268
  createEventHook,
16603
17269
  createControlledPromise,
16604
17270
  controlledRef,
@@ -16625,11 +17291,11 @@ export {
16625
17291
  breakpointsMasterCss,
16626
17292
  breakpointsBootstrapV5,
16627
17293
  breakpointsAntDesign,
16628
- batchInvoke,
16629
17294
  refAutoReset as autoResetRef,
16630
17295
  computedAsync as asyncComputed,
16631
17296
  anyOf,
16632
17297
  logicAnd as and,
16633
17298
  HeadVuePlugin,
16634
- Head
17299
+ Head,
17300
+ Fetch
16635
17301
  };
@@ -0,0 +1,19 @@
1
+ import type { Ref } from 'vue';
2
+
3
+ declare interface Params {
4
+ [key: string]: any
5
+ }
6
+ declare type FetchResponse = string | Blob | ArrayBuffer | ReadableStream<Uint8Array>
7
+
8
+ interface UseFetchReturn {
9
+ get: (url: string, params?: Params, headers?: Headers) => Promise<FetchResponse>
10
+ post: (url: string, params?: Params, headers?: Headers) => Promise<FetchResponse>
11
+ patch: (url: string, params?: Params, headers?: Headers) => Promise<FetchResponse>
12
+ put: (url: string, params?: Params, headers?: Headers) => Promise<FetchResponse>
13
+ destroy: (url: string, params?: Params, headers?: Headers) => Promise<FetchResponse>
14
+ setToken: (authToken: string) => void
15
+ loading: Ref<boolean>
16
+ token: Ref<string>
17
+ baseURL: Ref<string>
18
+ }
19
+ export declare function useFetch(): UseFetchReturn;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/browser",
3
3
  "type": "module",
4
- "version": "0.70.22",
4
+ "version": "0.70.23",
5
5
  "description": "Stacks core frontend/browser functionalities.",
6
6
  "author": "Chris Breuer",
7
7
  "contributors": ["Chris Breuer <chris@stacksjs.org>"],
@@ -34,7 +34,7 @@
34
34
  "prepublishOnly": "bun run build"
35
35
  },
36
36
  "devDependencies": {
37
- "@stacksjs/development": "0.70.18",
38
- "@stacksjs/utils": "0.70.18"
37
+ "@stacksjs/development": "0.70.22",
38
+ "@stacksjs/utils": "0.70.22"
39
39
  }
40
40
  }