@cupcodev/ui 8.1.2 → 8.1.3

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/index.js CHANGED
@@ -1199,10 +1199,10 @@ var Dock = ({ items, className }) => {
1199
1199
  const itemsRef = useRef3([]);
1200
1200
  const OVERSHOOT = 5;
1201
1201
  useEffect3(() => {
1202
- var _a26;
1202
+ var _a25;
1203
1203
  const activeItem = itemsRef.current[activeIndex];
1204
1204
  if (!activeItem) return;
1205
- const containerRect = (_a26 = activeItem.parentElement) == null ? void 0 : _a26.getBoundingClientRect();
1205
+ const containerRect = (_a25 = activeItem.parentElement) == null ? void 0 : _a25.getBoundingClientRect();
1206
1206
  const itemRect = activeItem.getBoundingClientRect();
1207
1207
  if (!containerRect) return;
1208
1208
  const relativeLeft = itemRect.left - containerRect.left;
@@ -1264,9 +1264,9 @@ var Dock = ({ items, className }) => {
1264
1264
  "button",
1265
1265
  {
1266
1266
  onClick: () => {
1267
- var _a26;
1267
+ var _a25;
1268
1268
  setActiveIndex(index);
1269
- (_a26 = item.onClick) == null ? void 0 : _a26.call(item);
1269
+ (_a25 = item.onClick) == null ? void 0 : _a25.call(item);
1270
1270
  },
1271
1271
  className: cn(
1272
1272
  "flex items-center justify-center w-12 h-12 rounded-xl",
@@ -1334,9 +1334,9 @@ var normalizeValue = (value) => {
1334
1334
  return String(value);
1335
1335
  };
1336
1336
  var setCupcodeRuntimeEnv = (values) => {
1337
- var _a26;
1337
+ var _a25;
1338
1338
  const globalRef = globalThis;
1339
- const nextGlobalEnv = { ...(_a26 = globalRef.__CUPCODE_ENV__) != null ? _a26 : {} };
1339
+ const nextGlobalEnv = { ...(_a25 = globalRef.__CUPCODE_ENV__) != null ? _a25 : {} };
1340
1340
  Object.entries(values).forEach(([key, value]) => {
1341
1341
  const normalized = normalizeValue(value);
1342
1342
  runtimeStore[key] = normalized;
@@ -1345,8 +1345,8 @@ var setCupcodeRuntimeEnv = (values) => {
1345
1345
  globalRef.__CUPCODE_ENV__ = nextGlobalEnv;
1346
1346
  };
1347
1347
  var readFromProcessEnv = (key) => {
1348
- var _a26;
1349
- const processEnv = (_a26 = globalThis.process) == null ? void 0 : _a26.env;
1348
+ var _a25;
1349
+ const processEnv = (_a25 = globalThis.process) == null ? void 0 : _a25.env;
1350
1350
  return normalizeValue(processEnv == null ? void 0 : processEnv[key]);
1351
1351
  };
1352
1352
  var readFromImportMetaEnv = (key) => {
@@ -1358,12 +1358,12 @@ var readFromImportMetaEnv = (key) => {
1358
1358
  }
1359
1359
  };
1360
1360
  var getRuntimeEnv = (key) => {
1361
- var _a26;
1361
+ var _a25;
1362
1362
  const normalizedKey = key.trim();
1363
1363
  if (!normalizedKey) return void 0;
1364
1364
  const fromRuntimeStore = runtimeStore[normalizedKey];
1365
1365
  if (fromRuntimeStore) return fromRuntimeStore;
1366
- const fromGlobalStore = normalizeValue((_a26 = globalThis.__CUPCODE_ENV__) == null ? void 0 : _a26[normalizedKey]);
1366
+ const fromGlobalStore = normalizeValue((_a25 = globalThis.__CUPCODE_ENV__) == null ? void 0 : _a25[normalizedKey]);
1367
1367
  if (fromGlobalStore) return fromGlobalStore;
1368
1368
  const fromGlobalKey = normalizeValue(globalThis[normalizedKey]);
1369
1369
  if (fromGlobalKey) return fromGlobalKey;
@@ -1372,12 +1372,12 @@ var getRuntimeEnv = (key) => {
1372
1372
  return readFromProcessEnv(normalizedKey);
1373
1373
  };
1374
1374
  var getRuntimeEnvOr = (key, fallback) => {
1375
- var _a26;
1376
- return (_a26 = getRuntimeEnv(key)) != null ? _a26 : fallback;
1375
+ var _a25;
1376
+ return (_a25 = getRuntimeEnv(key)) != null ? _a25 : fallback;
1377
1377
  };
1378
1378
  var isRuntimeDev = () => {
1379
- var _a26, _b3, _c;
1380
- const explicitDev = (_a26 = getRuntimeEnv("DEV")) != null ? _a26 : getRuntimeEnv("VITE_DEV");
1379
+ var _a25, _b3, _c;
1380
+ const explicitDev = (_a25 = getRuntimeEnv("DEV")) != null ? _a25 : getRuntimeEnv("VITE_DEV");
1381
1381
  if (explicitDev) {
1382
1382
  const normalized = explicitDev.toLowerCase();
1383
1383
  return normalized === "1" || normalized === "true";
@@ -1403,11 +1403,11 @@ var isUuid = (value) => {
1403
1403
  return UUID_REGEX.test(value.trim());
1404
1404
  };
1405
1405
  function parseAssetId(input) {
1406
- var _a26, _b3, _c, _d;
1406
+ var _a25, _b3, _c, _d;
1407
1407
  const raw = input == null ? void 0 : input.trim();
1408
1408
  if (!raw) return void 0;
1409
1409
  if (UUID_REGEX.test(raw)) return raw;
1410
- const matchFromRaw = (_a26 = raw.match(UUID_IN_TEXT_REGEX)) == null ? void 0 : _a26[0];
1410
+ const matchFromRaw = (_a25 = raw.match(UUID_IN_TEXT_REGEX)) == null ? void 0 : _a25[0];
1411
1411
  if (isUuid(matchFromRaw)) return matchFromRaw;
1412
1412
  try {
1413
1413
  const url = new URL(raw);
@@ -1450,7 +1450,7 @@ function buildTelescupImageURL(options) {
1450
1450
  return `${getApiBase()}/i?${params.toString()}`;
1451
1451
  }
1452
1452
  function resolveTelescupImageURL(value, options) {
1453
- var _a26;
1453
+ var _a25;
1454
1454
  const raw = value == null ? void 0 : value.trim();
1455
1455
  if (!raw) return void 0;
1456
1456
  const parsedId = parseAssetId(raw);
@@ -1472,7 +1472,7 @@ function resolveTelescupImageURL(value, options) {
1472
1472
  width: options == null ? void 0 : options.width,
1473
1473
  height: options == null ? void 0 : options.height,
1474
1474
  fit: options == null ? void 0 : options.fit,
1475
- format: (_a26 = options == null ? void 0 : options.format) != null ? _a26 : "webp",
1475
+ format: (_a25 = options == null ? void 0 : options.format) != null ? _a25 : "webp",
1476
1476
  quality: options == null ? void 0 : options.quality
1477
1477
  });
1478
1478
  }
@@ -1568,7 +1568,7 @@ var DockWrapper = ({ categories, activeCategoryId }) => {
1568
1568
  return void 0;
1569
1569
  }, [sortedCategories]);
1570
1570
  useEffect5(() => {
1571
- var _a26;
1571
+ var _a25;
1572
1572
  const root = rootRef.current;
1573
1573
  if (!root) return;
1574
1574
  const $ = (sel) => root.querySelector(sel);
@@ -1580,7 +1580,7 @@ var DockWrapper = ({ categories, activeCategoryId }) => {
1580
1580
  const getDockItems = () => Array.from(root.querySelectorAll(INTERACTIVE_SELECTOR));
1581
1581
  const dockItems = getDockItems();
1582
1582
  if (!tabbar || !dock || !listMenuShow || !tabbarUl || dockItems.length === 0) return;
1583
- const persistentId = (_a26 = activeCategoryId != null ? activeCategoryId : lastInteractiveId) != null ? _a26 : null;
1583
+ const persistentId = (_a25 = activeCategoryId != null ? activeCategoryId : lastInteractiveId) != null ? _a25 : null;
1584
1584
  let openItem = null;
1585
1585
  let latestToggleToken = null;
1586
1586
  const persistentSelector = persistentId != null ? `${INTERACTIVE_SELECTOR}[data-cat-id="${persistentId}"]` : null;
@@ -1879,8 +1879,8 @@ var DockWrapper = ({ categories, activeCategoryId }) => {
1879
1879
  }, total);
1880
1880
  }
1881
1881
  const hideBootstrapTooltip = (el) => {
1882
- var _a27, _b3;
1883
- const tooltip = ((_b3 = (_a27 = window.bootstrap) == null ? void 0 : _a27.Tooltip) == null ? void 0 : _b3.getInstance) ? window.bootstrap.Tooltip.getInstance(el) : null;
1882
+ var _a26, _b3;
1883
+ const tooltip = ((_b3 = (_a26 = window.bootstrap) == null ? void 0 : _a26.Tooltip) == null ? void 0 : _b3.getInstance) ? window.bootstrap.Tooltip.getInstance(el) : null;
1884
1884
  tooltip == null ? void 0 : tooltip.hide();
1885
1885
  };
1886
1886
  const openMenuForItem = (item, menu) => {
@@ -1898,14 +1898,14 @@ var DockWrapper = ({ categories, activeCategoryId }) => {
1898
1898
  latestToggleToken = null;
1899
1899
  };
1900
1900
  const closeActiveMenu = (opts = {}) => {
1901
- var _a27;
1901
+ var _a26;
1902
1902
  if (!opts.onClosed) {
1903
1903
  latestToggleToken = null;
1904
1904
  }
1905
1905
  const itemToClose = openItem;
1906
1906
  if (!itemToClose) {
1907
1907
  if (!opts.preserveWrapper) ensurePersistentHighlight();
1908
- (_a27 = opts.onClosed) == null ? void 0 : _a27.call(opts);
1908
+ (_a26 = opts.onClosed) == null ? void 0 : _a26.call(opts);
1909
1909
  return;
1910
1910
  }
1911
1911
  const menu = getMenuFor(itemToClose);
@@ -1913,7 +1913,7 @@ var DockWrapper = ({ categories, activeCategoryId }) => {
1913
1913
  itemToClose.classList.remove("active");
1914
1914
  delete itemToClose.dataset.menuOpen;
1915
1915
  const finalize = () => {
1916
- var _a28;
1916
+ var _a27;
1917
1917
  if (!opts.preserveWrapper) {
1918
1918
  listMenuShow.classList.remove("show");
1919
1919
  tabbar.classList.remove("is-active-menu");
@@ -1921,7 +1921,7 @@ var DockWrapper = ({ categories, activeCategoryId }) => {
1921
1921
  setTabbarTheme(null);
1922
1922
  ensurePersistentHighlight();
1923
1923
  }
1924
- (_a28 = opts.onClosed) == null ? void 0 : _a28.call(opts);
1924
+ (_a27 = opts.onClosed) == null ? void 0 : _a27.call(opts);
1925
1925
  };
1926
1926
  closeMenu(menu, finalize);
1927
1927
  };
@@ -2024,7 +2024,7 @@ var DockWrapper = ({ categories, activeCategoryId }) => {
2024
2024
  /* @__PURE__ */ jsx10("div", { className: "glass-overlay" }),
2025
2025
  /* @__PURE__ */ jsx10("div", { className: "glass-specular" }),
2026
2026
  /* @__PURE__ */ jsx10("ul", { className: "flex-center", children: sortedCategories.map((cat) => {
2027
- var _a26;
2027
+ var _a25;
2028
2028
  if (cat.type === "divider") {
2029
2029
  return /* @__PURE__ */ jsx10(
2030
2030
  "li",
@@ -2036,7 +2036,7 @@ var DockWrapper = ({ categories, activeCategoryId }) => {
2036
2036
  cat.id
2037
2037
  );
2038
2038
  }
2039
- const hasCards = (((_a26 = cat.cards) == null ? void 0 : _a26.length) || 0) > 0;
2039
+ const hasCards = (((_a25 = cat.cards) == null ? void 0 : _a25.length) || 0) > 0;
2040
2040
  const link = cat.href;
2041
2041
  const isCurrent = cat.id === activeCategoryId;
2042
2042
  return /* @__PURE__ */ jsxs8(
@@ -2070,12 +2070,12 @@ var DockWrapper = ({ categories, activeCategoryId }) => {
2070
2070
  );
2071
2071
  }) }),
2072
2072
  /* @__PURE__ */ jsx10("div", { className: "list-menu-mob-show", children: sortedCategories.filter((cat) => {
2073
- var _a26;
2074
- return cat.type !== "divider" && (((_a26 = cat.cards) == null ? void 0 : _a26.length) || 0) > 0;
2073
+ var _a25;
2074
+ return cat.type !== "divider" && (((_a25 = cat.cards) == null ? void 0 : _a25.length) || 0) > 0;
2075
2075
  }).map((cat) => {
2076
- var _a26;
2077
- return /* @__PURE__ */ jsx10("div", { className: "mob-list-menu hide", "data-tagget": cat.slug, children: /* @__PURE__ */ jsx10("div", { className: `submenu-stack ${cat.slug}`, children: ((_a26 = cat.cards) != null ? _a26 : []).map((card, i) => {
2078
- var _a27;
2076
+ var _a25;
2077
+ return /* @__PURE__ */ jsx10("div", { className: "mob-list-menu hide", "data-tagget": cat.slug, children: /* @__PURE__ */ jsx10("div", { className: `submenu-stack ${cat.slug}`, children: ((_a25 = cat.cards) != null ? _a25 : []).map((card, i) => {
2078
+ var _a26;
2079
2079
  return /* @__PURE__ */ jsxs8(
2080
2080
  "div",
2081
2081
  {
@@ -2091,8 +2091,8 @@ var DockWrapper = ({ categories, activeCategoryId }) => {
2091
2091
  /* @__PURE__ */ jsx10("div", { className: "title", children: card.title }),
2092
2092
  card.description ? /* @__PURE__ */ jsx10("div", { className: "description", children: card.description }) : null
2093
2093
  ] }),
2094
- /* @__PURE__ */ jsx10("div", { className: "actions", children: ((_a27 = card.buttons) != null ? _a27 : []).slice(0, 2).map((btn, idx) => {
2095
- var _a28, _b3, _c, _d;
2094
+ /* @__PURE__ */ jsx10("div", { className: "actions", children: ((_a26 = card.buttons) != null ? _a26 : []).slice(0, 2).map((btn, idx) => {
2095
+ var _a27, _b3, _c, _d;
2096
2096
  const className = idx === 0 ? "saiba-mais" : "saiba-mais-1";
2097
2097
  if (btn.type === "popup") {
2098
2098
  return /* @__PURE__ */ jsx10(
@@ -2107,7 +2107,7 @@ var DockWrapper = ({ categories, activeCategoryId }) => {
2107
2107
  window.dispatchEvent(new Event(`qw:open:${btn.popupId}`));
2108
2108
  }
2109
2109
  },
2110
- children: (_a28 = btn.label) != null ? _a28 : "Abrir"
2110
+ children: (_a27 = btn.label) != null ? _a27 : "Abrir"
2111
2111
  },
2112
2112
  `${cat.id}-card-${i}-btn-${idx}`
2113
2113
  );
@@ -2253,10 +2253,10 @@ var NavbarCupcode = ({
2253
2253
  React5.useEffect(() => {
2254
2254
  if (!hasItems || !isOpen) return;
2255
2255
  const handlePointerDown = (event) => {
2256
- var _a26, _b3;
2256
+ var _a25, _b3;
2257
2257
  const target = event.target;
2258
2258
  if (!(target instanceof Node)) return;
2259
- if (!((_a26 = navRef.current) == null ? void 0 : _a26.contains(target)) && !((_b3 = mobileDrawerRef.current) == null ? void 0 : _b3.contains(target))) {
2259
+ if (!((_a25 = navRef.current) == null ? void 0 : _a25.contains(target)) && !((_b3 = mobileDrawerRef.current) == null ? void 0 : _b3.contains(target))) {
2260
2260
  setIsOpen(false);
2261
2261
  }
2262
2262
  };
@@ -2325,9 +2325,9 @@ var NavbarCupcode = ({
2325
2325
  isActive && "text-[hsl(var(--cc-navbar-link-active))] after:w-full after:bg-[hsl(var(--cc-navbar-link-active))]"
2326
2326
  );
2327
2327
  const handleClick = (event) => {
2328
- var _a26;
2328
+ var _a25;
2329
2329
  logNavClick("navbar-desktop", item);
2330
- (_a26 = item.onClick) == null ? void 0 : _a26.call(item, event);
2330
+ (_a25 = item.onClick) == null ? void 0 : _a25.call(item, event);
2331
2331
  };
2332
2332
  if (item.href.startsWith("#")) {
2333
2333
  return /* @__PURE__ */ jsxs9(
@@ -2428,9 +2428,9 @@ var NavbarCupcode = ({
2428
2428
  isActive && "text-[hsl(var(--cc-navbar-link-active))]"
2429
2429
  );
2430
2430
  const handleClick = (event) => {
2431
- var _a26;
2431
+ var _a25;
2432
2432
  logNavClick("navbar-mobile", item);
2433
- (_a26 = item.onClick) == null ? void 0 : _a26.call(item, event);
2433
+ (_a25 = item.onClick) == null ? void 0 : _a25.call(item, event);
2434
2434
  setIsOpen(false);
2435
2435
  };
2436
2436
  if (item.href.startsWith("#")) {
@@ -2685,11 +2685,11 @@ JellyButton.displayName = "JellyButton";
2685
2685
  // src/components/cupcode/JellyButtonOriginal.tsx
2686
2686
  import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
2687
2687
  var resolveResponsiveSize = (value, currentBp) => {
2688
- var _a26, _b3, _c, _d, _e;
2688
+ var _a25, _b3, _c, _d, _e;
2689
2689
  if (typeof value === "string") {
2690
2690
  return value;
2691
2691
  }
2692
- const fallback = (_e = (_d = (_c = (_b3 = (_a26 = value.base) != null ? _a26 : value.sm) != null ? _b3 : value.md) != null ? _c : value.lg) != null ? _d : value.xl) != null ? _e : "md";
2692
+ const fallback = (_e = (_d = (_c = (_b3 = (_a25 = value.base) != null ? _a25 : value.sm) != null ? _b3 : value.md) != null ? _c : value.lg) != null ? _d : value.xl) != null ? _e : "md";
2693
2693
  if (!currentBp) {
2694
2694
  return fallback;
2695
2695
  }
@@ -3062,12 +3062,12 @@ var isAccountsOidcToken = (token) => {
3062
3062
  return issuer.startsWith(ACCOUNTS_BASE_URL_NORMALIZED) || issuer.includes("accounts.cupcode.com.br");
3063
3063
  };
3064
3064
  var readStoredIdToken = () => {
3065
- var _a26;
3065
+ var _a25;
3066
3066
  if (typeof window === "undefined" || typeof window.sessionStorage === "undefined") {
3067
3067
  return void 0;
3068
3068
  }
3069
3069
  for (const key of SESSION_ID_TOKEN_KEYS) {
3070
- const value = (_a26 = window.sessionStorage.getItem(key)) == null ? void 0 : _a26.trim();
3070
+ const value = (_a25 = window.sessionStorage.getItem(key)) == null ? void 0 : _a25.trim();
3071
3071
  if (value) return value;
3072
3072
  }
3073
3073
  return void 0;
@@ -3161,11 +3161,11 @@ var readUsageContext = (value) => {
3161
3161
  return void 0;
3162
3162
  };
3163
3163
  var getFileExtension = (filename) => {
3164
- var _a26;
3164
+ var _a25;
3165
3165
  if (!filename) return void 0;
3166
3166
  const parts = filename.split(".");
3167
3167
  if (parts.length < 2) return void 0;
3168
- const candidate = (_a26 = parts[parts.length - 1]) == null ? void 0 : _a26.trim().toLowerCase();
3168
+ const candidate = (_a25 = parts[parts.length - 1]) == null ? void 0 : _a25.trim().toLowerCase();
3169
3169
  return candidate || void 0;
3170
3170
  };
3171
3171
  var buildFacetsFromItems = (items) => {
@@ -3175,9 +3175,9 @@ var buildFacetsFromItems = (items) => {
3175
3175
  const extensions = /* @__PURE__ */ new Map();
3176
3176
  const tags = /* @__PURE__ */ new Map();
3177
3177
  items.forEach((item) => {
3178
- var _a26, _b3, _c, _d, _e, _f, _g;
3178
+ var _a25, _b3, _c, _d, _e, _f, _g;
3179
3179
  if (item.category) {
3180
- categories.set(item.category, ((_a26 = categories.get(item.category)) != null ? _a26 : 0) + 1);
3180
+ categories.set(item.category, ((_a25 = categories.get(item.category)) != null ? _a25 : 0) + 1);
3181
3181
  }
3182
3182
  if (item.folderId) {
3183
3183
  const current = folders.get(item.folderId);
@@ -3193,16 +3193,16 @@ var buildFacetsFromItems = (items) => {
3193
3193
  extensions.set(item.extension, ((_e = extensions.get(item.extension)) != null ? _e : 0) + 1);
3194
3194
  }
3195
3195
  (_g = (_f = item.meta) == null ? void 0 : _f.tags) == null ? void 0 : _g.forEach((tag) => {
3196
- var _a27;
3196
+ var _a26;
3197
3197
  const normalizedTag = tag.trim();
3198
3198
  if (!normalizedTag) return;
3199
- tags.set(normalizedTag, ((_a27 = tags.get(normalizedTag)) != null ? _a27 : 0) + 1);
3199
+ tags.set(normalizedTag, ((_a26 = tags.get(normalizedTag)) != null ? _a26 : 0) + 1);
3200
3200
  });
3201
3201
  });
3202
3202
  const toFacetValues = (map) => Array.from(map.entries()).map(([value, count2]) => ({ value, count: count2 })).sort((a, b) => a.value.localeCompare(b.value));
3203
3203
  const toFolderFacetValues = (map) => Array.from(map.entries()).map(([value, info]) => ({ value, label: info.label, count: info.count })).sort((a, b) => {
3204
- var _a26, _b3;
3205
- return ((_a26 = a.label) != null ? _a26 : a.value).localeCompare((_b3 = b.label) != null ? _b3 : b.value);
3204
+ var _a25, _b3;
3205
+ return ((_a25 = a.label) != null ? _a25 : a.value).localeCompare((_b3 = b.label) != null ? _b3 : b.value);
3206
3206
  });
3207
3207
  return {
3208
3208
  categories: toFacetValues(categories),
@@ -3213,7 +3213,7 @@ var buildFacetsFromItems = (items) => {
3213
3213
  };
3214
3214
  };
3215
3215
  async function request(config, path, options = {}) {
3216
- var _a26, _b3;
3216
+ var _a25, _b3;
3217
3217
  const token = await config.getAccessToken();
3218
3218
  if (!token) {
3219
3219
  throw new TelescupClientError("Token de acesso n\xE3o encontrado.");
@@ -3243,7 +3243,7 @@ async function request(config, path, options = {}) {
3243
3243
  let response;
3244
3244
  try {
3245
3245
  response = await fetch(url, {
3246
- method: (_a26 = options.method) != null ? _a26 : "POST",
3246
+ method: (_a25 = options.method) != null ? _a25 : "POST",
3247
3247
  headers,
3248
3248
  body
3249
3249
  });
@@ -3273,8 +3273,8 @@ var normalizeFunctionLanguage = (value) => {
3273
3273
  return normalized;
3274
3274
  };
3275
3275
  var toFunctionListPayload = (filters) => {
3276
- var _a26, _b3, _c, _d, _e, _f;
3277
- const page = toPositiveInt((_a26 = filters.cursor) != null ? _a26 : filters.page, 1);
3276
+ var _a25, _b3, _c, _d, _e, _f;
3277
+ const page = toPositiveInt((_a25 = filters.cursor) != null ? _a25 : filters.page, 1);
3278
3278
  const pageSize = Math.min(500, Math.max(1, toPositiveInt(filters.pageSize, 24)));
3279
3279
  return {
3280
3280
  query: (_b3 = filters.query) != null ? _b3 : "",
@@ -3295,8 +3295,8 @@ var toFunctionListPayload = (filters) => {
3295
3295
  };
3296
3296
  };
3297
3297
  var mapGenericRowToAsset = (row) => {
3298
- var _a26, _b3;
3299
- const id = (_a26 = readFirstString(row, ["asset_id", "id", "file_id", "uuid"])) != null ? _a26 : typeof row.id === "number" ? String(row.id) : void 0;
3298
+ var _a25, _b3;
3299
+ const id = (_a25 = readFirstString(row, ["asset_id", "id", "file_id", "uuid"])) != null ? _a25 : typeof row.id === "number" ? String(row.id) : void 0;
3300
3300
  if (!id) return null;
3301
3301
  const fileName = readFirstString(row, ["filename", "file_name", "name", "title", "original_name"]);
3302
3302
  const mimeType = readFirstString(row, ["mime", "mime_type", "content_type", "file_mime"]);
@@ -3318,16 +3318,16 @@ var mapGenericRowToAsset = (row) => {
3318
3318
  };
3319
3319
  };
3320
3320
  var normalizeListResponseFromFunctions = (response, filters) => {
3321
- var _a26, _b3, _c, _d, _e, _f;
3321
+ var _a25, _b3, _c, _d, _e, _f;
3322
3322
  const payload = response != null ? response : {};
3323
3323
  const itemsRaw = Array.isArray(payload.items) ? payload.items : [];
3324
3324
  const selectedLanguage = normalizeLanguageKey(filters.language);
3325
3325
  const items = itemsRaw.map((row) => {
3326
- var _a27, _b4, _c2;
3326
+ var _a26, _b4, _c2;
3327
3327
  const mapped = mapGenericRowToAsset(row);
3328
3328
  if (!mapped) return null;
3329
3329
  const metaByLang = normalizeMetaByLanguage(row.meta);
3330
- const activeMeta = (_b4 = (_a27 = metaByLang[selectedLanguage]) != null ? _a27 : metaByLang.pt) != null ? _b4 : {};
3330
+ const activeMeta = (_b4 = (_a26 = metaByLang[selectedLanguage]) != null ? _a26 : metaByLang.pt) != null ? _b4 : {};
3331
3331
  const usageFromObject = readUsageContext(row.usage);
3332
3332
  const normalized = {
3333
3333
  ...mapped,
@@ -3339,7 +3339,7 @@ var normalizeListResponseFromFunctions = (response, filters) => {
3339
3339
  };
3340
3340
  return normalized;
3341
3341
  }).filter((item) => item !== null);
3342
- const total = (_c = (_b3 = (_a26 = readNumber(payload.total)) != null ? _a26 : readNumber(payload.totalCount)) != null ? _b3 : readNumber(payload.total_count)) != null ? _c : items.length;
3342
+ const total = (_c = (_b3 = (_a25 = readNumber(payload.total)) != null ? _a25 : readNumber(payload.totalCount)) != null ? _b3 : readNumber(payload.total_count)) != null ? _c : items.length;
3343
3343
  const page = toPositiveInt((_e = (_d = payload.page) != null ? _d : filters.cursor) != null ? _e : filters.page, 1);
3344
3344
  const pageSize = Math.min(100, Math.max(1, toPositiveInt((_f = payload.pageSize) != null ? _f : filters.pageSize, 24)));
3345
3345
  const nextCursor = total > page * pageSize ? String(page + 1) : void 0;
@@ -3359,12 +3359,12 @@ var mapConflictForQueue = (value) => {
3359
3359
  return "conflict";
3360
3360
  };
3361
3361
  var toInitPayloadForFunctions = (payload) => {
3362
- var _a26, _b3;
3362
+ var _a25, _b3;
3363
3363
  return {
3364
3364
  filename: payload.fileName,
3365
3365
  size: payload.size,
3366
3366
  mime: payload.mimeType,
3367
- folder_id: (_a26 = payload.folderId) != null ? _a26 : null,
3367
+ folder_id: (_a25 = payload.folderId) != null ? _a25 : null,
3368
3368
  overwritePolicy: (_b3 = payload.conflict) != null ? _b3 : "ask",
3369
3369
  fileName: payload.fileName,
3370
3370
  mimeType: payload.mimeType,
@@ -3373,9 +3373,9 @@ var toInitPayloadForFunctions = (payload) => {
3373
3373
  };
3374
3374
  };
3375
3375
  var normalizeInitResponseFromFunctions = (response) => {
3376
- var _a26, _b3, _c, _d, _e, _f, _g, _h, _i, _j;
3376
+ var _a25, _b3, _c, _d, _e, _f, _g, _h, _i, _j;
3377
3377
  const payload = response != null ? response : {};
3378
- const existingRaw = (_a26 = payload.existingAsset) != null ? _a26 : payload.existing_asset;
3378
+ const existingRaw = (_a25 = payload.existingAsset) != null ? _a25 : payload.existing_asset;
3379
3379
  const existingAsset = existingRaw ? (_b3 = mapGenericRowToAsset(existingRaw)) != null ? _b3 : void 0 : void 0;
3380
3380
  const assetRaw = payload.asset;
3381
3381
  const asset = assetRaw ? (_c = mapGenericRowToAsset(assetRaw)) != null ? _c : void 0 : void 0;
@@ -3452,10 +3452,10 @@ var uploadBinaryWithProgress = async (config, file, payload, onProgress) => {
3452
3452
  });
3453
3453
  };
3454
3454
  var toCompletePayloadForFunctions = (payload) => {
3455
- var _a26, _b3, _c;
3455
+ var _a25, _b3, _c;
3456
3456
  return {
3457
3457
  uploadId: payload.uploadId,
3458
- assetDraftId: (_a26 = payload.assetDraftId) != null ? _a26 : payload.assetId,
3458
+ assetDraftId: (_a25 = payload.assetDraftId) != null ? _a25 : payload.assetId,
3459
3459
  storageKey: payload.storageKey,
3460
3460
  finalFilename: (_b3 = payload.finalFilename) != null ? _b3 : payload.fileName,
3461
3461
  folder_id: (_c = payload.folderId) != null ? _c : null,
@@ -3465,9 +3465,9 @@ var toCompletePayloadForFunctions = (payload) => {
3465
3465
  };
3466
3466
  };
3467
3467
  var normalizeCompleteResponseFromFunctions = (response) => {
3468
- var _a26, _b3, _c, _d, _e, _f;
3468
+ var _a25, _b3, _c, _d, _e, _f;
3469
3469
  const payload = response != null ? response : {};
3470
- const assetRaw = (_a26 = payload.asset) != null ? _a26 : payload;
3470
+ const assetRaw = (_a25 = payload.asset) != null ? _a25 : payload;
3471
3471
  const mapped = mapGenericRowToAsset(assetRaw);
3472
3472
  if (mapped) {
3473
3473
  const title = readFirstString(assetRaw, ["title", "title_text"]);
@@ -3496,7 +3496,7 @@ var normalizeCompleteResponseFromFunctions = (response) => {
3496
3496
  return { asset: { id: assetId } };
3497
3497
  };
3498
3498
  var toMetaPayloadForFunctions = (payload) => {
3499
- var _a26;
3499
+ var _a25;
3500
3500
  if (payload.action && payload.action !== "update") {
3501
3501
  return payload;
3502
3502
  }
@@ -3506,7 +3506,7 @@ var toMetaPayloadForFunctions = (payload) => {
3506
3506
  en: {},
3507
3507
  es: {}
3508
3508
  };
3509
- const target = (_a26 = byLanguage[language]) != null ? _a26 : byLanguage.pt;
3509
+ const target = (_a25 = byLanguage[language]) != null ? _a25 : byLanguage.pt;
3510
3510
  if (payload.meta) {
3511
3511
  if (typeof payload.meta.alt === "string") target.alt = payload.meta.alt;
3512
3512
  if (typeof payload.meta.title === "string") target.title = payload.meta.title;
@@ -3536,7 +3536,7 @@ var createTelescupClient = (config) => ({
3536
3536
  return normalizeListResponseFromFunctions(response, filters);
3537
3537
  },
3538
3538
  initUpload: async (payload) => {
3539
- var _a26;
3539
+ var _a25;
3540
3540
  try {
3541
3541
  const response = await request(
3542
3542
  config,
@@ -3549,7 +3549,7 @@ var createTelescupClient = (config) => ({
3549
3549
  return normalizeInitResponseFromFunctions(response);
3550
3550
  } catch (error) {
3551
3551
  if (error instanceof TelescupClientError && error.status === 409) {
3552
- const details = (_a26 = error.details) != null ? _a26 : {};
3552
+ const details = (_a25 = error.details) != null ? _a25 : {};
3553
3553
  const hasConflictPayload = Boolean(
3554
3554
  details.existingAsset || details.existing_asset || details.conflict || details.duplicate || details.suggestedName || details.suggested_name
3555
3555
  );
@@ -3577,14 +3577,14 @@ var createTelescupClient = (config) => ({
3577
3577
  body: toMetaPayloadForFunctions(payload)
3578
3578
  }),
3579
3579
  generateAlt: async (asset, language = "pt") => {
3580
- var _a26, _b3, _c;
3580
+ var _a25, _b3, _c;
3581
3581
  const response = await request(config, "generate-alt", {
3582
3582
  method: "POST",
3583
3583
  body: {
3584
3584
  items: [
3585
3585
  {
3586
3586
  id: asset.id,
3587
- file_path: (_a26 = asset.filePath) != null ? _a26 : asset.storageKey,
3587
+ file_path: (_a25 = asset.filePath) != null ? _a25 : asset.storageKey,
3588
3588
  mime_type: asset.mimeType
3589
3589
  }
3590
3590
  ],
@@ -3614,12 +3614,12 @@ var createTelescupClient = (config) => ({
3614
3614
  });
3615
3615
  const payload = response != null ? response : {};
3616
3616
  const toMeta = (value) => {
3617
- var _a26;
3617
+ var _a25;
3618
3618
  if (!value || typeof value !== "object") return void 0;
3619
3619
  const row = value;
3620
3620
  const title = readString(row.title);
3621
3621
  const alt = readString(row.alt);
3622
- const description = (_a26 = readString(row.description)) != null ? _a26 : readString(row.desc);
3622
+ const description = (_a25 = readString(row.description)) != null ? _a25 : readString(row.desc);
3623
3623
  if (!title && !alt && !description) return void 0;
3624
3624
  return {
3625
3625
  ...title ? { title } : {},
@@ -3649,17 +3649,17 @@ var mergeFacetValues = (current, incoming) => {
3649
3649
  const map = /* @__PURE__ */ new Map();
3650
3650
  current == null ? void 0 : current.forEach((entry) => map.set(entry.value, entry));
3651
3651
  incoming == null ? void 0 : incoming.forEach((entry) => {
3652
- var _a26, _b3, _c;
3652
+ var _a25, _b3, _c;
3653
3653
  const previous = map.get(entry.value);
3654
3654
  map.set(entry.value, {
3655
3655
  value: entry.value,
3656
- label: (_b3 = (_a26 = entry.label) != null ? _a26 : previous == null ? void 0 : previous.label) != null ? _b3 : entry.value,
3656
+ label: (_b3 = (_a25 = entry.label) != null ? _a25 : previous == null ? void 0 : previous.label) != null ? _b3 : entry.value,
3657
3657
  count: (_c = entry.count) != null ? _c : previous == null ? void 0 : previous.count
3658
3658
  });
3659
3659
  });
3660
3660
  return Array.from(map.values()).sort((a, b) => {
3661
- var _a26, _b3;
3662
- return ((_a26 = a.label) != null ? _a26 : a.value).localeCompare((_b3 = b.label) != null ? _b3 : b.value);
3661
+ var _a25, _b3;
3662
+ return ((_a25 = a.label) != null ? _a25 : a.value).localeCompare((_b3 = b.label) != null ? _b3 : b.value);
3663
3663
  });
3664
3664
  };
3665
3665
  var DEFAULT_CACHE_MS = 3e5;
@@ -3668,8 +3668,8 @@ var inFlight = /* @__PURE__ */ new Map();
3668
3668
  var LIST_CACHE_STORAGE_PREFIX = "telescup:list:v4";
3669
3669
  var canUseLocalStorage = () => typeof window !== "undefined" && typeof window.localStorage !== "undefined";
3670
3670
  var isEmptyAssetsState = (data) => {
3671
- var _a26, _b3;
3672
- return !((_a26 = data == null ? void 0 : data.items) == null ? void 0 : _a26.length) && ((_b3 = data == null ? void 0 : data.total) != null ? _b3 : 0) === 0;
3671
+ var _a25, _b3;
3672
+ return !((_a25 = data == null ? void 0 : data.items) == null ? void 0 : _a25.length) && ((_b3 = data == null ? void 0 : data.total) != null ? _b3 : 0) === 0;
3673
3673
  };
3674
3674
  var isCacheableAssetsState = (data) => !isEmptyAssetsState(data);
3675
3675
  var readPersistentCache = (key, cacheTimeMs) => {
@@ -3803,9 +3803,9 @@ function useTelescupAssets(options) {
3803
3803
  ...sanitizeFilters(filters),
3804
3804
  pageSize
3805
3805
  }).then((data) => {
3806
- var _a26;
3806
+ var _a25;
3807
3807
  return {
3808
- items: (_a26 = data.items) != null ? _a26 : [],
3808
+ items: (_a25 = data.items) != null ? _a25 : [],
3809
3809
  nextCursor: data.nextCursor,
3810
3810
  total: data.total,
3811
3811
  facets: data.facets
@@ -3833,7 +3833,7 @@ function useTelescupAssets(options) {
3833
3833
  [cacheKey, cacheTimeMs, enabled, filters, pageSize, resolvedClient]
3834
3834
  );
3835
3835
  const loadMore = useCallback(async () => {
3836
- var _a26, _b3, _c, _d, _e, _f, _g;
3836
+ var _a25, _b3, _c, _d, _e, _f, _g;
3837
3837
  if (!state.nextCursor || isLoadingMore || isLoading) return;
3838
3838
  const requestSeq = requestSeqRef.current;
3839
3839
  setIsLoadingMore(true);
@@ -3847,7 +3847,7 @@ function useTelescupAssets(options) {
3847
3847
  });
3848
3848
  if (!aliveRef.current || requestSeq !== requestSeqRef.current) return;
3849
3849
  const merged = {
3850
- items: [...state.items, ...(_a26 = data.items) != null ? _a26 : []],
3850
+ items: [...state.items, ...(_a25 = data.items) != null ? _a25 : []],
3851
3851
  nextCursor: data.nextCursor,
3852
3852
  total: (_b3 = data.total) != null ? _b3 : state.total,
3853
3853
  facets: {
@@ -4149,8 +4149,8 @@ var IMAGE_EXTENSIONS = /* @__PURE__ */ new Set(["jpg", "jpeg", "png", "gif", "we
4149
4149
  var VIDEO_EXTENSIONS = /* @__PURE__ */ new Set(["mp4", "mov", "webm", "mkv", "avi", "m4v", "wmv"]);
4150
4150
  var AUDIO_EXTENSIONS = /* @__PURE__ */ new Set(["mp3", "wav", "aac", "ogg", "flac", "m4a"]);
4151
4151
  var resolveAssetFamily = (asset) => {
4152
- var _a26, _b3, _c;
4153
- const explicitType = (_a26 = asset.type) == null ? void 0 : _a26.toLowerCase();
4152
+ var _a25, _b3, _c;
4153
+ const explicitType = (_a25 = asset.type) == null ? void 0 : _a25.toLowerCase();
4154
4154
  if (explicitType === "image" || explicitType === "video" || explicitType === "audio" || explicitType === "file") {
4155
4155
  return explicitType;
4156
4156
  }
@@ -4166,9 +4166,9 @@ var resolveAssetFamily = (asset) => {
4166
4166
  return "file";
4167
4167
  };
4168
4168
  var matchesAllowedAsset = (asset, allowed) => {
4169
- var _a26, _b3, _c, _d;
4169
+ var _a25, _b3, _c, _d;
4170
4170
  if (!allowed || allowed.length === 0) return true;
4171
- const mime = (_b3 = (_a26 = asset.mimeType) == null ? void 0 : _a26.toLowerCase()) != null ? _b3 : "";
4171
+ const mime = (_b3 = (_a25 = asset.mimeType) == null ? void 0 : _a25.toLowerCase()) != null ? _b3 : "";
4172
4172
  const ext = asset.extension ? `.${asset.extension.toLowerCase()}` : "";
4173
4173
  const type = (_d = (_c = asset.type) == null ? void 0 : _c.toLowerCase()) != null ? _d : "";
4174
4174
  const family = resolveAssetFamily(asset);
@@ -4224,10 +4224,10 @@ var UUID_REGEX2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[
4224
4224
  var ROOT_FOLDERS_TO_HIDE = /* @__PURE__ */ new Set(["images", "videos"]);
4225
4225
  var normalizeFolderToken = (value) => value.trim().replace(/^\/+|\/+$/g, "").toLowerCase();
4226
4226
  var getLeafName = (value) => {
4227
- var _a26;
4227
+ var _a25;
4228
4228
  const normalized = normalizeFolderToken(value);
4229
4229
  const parts = normalized.split("/").filter(Boolean);
4230
- return (_a26 = parts[parts.length - 1]) != null ? _a26 : normalized;
4230
+ return (_a25 = parts[parts.length - 1]) != null ? _a25 : normalized;
4231
4231
  };
4232
4232
  var scoreFolderValue = (value, label) => {
4233
4233
  const normalizedValue = normalizeFolderToken(value);
@@ -4243,8 +4243,8 @@ var normalizeFacetOptions = (entries) => {
4243
4243
  if (!entries || !entries.length) return [];
4244
4244
  const byLabel = /* @__PURE__ */ new Map();
4245
4245
  entries.forEach((entry) => {
4246
- var _a26, _b3, _c, _d;
4247
- const value = (_a26 = entry.value) == null ? void 0 : _a26.trim();
4246
+ var _a25, _b3, _c, _d;
4247
+ const value = (_a25 = entry.value) == null ? void 0 : _a25.trim();
4248
4248
  if (!value) return;
4249
4249
  const label = ((_b3 = entry.label) == null ? void 0 : _b3.trim()) || value;
4250
4250
  const key = normalizeFolderToken(label);
@@ -4274,16 +4274,16 @@ var normalizeFacetOptions = (entries) => {
4274
4274
  const options = Array.from(byLabel.values());
4275
4275
  const groups = /* @__PURE__ */ new Map();
4276
4276
  options.forEach((option) => {
4277
- var _a26;
4277
+ var _a25;
4278
4278
  const leaf = getLeafName(option.label || option.value);
4279
- const list = (_a26 = groups.get(leaf)) != null ? _a26 : [];
4279
+ const list = (_a25 = groups.get(leaf)) != null ? _a25 : [];
4280
4280
  list.push(option);
4281
4281
  groups.set(leaf, list);
4282
4282
  });
4283
4283
  const collapsed = options.filter((option) => {
4284
- var _a26;
4284
+ var _a25;
4285
4285
  const leaf = getLeafName(option.label || option.value);
4286
- const group = (_a26 = groups.get(leaf)) != null ? _a26 : [];
4286
+ const group = (_a25 = groups.get(leaf)) != null ? _a25 : [];
4287
4287
  const hasPathVariant = group.some((entry) => normalizeFolderToken(entry.label).includes("/"));
4288
4288
  if (!hasPathVariant) return true;
4289
4289
  return normalizeFolderToken(option.label).includes("/");
@@ -4294,8 +4294,8 @@ var normalizeFacetOptions = (entries) => {
4294
4294
  var collectFacetOptions = (items, pick, pickLabel) => {
4295
4295
  const options = /* @__PURE__ */ new Map();
4296
4296
  items.forEach((asset) => {
4297
- var _a26, _b3, _c, _d;
4298
- const value = (_a26 = pick(asset)) == null ? void 0 : _a26.trim();
4297
+ var _a25, _b3, _c, _d;
4298
+ const value = (_a25 = pick(asset)) == null ? void 0 : _a25.trim();
4299
4299
  if (!value) return;
4300
4300
  const current = options.get(value);
4301
4301
  options.set(value, {
@@ -4377,21 +4377,21 @@ var TelescupAssetPicker = ({
4377
4377
  return folderOptions.find((option) => option.value === folderFilter);
4378
4378
  }, [folderFilter, folderOptions]);
4379
4379
  const filteredItems = useMemo4(() => {
4380
- var _a26;
4380
+ var _a25;
4381
4381
  const selectedFolderAliases = new Set(
4382
- ((_a26 = selectedFolderOption == null ? void 0 : selectedFolderOption.aliases) != null ? _a26 : folderFilter === "all" ? [] : [folderFilter]).map(
4382
+ ((_a25 = selectedFolderOption == null ? void 0 : selectedFolderOption.aliases) != null ? _a25 : folderFilter === "all" ? [] : [folderFilter]).map(
4383
4383
  (entry) => normalizeFolderToken(entry)
4384
4384
  )
4385
4385
  );
4386
4386
  return items.filter((asset) => {
4387
- var _a27, _b3;
4387
+ var _a26, _b3;
4388
4388
  if (!matchesAllowedAsset(asset, allowedTypes)) return false;
4389
4389
  if (typeFilter !== "all") {
4390
4390
  const family = resolveAssetFamily(asset);
4391
4391
  if (family !== typeFilter) return false;
4392
4392
  }
4393
4393
  if (folderFilter !== "all") {
4394
- const folderIdToken = normalizeFolderToken((_a27 = asset.folderId) != null ? _a27 : "");
4394
+ const folderIdToken = normalizeFolderToken((_a26 = asset.folderId) != null ? _a26 : "");
4395
4395
  const folderNameToken = normalizeFolderToken((_b3 = asset.folderName) != null ? _b3 : "");
4396
4396
  if (!selectedFolderAliases.has(folderIdToken) && !selectedFolderAliases.has(folderNameToken)) {
4397
4397
  return false;
@@ -4687,14 +4687,14 @@ function useTelescupUploadQueue(options) {
4687
4687
  activeRef.current += 1;
4688
4688
  updateItem(next.id, { status: "uploading", progress: 0, error: void 0 });
4689
4689
  const run = async () => {
4690
- var _a26, _b3, _c;
4690
+ var _a25, _b3, _c;
4691
4691
  try {
4692
4692
  const init = await client.initUpload({
4693
4693
  fileName: next.file.name,
4694
4694
  size: next.file.size,
4695
4695
  mimeType: next.file.type,
4696
4696
  folderId,
4697
- conflict: (_a26 = next.conflictPolicy) != null ? _a26 : conflictPolicy
4697
+ conflict: (_a25 = next.conflictPolicy) != null ? _a25 : conflictPolicy
4698
4698
  });
4699
4699
  const conflictDetected = init.conflict === "ask" || init.conflict === "conflict" || init.conflict === "exists" || init.existingAsset && !init.uploadUrl;
4700
4700
  if (conflictDetected) {
@@ -4893,8 +4893,8 @@ Progress.displayName = ProgressPrimitive.Root.displayName;
4893
4893
  // src/components/cupcode/TelescupUploader.tsx
4894
4894
  import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
4895
4895
  var formatLabel = (template, values) => template.replace(/\{(\w+)\}/g, (_, key) => {
4896
- var _a26;
4897
- return (_a26 = values[key]) != null ? _a26 : "";
4896
+ var _a25;
4897
+ return (_a25 = values[key]) != null ? _a25 : "";
4898
4898
  });
4899
4899
  var suggestRename = (filename) => {
4900
4900
  const dot = filename.lastIndexOf(".");
@@ -5012,7 +5012,7 @@ var TelescupUploader = ({
5012
5012
  queue.length > 0 ? /* @__PURE__ */ jsx29(Button, { variant: "ghost", size: "sm", onClick: clearFinished, children: labels.uploader.clearFinished }) : null
5013
5013
  ] }),
5014
5014
  /* @__PURE__ */ jsx29("div", { className: "space-y-3", children: queue.length === 0 ? /* @__PURE__ */ jsx29("div", { className: "rounded-md border border-border bg-muted/30 p-4 text-sm text-muted-foreground", children: labels.uploader.ready }) : queue.map((item) => {
5015
- var _a26;
5015
+ var _a25;
5016
5016
  const suggestedName = item.suggestedName || suggestRename(item.file.name);
5017
5017
  const conflictDescription = formatLabel(labels.conflict.descriptionWithSuggestion, {
5018
5018
  filename: item.file.name,
@@ -5033,7 +5033,7 @@ var TelescupUploader = ({
5033
5033
  item.status === "conflict" ? /* @__PURE__ */ jsxs18("div", { className: "mt-3 space-y-3 rounded-md border border-amber-500/30 bg-amber-500/5 p-3", children: [
5034
5034
  /* @__PURE__ */ jsx29("p", { className: "text-sm text-foreground", children: conflictDescription }),
5035
5035
  /* @__PURE__ */ jsx29("p", { className: "text-xs text-muted-foreground", children: formatLabel(labels.conflict.queueHint, { filename: item.file.name }) }),
5036
- ((_a26 = item.existingAsset) == null ? void 0 : _a26.id) ? /* @__PURE__ */ jsxs18("div", { className: "rounded-md border border-border bg-muted/30 p-3", children: [
5036
+ ((_a25 = item.existingAsset) == null ? void 0 : _a25.id) ? /* @__PURE__ */ jsxs18("div", { className: "rounded-md border border-border bg-muted/30 p-3", children: [
5037
5037
  /* @__PURE__ */ jsx29("p", { className: "text-xs font-semibold text-muted-foreground", children: labels.conflict.existingLabel }),
5038
5038
  /* @__PURE__ */ jsx29("p", { className: "mt-1 truncate text-xs text-foreground", children: item.existingAsset.name || item.existingAsset.fileName || item.existingAsset.id }),
5039
5039
  /* @__PURE__ */ jsx29("div", { className: "mt-2 h-28 overflow-hidden rounded-md", children: /* @__PURE__ */ jsx29(
@@ -5281,7 +5281,7 @@ var DEFAULT_LABELS = {
5281
5281
  }
5282
5282
  };
5283
5283
  var mergeLabels = (overrides) => {
5284
- var _a26;
5284
+ var _a25;
5285
5285
  if (!overrides) return DEFAULT_LABELS;
5286
5286
  return {
5287
5287
  ...DEFAULT_LABELS,
@@ -5295,7 +5295,7 @@ var mergeLabels = (overrides) => {
5295
5295
  meta: {
5296
5296
  ...DEFAULT_LABELS.meta,
5297
5297
  ...overrides.meta,
5298
- fields: { ...DEFAULT_LABELS.meta.fields, ...(_a26 = overrides.meta) == null ? void 0 : _a26.fields }
5298
+ fields: { ...DEFAULT_LABELS.meta.fields, ...(_a25 = overrides.meta) == null ? void 0 : _a25.fields }
5299
5299
  },
5300
5300
  toasts: { ...DEFAULT_LABELS.toasts, ...overrides.toasts }
5301
5301
  };
@@ -5314,9 +5314,9 @@ var normalizeApiLanguageKey = (value) => {
5314
5314
  return "pt-BR";
5315
5315
  };
5316
5316
  var getAssetMeta = (asset, lang) => {
5317
- var _a26, _b3;
5317
+ var _a25, _b3;
5318
5318
  if (!asset) return {};
5319
- if ((_a26 = asset.metaByLang) == null ? void 0 : _a26[lang]) return asset.metaByLang[lang];
5319
+ if ((_a25 = asset.metaByLang) == null ? void 0 : _a25[lang]) return asset.metaByLang[lang];
5320
5320
  return (_b3 = asset.meta) != null ? _b3 : {};
5321
5321
  };
5322
5322
  var TelescupMetaEditor = ({
@@ -5327,8 +5327,8 @@ var TelescupMetaEditor = ({
5327
5327
  labels,
5328
5328
  onAssetUpdated
5329
5329
  }) => {
5330
- var _a26, _b3, _c, _d, _e, _f, _g, _h;
5331
- const [activeAssetId, setActiveAssetId] = useState10((_b3 = (_a26 = assets[0]) == null ? void 0 : _a26.id) != null ? _b3 : "");
5330
+ var _a25, _b3, _c, _d, _e, _f, _g, _h;
5331
+ const [activeAssetId, setActiveAssetId] = useState10((_b3 = (_a25 = assets[0]) == null ? void 0 : _a25.id) != null ? _b3 : "");
5332
5332
  const [activeLang, setActiveLang] = useState10(
5333
5333
  LANGUAGES.includes(defaultLanguage) ? defaultLanguage : "pt"
5334
5334
  );
@@ -5346,18 +5346,18 @@ var TelescupMetaEditor = ({
5346
5346
  }, [activeAssetId, assets]);
5347
5347
  const asset = assets.find((item) => item.id === activeAssetId);
5348
5348
  const currentDraft = useMemo7(() => {
5349
- var _a27;
5350
- const existing = (_a27 = drafts[activeAssetId]) == null ? void 0 : _a27[activeLang];
5349
+ var _a26;
5350
+ const existing = (_a26 = drafts[activeAssetId]) == null ? void 0 : _a26[activeLang];
5351
5351
  if (existing) return existing;
5352
5352
  return getAssetMeta(asset, activeLang);
5353
5353
  }, [activeAssetId, activeLang, asset, drafts]);
5354
5354
  const updateDraft = (field, value) => {
5355
5355
  setDrafts((prev) => {
5356
- var _a27;
5356
+ var _a26;
5357
5357
  return {
5358
5358
  ...prev,
5359
5359
  [activeAssetId]: {
5360
- ...(_a27 = prev[activeAssetId]) != null ? _a27 : {},
5360
+ ...(_a26 = prev[activeAssetId]) != null ? _a26 : {},
5361
5361
  [activeLang]: {
5362
5362
  ...currentDraft,
5363
5363
  [field]: value
@@ -5425,11 +5425,11 @@ var TelescupMetaEditor = ({
5425
5425
  onAssetUpdated == null ? void 0 : onAssetUpdated(updated);
5426
5426
  const updatedMeta = getAssetMeta(updated, activeLang);
5427
5427
  setDrafts((prev) => {
5428
- var _a27;
5428
+ var _a26;
5429
5429
  return {
5430
5430
  ...prev,
5431
5431
  [asset.id]: {
5432
- ...(_a27 = prev[asset.id]) != null ? _a27 : {},
5432
+ ...(_a26 = prev[asset.id]) != null ? _a26 : {},
5433
5433
  [activeLang]: updatedMeta
5434
5434
  }
5435
5435
  };
@@ -5595,9 +5595,9 @@ var TelescupUpload = ({
5595
5595
  }, []);
5596
5596
  const enrichUploadedAsset = useCallback4(
5597
5597
  async (asset) => {
5598
- var _a26, _b3, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
5598
+ var _a25, _b3, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
5599
5599
  if (!autoGenerateMetadataOnUpload) return asset;
5600
- const mimeType = (_b3 = (_a26 = asset.mimeType) == null ? void 0 : _a26.toLowerCase()) != null ? _b3 : "";
5600
+ const mimeType = (_b3 = (_a25 = asset.mimeType) == null ? void 0 : _a25.toLowerCase()) != null ? _b3 : "";
5601
5601
  const assetType = (_d = (_c = asset.type) == null ? void 0 : _c.toLowerCase()) != null ? _d : "";
5602
5602
  const isImage = assetType === "image" || mimeType.startsWith("image/");
5603
5603
  if (!isImage) return asset;
@@ -5861,16 +5861,16 @@ var toStringOrUndefined = (value) => {
5861
5861
  };
5862
5862
  var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
5863
5863
  var resolveAccountsApiBaseUrl = () => {
5864
- var _a26, _b3, _c, _d;
5865
- const appsApiBase = ((_b3 = (_a26 = getRuntimeEnv("VITE_APPS_API_BASE_URL")) != null ? _a26 : getRuntimeEnv("VITE_APPS_API_BASE")) != null ? _b3 : "").trim().replace(/\/+$/, "");
5864
+ var _a25, _b3, _c, _d;
5865
+ const appsApiBase = ((_b3 = (_a25 = getRuntimeEnv("VITE_APPS_API_BASE_URL")) != null ? _a25 : getRuntimeEnv("VITE_APPS_API_BASE")) != null ? _b3 : "").trim().replace(/\/+$/, "");
5866
5866
  if (appsApiBase) return `${appsApiBase}/api/accounts`;
5867
5867
  const accountsBase = ((_c = getRuntimeEnv("VITE_ACCOUNTS_BASE_URL")) != null ? _c : "https://accounts.cupcode.com.br").trim().replace(/\/+$/, "");
5868
5868
  const accountsApi = ((_d = getRuntimeEnv("VITE_ACCOUNTS_API_BASE_URL")) != null ? _d : "").trim().replace(/\/+$/, "");
5869
5869
  return accountsApi || accountsBase;
5870
5870
  };
5871
5871
  var parseBrowserFromUserAgent = (userAgent) => {
5872
- var _a26;
5873
- const ua = (_a26 = userAgent == null ? void 0 : userAgent.trim()) != null ? _a26 : "";
5872
+ var _a25;
5873
+ const ua = (_a25 = userAgent == null ? void 0 : userAgent.trim()) != null ? _a25 : "";
5874
5874
  if (!ua) return "Desconhecido";
5875
5875
  if (/Edg\//.test(ua)) return "Edge";
5876
5876
  if (/Chrome\//.test(ua)) return "Chrome";
@@ -5880,8 +5880,8 @@ var parseBrowserFromUserAgent = (userAgent) => {
5880
5880
  return ua.split(" ")[0] || "Desconhecido";
5881
5881
  };
5882
5882
  var parseOsFromUserAgent = (userAgent) => {
5883
- var _a26;
5884
- const ua = (_a26 = userAgent == null ? void 0 : userAgent.trim()) != null ? _a26 : "";
5883
+ var _a25;
5884
+ const ua = (_a25 = userAgent == null ? void 0 : userAgent.trim()) != null ? _a25 : "";
5885
5885
  if (!ua) return null;
5886
5886
  if (/Windows NT/.test(ua)) return "Windows";
5887
5887
  if (/Mac OS X/.test(ua)) return "macOS";
@@ -5893,8 +5893,8 @@ var parseOsFromUserAgent = (userAgent) => {
5893
5893
  var normalizeLoginHistorySessions = (value) => {
5894
5894
  if (!Array.isArray(value)) return [];
5895
5895
  return value.filter(isRecord).map((row, index) => {
5896
- var _a26, _b3, _c, _d, _e, _f;
5897
- const id = (_a26 = toStringOrUndefined(row.id)) != null ? _a26 : `session-${index}`;
5896
+ var _a25, _b3, _c, _d, _e, _f;
5897
+ const id = (_a25 = toStringOrUndefined(row.id)) != null ? _a25 : `session-${index}`;
5898
5898
  return {
5899
5899
  id,
5900
5900
  createdAt: (_b3 = toStringOrUndefined(row.created_at)) != null ? _b3 : toStringOrUndefined(row.createdAt),
@@ -5914,18 +5914,18 @@ var isLoginHistorySessionActive = (session, now = Date.now()) => {
5914
5914
  return Boolean(session.active) && expiresAt2 > now;
5915
5915
  };
5916
5916
  var readStoredAccessToken = () => {
5917
- var _a26;
5917
+ var _a25;
5918
5918
  if (typeof window === "undefined") return null;
5919
5919
  const keys = ["cc_access_token", "access_token"];
5920
5920
  for (const key of keys) {
5921
- const value = (_a26 = window.sessionStorage.getItem(key)) == null ? void 0 : _a26.trim();
5921
+ const value = (_a25 = window.sessionStorage.getItem(key)) == null ? void 0 : _a25.trim();
5922
5922
  if (value) return value;
5923
5923
  }
5924
5924
  return null;
5925
5925
  };
5926
5926
  async function fetchAccountsLoginHistory(options) {
5927
- var _a26;
5928
- const base = ((_a26 = options == null ? void 0 : options.accountsApiBaseUrl) != null ? _a26 : resolveAccountsApiBaseUrl()).replace(/\/+$/, "");
5927
+ var _a25;
5928
+ const base = ((_a25 = options == null ? void 0 : options.accountsApiBaseUrl) != null ? _a25 : resolveAccountsApiBaseUrl()).replace(/\/+$/, "");
5929
5929
  const resolveToken = async () => {
5930
5930
  if (options == null ? void 0 : options.getAccessToken) {
5931
5931
  try {
@@ -6017,13 +6017,13 @@ var LoginHistoryCupcode = ({
6017
6017
  );
6018
6018
  }
6019
6019
  return /* @__PURE__ */ jsx34("div", { className: cn(isCompact ? "space-y-1.5" : "space-y-2", className), children: visibleSessions.map((session, index) => {
6020
- var _a26;
6020
+ var _a25;
6021
6021
  const browser = parseBrowserFromUserAgent(session.userAgent);
6022
6022
  const os = parseOsFromUserAgent(session.userAgent);
6023
6023
  const isActive = isLoginHistorySessionActive(session);
6024
6024
  const loginLabel = formatDateTime(session.createdAt);
6025
6025
  const lastSeenLabel = formatDateTime(session.lastSeen);
6026
- const ip = ((_a26 = session.ip) == null ? void 0 : _a26.trim()) || "unknown";
6026
+ const ip = ((_a25 = session.ip) == null ? void 0 : _a25.trim()) || "unknown";
6027
6027
  return /* @__PURE__ */ jsxs21(
6028
6028
  "div",
6029
6029
  {
@@ -6110,14 +6110,14 @@ function parseStoredThemePreference(value) {
6110
6110
  return value === "light" || value === "dark" || value === "system" ? value : null;
6111
6111
  }
6112
6112
  function normalizeStoredThemePreference(value) {
6113
- var _a26;
6114
- return (_a26 = parseStoredThemePreference(value)) != null ? _a26 : "system";
6113
+ var _a25;
6114
+ return (_a25 = parseStoredThemePreference(value)) != null ? _a25 : "system";
6115
6115
  }
6116
6116
  function readStoredThemeMode() {
6117
- var _a26;
6117
+ var _a25;
6118
6118
  if (typeof window === "undefined") return null;
6119
6119
  try {
6120
- const storedTheme = (_a26 = window.localStorage.getItem(THEME_STORAGE_KEY)) != null ? _a26 : window.localStorage.getItem(LEGACY_THEME_STORAGE_KEY);
6120
+ const storedTheme = (_a25 = window.localStorage.getItem(THEME_STORAGE_KEY)) != null ? _a25 : window.localStorage.getItem(LEGACY_THEME_STORAGE_KEY);
6121
6121
  return isStoredThemeMode(storedTheme) ? storedTheme : null;
6122
6122
  } catch (e) {
6123
6123
  return null;
@@ -6173,7 +6173,7 @@ function persistThemePreferenceSelection(preference) {
6173
6173
  );
6174
6174
  }
6175
6175
  function resolveStoredThemePreference(experienceSettingsTheme) {
6176
- var _a26;
6176
+ var _a25;
6177
6177
  if (typeof window === "undefined") {
6178
6178
  return normalizeStoredThemePreference(experienceSettingsTheme);
6179
6179
  }
@@ -6189,7 +6189,7 @@ function resolveStoredThemePreference(experienceSettingsTheme) {
6189
6189
  if (parsedExperienceTheme === "system" && storedThemeMode) {
6190
6190
  return storedThemeMode;
6191
6191
  }
6192
- return (_a26 = parsedExperienceTheme != null ? parsedExperienceTheme : storedThemeMode) != null ? _a26 : "system";
6192
+ return (_a25 = parsedExperienceTheme != null ? parsedExperienceTheme : storedThemeMode) != null ? _a25 : "system";
6193
6193
  } catch (e) {
6194
6194
  return normalizeStoredThemePreference(experienceSettingsTheme);
6195
6195
  }
@@ -6263,9 +6263,9 @@ var applyThemePreference = (preference) => {
6263
6263
  persistThemePreferenceSelection(preference);
6264
6264
  };
6265
6265
  var resolveTelescupImageUrl = (value, options) => {
6266
- var _a26, _b3, _c;
6266
+ var _a25, _b3, _c;
6267
6267
  return resolveTelescupImageURL(value, {
6268
- width: (_a26 = options == null ? void 0 : options.width) != null ? _a26 : 96,
6268
+ width: (_a25 = options == null ? void 0 : options.width) != null ? _a25 : 96,
6269
6269
  height: (_b3 = options == null ? void 0 : options.height) != null ? _b3 : 96,
6270
6270
  fit: "cover",
6271
6271
  format: "avif",
@@ -6273,8 +6273,8 @@ var resolveTelescupImageUrl = (value, options) => {
6273
6273
  });
6274
6274
  };
6275
6275
  var resolveProfileAvatarFromTelescup = (asset, fallbackId) => {
6276
- var _a26, _b3;
6277
- return (_b3 = (_a26 = resolveTelescupImageUrl(asset == null ? void 0 : asset.url, { width: 384, height: 384, quality: 80 })) != null ? _a26 : resolveTelescupImageUrl(asset == null ? void 0 : asset.id, { width: 384, height: 384, quality: 80 })) != null ? _b3 : resolveTelescupImageUrl(fallbackId, { width: 384, height: 384, quality: 80 });
6276
+ var _a25, _b3;
6277
+ return (_b3 = (_a25 = resolveTelescupImageUrl(asset == null ? void 0 : asset.url, { width: 384, height: 384, quality: 80 })) != null ? _a25 : resolveTelescupImageUrl(asset == null ? void 0 : asset.id, { width: 384, height: 384, quality: 80 })) != null ? _b3 : resolveTelescupImageUrl(fallbackId, { width: 384, height: 384, quality: 80 });
6278
6278
  };
6279
6279
  var normalizeLanguage = (value) => {
6280
6280
  const normalized = value == null ? void 0 : value.trim().toLowerCase();
@@ -6499,9 +6499,9 @@ var UserMenuCupcode = ({
6499
6499
  };
6500
6500
  const handleProfileAvatarChange = useCallback5(
6501
6501
  async (ids, assets) => {
6502
- var _a26, _b3, _c;
6502
+ var _a25, _b3, _c;
6503
6503
  const selectedAsset = assets == null ? void 0 : assets[0];
6504
- const selectedIdRaw = (_a26 = ids[0]) == null ? void 0 : _a26.trim();
6504
+ const selectedIdRaw = (_a25 = ids[0]) == null ? void 0 : _a25.trim();
6505
6505
  const selectedId = (_c = (_b3 = parseAssetId(selectedIdRaw)) != null ? _b3 : parseAssetId(selectedAsset == null ? void 0 : selectedAsset.id)) != null ? _c : parseAssetId(selectedAsset == null ? void 0 : selectedAsset.url);
6506
6506
  if (!selectedId) {
6507
6507
  toast({
@@ -6544,7 +6544,7 @@ var UserMenuCupcode = ({
6544
6544
  [isProfileAvatarSaving, onProfileAvatarChange, resolvedProfileAvatarUrl]
6545
6545
  );
6546
6546
  const renderDefaultPanel = () => {
6547
- var _a26;
6547
+ var _a25;
6548
6548
  if (activeTab === "profile") {
6549
6549
  return /* @__PURE__ */ jsxs22("div", { className: "space-y-4", children: [
6550
6550
  /* @__PURE__ */ jsxs22("div", { className: "pt-1 text-center", children: [
@@ -6714,7 +6714,7 @@ var UserMenuCupcode = ({
6714
6714
  "Idioma"
6715
6715
  ] }),
6716
6716
  /* @__PURE__ */ jsx35("div", { className: "mt-2", children: /* @__PURE__ */ jsxs22(Select, { value: resolvedLanguage, onValueChange: (value) => changeLanguage(value), children: [
6717
- /* @__PURE__ */ jsx35(SelectTrigger, { className: "h-9 rounded-md border-border/70 bg-background/55 text-[11px] text-foreground shadow-none", children: /* @__PURE__ */ jsx35("span", { className: "truncate", children: (_a26 = LANGUAGE_OPTIONS.find((option) => option.value === resolvedLanguage)) == null ? void 0 : _a26.label }) }),
6717
+ /* @__PURE__ */ jsx35(SelectTrigger, { className: "h-9 rounded-md border-border/70 bg-background/55 text-[11px] text-foreground shadow-none", children: /* @__PURE__ */ jsx35("span", { className: "truncate", children: (_a25 = LANGUAGE_OPTIONS.find((option) => option.value === resolvedLanguage)) == null ? void 0 : _a25.label }) }),
6718
6718
  /* @__PURE__ */ jsx35(SelectContent, { className: "z-[820] rounded-md border border-border/70 bg-background text-foreground shadow-none", children: LANGUAGE_OPTIONS.map((option) => /* @__PURE__ */ jsx35(SelectItem, { value: option.value, className: "text-xs", children: option.label }, option.value)) })
6719
6719
  ] }) })
6720
6720
  ] }) })
@@ -7501,10 +7501,10 @@ var ignoreLoopbackUrlOnPublicOrigin = (value) => {
7501
7501
  return isLoopbackUrl(value) ? void 0 : value;
7502
7502
  };
7503
7503
  var getAppsApiBaseUrl = () => {
7504
- var _a26, _b3;
7504
+ var _a25, _b3;
7505
7505
  return normalizeBaseUrl2(
7506
7506
  (_b3 = ignoreLoopbackUrlOnPublicOrigin(
7507
- (_a26 = getRuntimeEnv("VITE_APPS_API_BASE_URL")) != null ? _a26 : getRuntimeEnv("VITE_APPS_API_BASE")
7507
+ (_a25 = getRuntimeEnv("VITE_APPS_API_BASE_URL")) != null ? _a25 : getRuntimeEnv("VITE_APPS_API_BASE")
7508
7508
  )) != null ? _b3 : "https://api.apps.cupcode.com.br"
7509
7509
  );
7510
7510
  };
@@ -7537,15 +7537,15 @@ var fetchWithTimeout = async (input, init, timeoutMs = AUTH_REQUEST_TIMEOUT_MS)
7537
7537
  }
7538
7538
  };
7539
7539
  var resolveIssuerBaseUrl = () => {
7540
- var _a26;
7541
- const issuer = (_a26 = ignoreLoopbackUrlOnPublicOrigin(getRuntimeEnv("VITE_OIDC_ISSUER"))) != null ? _a26 : ignoreLoopbackUrlOnPublicOrigin(getRuntimeEnv("VITE_ACCOUNTS_BASE_URL"));
7540
+ var _a25;
7541
+ const issuer = (_a25 = ignoreLoopbackUrlOnPublicOrigin(getRuntimeEnv("VITE_OIDC_ISSUER"))) != null ? _a25 : ignoreLoopbackUrlOnPublicOrigin(getRuntimeEnv("VITE_ACCOUNTS_BASE_URL"));
7542
7542
  return issuer ? normalizeBaseUrl2(issuer) : void 0;
7543
7543
  };
7544
7544
  var getAccountsConfig = () => {
7545
- var _a26, _b3, _c, _d;
7545
+ var _a25, _b3, _c, _d;
7546
7546
  const issuerBaseUrl = resolveIssuerBaseUrl();
7547
7547
  const baseUrl = normalizeBaseUrl2(
7548
- (_a26 = issuerBaseUrl != null ? issuerBaseUrl : getRuntimeEnv("VITE_ACCOUNTS_BASE_URL")) != null ? _a26 : "https://accounts.cupcode.com.br"
7548
+ (_a25 = issuerBaseUrl != null ? issuerBaseUrl : getRuntimeEnv("VITE_ACCOUNTS_BASE_URL")) != null ? _a25 : "https://accounts.cupcode.com.br"
7549
7549
  );
7550
7550
  const clientId = getRuntimeEnv("VITE_ACCOUNTS_CLIENT_ID");
7551
7551
  if (!clientId) {
@@ -7572,7 +7572,7 @@ var getAccountsConfig = () => {
7572
7572
  };
7573
7573
  var cachedDiscovery = null;
7574
7574
  var resolveOidcEndpoints = async (config) => {
7575
- var _a26, _b3, _c, _d, _e, _f;
7575
+ var _a25, _b3, _c, _d, _e, _f;
7576
7576
  if (config.authUrl && config.tokenUrl) {
7577
7577
  return {
7578
7578
  authUrl: config.authUrl,
@@ -7582,7 +7582,7 @@ var resolveOidcEndpoints = async (config) => {
7582
7582
  }
7583
7583
  if (cachedDiscovery) {
7584
7584
  return {
7585
- authUrl: (_a26 = cachedDiscovery.authorization_endpoint) != null ? _a26 : config.authUrl,
7585
+ authUrl: (_a25 = cachedDiscovery.authorization_endpoint) != null ? _a25 : config.authUrl,
7586
7586
  tokenUrl: (_b3 = cachedDiscovery.token_endpoint) != null ? _b3 : config.tokenUrl,
7587
7587
  logoutUrl: (_c = cachedDiscovery.end_session_endpoint) != null ? _c : config.logoutUrl
7588
7588
  };
@@ -7792,10 +7792,10 @@ var resolveLocalTelescupRedirectUri = () => {
7792
7792
  return `${window.location.protocol}//localhost:${port}/oidc/callback`;
7793
7793
  };
7794
7794
  var readStorageItem = (key) => {
7795
- var _a26;
7795
+ var _a25;
7796
7796
  if (!canUseWindow()) return null;
7797
7797
  try {
7798
- return (_a26 = window.sessionStorage.getItem(key)) != null ? _a26 : window.localStorage.getItem(key);
7798
+ return (_a25 = window.sessionStorage.getItem(key)) != null ? _a25 : window.localStorage.getItem(key);
7799
7799
  } catch (e) {
7800
7800
  return null;
7801
7801
  }
@@ -7905,10 +7905,10 @@ var getPopupOrigin = () => {
7905
7905
  return window.location.origin;
7906
7906
  };
7907
7907
  var getTelescupAccountsConfig = () => {
7908
- var _a26, _b3, _c, _d, _e, _f, _g, _h, _i, _j, _k;
7908
+ var _a25, _b3, _c, _d, _e, _f, _g, _h, _i, _j, _k;
7909
7909
  const primary = getAccountsConfig();
7910
7910
  const runtimeRedirectUri = ignoreLoopbackUrlOnPublicOrigin2(
7911
- (_a26 = getRuntimeEnv("VITE_TELESCUP_ACCOUNTS_REDIRECT_URI")) != null ? _a26 : getRuntimeEnv("VITE_TELESCUP_OIDC_REDIRECT_URI")
7911
+ (_a25 = getRuntimeEnv("VITE_TELESCUP_ACCOUNTS_REDIRECT_URI")) != null ? _a25 : getRuntimeEnv("VITE_TELESCUP_OIDC_REDIRECT_URI")
7912
7912
  );
7913
7913
  const fallbackRedirectUri = canUseWindow() ? `${window.location.origin}/oidc/callback` : "http://localhost:8083/oidc/callback";
7914
7914
  const redirectUri = isLocalBrowserOrigin2() && runtimeRedirectUri && !runtimeRedirectUri.includes("localhost") ? resolveLocalTelescupRedirectUri() : runtimeRedirectUri != null ? runtimeRedirectUri : fallbackRedirectUri;
@@ -7926,8 +7926,8 @@ var getTelescupAccountsConfig = () => {
7926
7926
  };
7927
7927
  };
7928
7928
  var buildTokenBundle = (tokens, config, previous) => {
7929
- var _a26, _b3, _c, _d, _e, _f;
7930
- const idToken = ((_a26 = tokens.id_token) == null ? void 0 : _a26.trim()) || (previous == null ? void 0 : previous.idToken) || "";
7929
+ var _a25, _b3, _c, _d, _e, _f;
7930
+ const idToken = ((_a25 = tokens.id_token) == null ? void 0 : _a25.trim()) || (previous == null ? void 0 : previous.idToken) || "";
7931
7931
  if (!idToken) {
7932
7932
  throw new Error("Token ID do Telescup n\xE3o retornado pelo Accounts.");
7933
7933
  }
@@ -7974,10 +7974,10 @@ var centerPopupFeatures = () => {
7974
7974
  return `popup,width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes`;
7975
7975
  };
7976
7976
  var notifyOpener = (result) => {
7977
- var _a26;
7977
+ var _a25;
7978
7978
  if (!canUseWindow()) return;
7979
7979
  try {
7980
- (_a26 = window.opener) == null ? void 0 : _a26.postMessage(result, getPopupOrigin());
7980
+ (_a25 = window.opener) == null ? void 0 : _a25.postMessage(result, getPopupOrigin());
7981
7981
  } catch (e) {
7982
7982
  }
7983
7983
  };
@@ -8086,7 +8086,7 @@ var ensureTelescupOidcToken = async () => {
8086
8086
  return pendingTokenPromise;
8087
8087
  };
8088
8088
  var completeTelescupOidcCallback = async () => {
8089
- var _a26;
8089
+ var _a25;
8090
8090
  if (!canUseWindow()) {
8091
8091
  return { ok: false, error: "Callback do Telescup indispon\xEDvel fora do navegador." };
8092
8092
  }
@@ -8115,7 +8115,7 @@ var completeTelescupOidcCallback = async () => {
8115
8115
  throw new Error("Token endpoint do Telescup n\xE3o encontrado.");
8116
8116
  }
8117
8117
  const tokens = await exchangeCodeForToken(config, tokenUrl, code, flow.verifier);
8118
- const nonce = String(((_a26 = decodeJwt(tokens.id_token)) == null ? void 0 : _a26.nonce) || "").trim();
8118
+ const nonce = String(((_a25 = decodeJwt(tokens.id_token)) == null ? void 0 : _a25.nonce) || "").trim();
8119
8119
  if (!nonce || nonce !== flow.nonce) {
8120
8120
  throw new Error("Nonce inv\xE1lido no callback do Telescup.");
8121
8121
  }
@@ -8140,8 +8140,8 @@ var TELESCUP_CDN_HOSTS = /* @__PURE__ */ new Set([
8140
8140
  "cdn.cupcode.com.br"
8141
8141
  ]);
8142
8142
  var resolveAppsApiBaseUrl = () => {
8143
- var _a26, _b3;
8144
- return ((_b3 = (_a26 = getRuntimeEnv("VITE_APPS_API_BASE_URL")) != null ? _a26 : getRuntimeEnv("VITE_APPS_API_BASE")) != null ? _b3 : "").trim().replace(/\/+$/, "");
8143
+ var _a25, _b3;
8144
+ return ((_b3 = (_a25 = getRuntimeEnv("VITE_APPS_API_BASE_URL")) != null ? _a25 : getRuntimeEnv("VITE_APPS_API_BASE")) != null ? _b3 : "").trim().replace(/\/+$/, "");
8145
8145
  };
8146
8146
  var isTelescupCdnUrl = (value) => {
8147
8147
  const normalized = value == null ? void 0 : value.trim();
@@ -8153,10 +8153,10 @@ var isTelescupCdnUrl = (value) => {
8153
8153
  }
8154
8154
  };
8155
8155
  var resolveTelescupBaseUrl = () => {
8156
- var _a26;
8156
+ var _a25;
8157
8157
  const appsApiBase = resolveAppsApiBaseUrl();
8158
8158
  const apiFromApps = appsApiBase ? `${appsApiBase}/api/telescup` : "";
8159
- const explicitBase = (_a26 = getRuntimeEnv("VITE_TELESCUP_BASE_URL")) == null ? void 0 : _a26.trim();
8159
+ const explicitBase = (_a25 = getRuntimeEnv("VITE_TELESCUP_BASE_URL")) == null ? void 0 : _a25.trim();
8160
8160
  if (explicitBase && !isTelescupCdnUrl(explicitBase)) {
8161
8161
  return explicitBase.replace(/\/+$/, "");
8162
8162
  }
@@ -8165,17 +8165,17 @@ var resolveTelescupBaseUrl = () => {
8165
8165
  var ACCESS_TOKEN_STORAGE_KEY = "cc_access_token";
8166
8166
  var ID_TOKEN_STORAGE_KEYS = ["cc_id_token", "id_token"];
8167
8167
  var isJwtUsable = (token, skewMs = 5e3) => {
8168
- var _a26;
8168
+ var _a25;
8169
8169
  const claims = decodeJwt(token);
8170
- const exp = Number((_a26 = claims == null ? void 0 : claims.exp) != null ? _a26 : 0);
8170
+ const exp = Number((_a25 = claims == null ? void 0 : claims.exp) != null ? _a25 : 0);
8171
8171
  if (!Number.isFinite(exp) || exp <= 0) return true;
8172
8172
  return exp * 1e3 > Date.now() + skewMs;
8173
8173
  };
8174
8174
  var readStoredIdToken2 = () => {
8175
- var _a26;
8175
+ var _a25;
8176
8176
  if (typeof window === "undefined") return null;
8177
8177
  for (const key of ID_TOKEN_STORAGE_KEYS) {
8178
- const value = (_a26 = sessionStorage.getItem(key)) == null ? void 0 : _a26.trim();
8178
+ const value = (_a25 = sessionStorage.getItem(key)) == null ? void 0 : _a25.trim();
8179
8179
  if (value) return value;
8180
8180
  }
8181
8181
  return null;
@@ -8209,25 +8209,25 @@ var resolveCurrentUserId = (user) => {
8209
8209
  return null;
8210
8210
  };
8211
8211
  var resolveUserIdFromClaims = (claims) => {
8212
- var _a26, _b3, _c, _d, _e;
8213
- return (_e = (_d = (_c = (_b3 = (_a26 = toStringOrUndefined2(claims.sub)) != null ? _a26 : toStringOrUndefined2(claims.user_id)) != null ? _b3 : toStringOrUndefined2(claims.userId)) != null ? _c : toStringOrUndefined2(claims.uid)) != null ? _d : toStringOrUndefined2(claims.id)) != null ? _e : toStringOrUndefined2(claims["https://cupcode.com/user_id"]);
8212
+ var _a25, _b3, _c, _d, _e;
8213
+ return (_e = (_d = (_c = (_b3 = (_a25 = toStringOrUndefined2(claims.sub)) != null ? _a25 : toStringOrUndefined2(claims.user_id)) != null ? _b3 : toStringOrUndefined2(claims.userId)) != null ? _c : toStringOrUndefined2(claims.uid)) != null ? _d : toStringOrUndefined2(claims.id)) != null ? _e : toStringOrUndefined2(claims["https://cupcode.com/user_id"]);
8214
8214
  };
8215
8215
  var resolveEmailFromClaims = (claims) => {
8216
- var _a26, _b3;
8217
- const candidate = (_b3 = (_a26 = toStringOrUndefined2(claims.email)) != null ? _a26 : toStringOrUndefined2(claims["https://cupcode.com/email"])) != null ? _b3 : toStringOrUndefined2(claims.preferred_username);
8216
+ var _a25, _b3;
8217
+ const candidate = (_b3 = (_a25 = toStringOrUndefined2(claims.email)) != null ? _a25 : toStringOrUndefined2(claims["https://cupcode.com/email"])) != null ? _b3 : toStringOrUndefined2(claims.preferred_username);
8218
8218
  if (!candidate || !candidate.includes("@")) return void 0;
8219
8219
  return candidate.toLowerCase();
8220
8220
  };
8221
8221
  var normalizeTenantId = (value) => {
8222
- var _a26;
8223
- const normalized = (_a26 = toStringOrUndefined2(value)) == null ? void 0 : _a26.toLowerCase();
8222
+ var _a25;
8223
+ const normalized = (_a25 = toStringOrUndefined2(value)) == null ? void 0 : _a25.toLowerCase();
8224
8224
  if (!normalized) return void 0;
8225
8225
  return normalized.replace(/^@/, "");
8226
8226
  };
8227
8227
  var resolveTenantIdFromClaims = (claims) => {
8228
- var _a26, _b3, _c, _d, _e, _f, _g, _h, _i, _j;
8228
+ var _a25, _b3, _c, _d, _e, _f, _g, _h, _i, _j;
8229
8229
  return normalizeTenantId(
8230
- (_j = (_i = (_h = (_g = (_f = (_e = (_d = (_c = (_b3 = (_a26 = toStringOrUndefined2(claims.tenant_id)) != null ? _a26 : toStringOrUndefined2(claims.tenantId)) != null ? _b3 : toStringOrUndefined2(claims.tenant_slug)) != null ? _c : toStringOrUndefined2(claims.tenantSlug)) != null ? _d : toStringOrUndefined2(claims.company_slug)) != null ? _e : toStringOrUndefined2(claims.companySlug)) != null ? _f : toStringOrUndefined2(claims.company)) != null ? _g : toStringOrUndefined2(claims.org_slug)) != null ? _h : toStringOrUndefined2(claims.orgSlug)) != null ? _i : toStringOrUndefined2(claims["https://cupcode.com/tenant_id"])) != null ? _j : toStringOrUndefined2(claims["https://cupcode.com/tenant_slug"])
8230
+ (_j = (_i = (_h = (_g = (_f = (_e = (_d = (_c = (_b3 = (_a25 = toStringOrUndefined2(claims.tenant_id)) != null ? _a25 : toStringOrUndefined2(claims.tenantId)) != null ? _b3 : toStringOrUndefined2(claims.tenant_slug)) != null ? _c : toStringOrUndefined2(claims.tenantSlug)) != null ? _d : toStringOrUndefined2(claims.company_slug)) != null ? _e : toStringOrUndefined2(claims.companySlug)) != null ? _f : toStringOrUndefined2(claims.company)) != null ? _g : toStringOrUndefined2(claims.org_slug)) != null ? _h : toStringOrUndefined2(claims.orgSlug)) != null ? _i : toStringOrUndefined2(claims["https://cupcode.com/tenant_id"])) != null ? _j : toStringOrUndefined2(claims["https://cupcode.com/tenant_slug"])
8231
8231
  );
8232
8232
  };
8233
8233
  var AVATAR_IMAGE_OPTIONS = {
@@ -8238,8 +8238,8 @@ var AVATAR_IMAGE_OPTIONS = {
8238
8238
  quality: 80
8239
8239
  };
8240
8240
  var resolveAvatarPreviewUrl = (asset, fallback) => {
8241
- var _a26, _b3, _c;
8242
- return (_c = (_b3 = (_a26 = resolveTelescupImageURL(asset == null ? void 0 : asset.thumb_url, AVATAR_IMAGE_OPTIONS)) != null ? _a26 : resolveTelescupImageURL(asset == null ? void 0 : asset.preview_url, AVATAR_IMAGE_OPTIONS)) != null ? _b3 : resolveTelescupImageURL(asset == null ? void 0 : asset.url, AVATAR_IMAGE_OPTIONS)) != null ? _c : resolveTelescupImageURL(fallback, AVATAR_IMAGE_OPTIONS);
8241
+ var _a25, _b3, _c;
8242
+ return (_c = (_b3 = (_a25 = resolveTelescupImageURL(asset == null ? void 0 : asset.thumb_url, AVATAR_IMAGE_OPTIONS)) != null ? _a25 : resolveTelescupImageURL(asset == null ? void 0 : asset.preview_url, AVATAR_IMAGE_OPTIONS)) != null ? _b3 : resolveTelescupImageURL(asset == null ? void 0 : asset.url, AVATAR_IMAGE_OPTIONS)) != null ? _c : resolveTelescupImageURL(fallback, AVATAR_IMAGE_OPTIONS);
8243
8243
  };
8244
8244
  var isGenericRecord = (value) => typeof value === "object" && value !== null;
8245
8245
  var buildExternalUrl = (baseUrl, target) => {
@@ -8272,11 +8272,11 @@ var normalizeMenuLanguage = (value) => {
8272
8272
  return "pt-BR";
8273
8273
  };
8274
8274
  var resolveMenuLanguageFromRecord = (record) => {
8275
- var _a26, _b3, _c, _d, _e;
8275
+ var _a25, _b3, _c, _d, _e;
8276
8276
  if (!record) return void 0;
8277
8277
  const profile = isGenericRecord(record.profile) ? record.profile : null;
8278
8278
  const preferences = isGenericRecord(record.preferences) ? record.preferences : null;
8279
- const rawLanguage = (_e = (_d = (_c = (_b3 = (_a26 = record.language) != null ? _a26 : record.locale) != null ? _b3 : profile == null ? void 0 : profile.language) != null ? _c : profile == null ? void 0 : profile.locale) != null ? _d : preferences == null ? void 0 : preferences.language) != null ? _e : preferences == null ? void 0 : preferences.locale;
8279
+ const rawLanguage = (_e = (_d = (_c = (_b3 = (_a25 = record.language) != null ? _a25 : record.locale) != null ? _b3 : profile == null ? void 0 : profile.language) != null ? _c : profile == null ? void 0 : profile.locale) != null ? _d : preferences == null ? void 0 : preferences.language) != null ? _e : preferences == null ? void 0 : preferences.locale;
8280
8280
  if (typeof rawLanguage !== "string" || !rawLanguage.trim()) return void 0;
8281
8281
  return normalizeMenuLanguage(rawLanguage);
8282
8282
  };
@@ -8317,8 +8317,8 @@ var parseRecentActivityItems = (payload) => {
8317
8317
  return [];
8318
8318
  };
8319
8319
  return toRows(payload).map((item, index) => {
8320
- var _a26, _b3, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
8321
- const id = (_b3 = (_a26 = toStringOrUndefined2(item.id)) != null ? _a26 : toStringOrUndefined2(item.event_id)) != null ? _b3 : `accounts-activity-${index}`;
8320
+ var _a25, _b3, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
8321
+ const id = (_b3 = (_a25 = toStringOrUndefined2(item.id)) != null ? _a25 : toStringOrUndefined2(item.event_id)) != null ? _b3 : `accounts-activity-${index}`;
8322
8322
  const title = (_e = (_d = (_c = toStringOrUndefined2(item.title)) != null ? _c : toStringOrUndefined2(item.action)) != null ? _d : toStringOrUndefined2(item.event)) != null ? _e : toStringOrUndefined2(item.type);
8323
8323
  if (!title) return null;
8324
8324
  const description = (_h = (_g = (_f = toStringOrUndefined2(item.description)) != null ? _f : toStringOrUndefined2(item.details)) != null ? _g : toStringOrUndefined2(item.message)) != null ? _h : toStringOrUndefined2(item.summary);
@@ -8387,7 +8387,7 @@ var MainNavbar = ({
8387
8387
  getAccessToken,
8388
8388
  appVersion
8389
8389
  }) => {
8390
- var _a26, _b3, _c;
8390
+ var _a25, _b3, _c;
8391
8391
  const [tokenDerivedUserId, setTokenDerivedUserId] = useState13(null);
8392
8392
  const [tokenDerivedEmail, setTokenDerivedEmail] = useState13(void 0);
8393
8393
  const [tokenDerivedTenantId, setTokenDerivedTenantId] = useState13(void 0);
@@ -8405,13 +8405,13 @@ var MainNavbar = ({
8405
8405
  return "/";
8406
8406
  }, [pathname]);
8407
8407
  const currentUserId = useMemo10(() => {
8408
- var _a27;
8409
- return (_a27 = resolveCurrentUserId(authUser)) != null ? _a27 : tokenDerivedUserId;
8408
+ var _a26;
8409
+ return (_a26 = resolveCurrentUserId(authUser)) != null ? _a26 : tokenDerivedUserId;
8410
8410
  }, [authUser, tokenDerivedUserId]);
8411
8411
  const resolvedTenantId = useMemo10(() => {
8412
- var _a27, _b4, _c2, _d, _e, _f;
8412
+ var _a26, _b4, _c2, _d, _e, _f;
8413
8413
  const candidate = normalizeTenantId(
8414
- (_f = (_e = (_d = (_c2 = (_b4 = (_a27 = authUser == null ? void 0 : authUser.tenantSlug) != null ? _a27 : authUser == null ? void 0 : authUser.tenantId) != null ? _b4 : authUser == null ? void 0 : authUser.tenant_id) != null ? _c2 : authUser == null ? void 0 : authUser.companySlug) != null ? _d : authUser == null ? void 0 : authUser.company) != null ? _e : authUser == null ? void 0 : authUser.orgSlug) != null ? _f : tokenDerivedTenantId
8414
+ (_f = (_e = (_d = (_c2 = (_b4 = (_a26 = authUser == null ? void 0 : authUser.tenantSlug) != null ? _a26 : authUser == null ? void 0 : authUser.tenantId) != null ? _b4 : authUser == null ? void 0 : authUser.tenant_id) != null ? _c2 : authUser == null ? void 0 : authUser.companySlug) != null ? _d : authUser == null ? void 0 : authUser.company) != null ? _e : authUser == null ? void 0 : authUser.orgSlug) != null ? _f : tokenDerivedTenantId
8415
8415
  );
8416
8416
  if (!candidate || !currentUserId) return candidate;
8417
8417
  if (candidate === currentUserId) return void 0;
@@ -8429,7 +8429,7 @@ var MainNavbar = ({
8429
8429
  const resolvedTelescupBaseUrl = useMemo10(() => {
8430
8430
  return resolveTelescupBaseUrl();
8431
8431
  }, []);
8432
- const resolvedProfileAvatarUrl = (_a26 = resolveAvatarPreviewUrl({ url: persistedProfileAvatarValue != null ? persistedProfileAvatarValue : authUser == null ? void 0 : authUser.picture })) != null ? _a26 : void 0;
8432
+ const resolvedProfileAvatarUrl = (_a25 = resolveAvatarPreviewUrl({ url: persistedProfileAvatarValue != null ? persistedProfileAvatarValue : authUser == null ? void 0 : authUser.picture })) != null ? _a25 : void 0;
8433
8433
  const hasStoredAccessToken = (() => {
8434
8434
  if (typeof window === "undefined") return false;
8435
8435
  try {
@@ -8467,7 +8467,7 @@ var MainNavbar = ({
8467
8467
  }
8468
8468
  let canceled = false;
8469
8469
  const resolveIdentityFromToken = async () => {
8470
- var _a27, _b4;
8470
+ var _a26, _b4;
8471
8471
  try {
8472
8472
  let token = null;
8473
8473
  if (typeof window !== "undefined") {
@@ -8488,7 +8488,7 @@ var MainNavbar = ({
8488
8488
  }
8489
8489
  return;
8490
8490
  }
8491
- const claims = (_a27 = decodeJwt(token)) != null ? _a27 : {};
8491
+ const claims = (_a26 = decodeJwt(token)) != null ? _a26 : {};
8492
8492
  if (canceled) return;
8493
8493
  setTokenDerivedUserId((_b4 = resolveUserIdFromClaims(claims)) != null ? _b4 : null);
8494
8494
  setTokenDerivedEmail(resolveEmailFromClaims(claims));
@@ -8548,7 +8548,7 @@ var MainNavbar = ({
8548
8548
  });
8549
8549
  };
8550
8550
  const loadAccountsContext = async () => {
8551
- var _a27;
8551
+ var _a26;
8552
8552
  setIsAccountsActivityLoading(true);
8553
8553
  setIsAccountsLoginHistoryLoading(true);
8554
8554
  setIsTwoFactorStatusLoading(true);
@@ -8561,7 +8561,7 @@ var MainNavbar = ({
8561
8561
  }
8562
8562
  return;
8563
8563
  }
8564
- const claims = (_a27 = decodeJwt(token)) != null ? _a27 : {};
8564
+ const claims = (_a26 = decodeJwt(token)) != null ? _a26 : {};
8565
8565
  const twoFactorFromToken = resolveTwoFactorEnabledFromClaims(claims);
8566
8566
  if (!canceled) {
8567
8567
  setAccountsRecentActivity(buildActivityFromTokenClaims(claims));
@@ -8630,7 +8630,7 @@ var MainNavbar = ({
8630
8630
  };
8631
8631
  }, [getAccessToken, isAuthenticated, currentUserId]);
8632
8632
  const items = useMemo10(() => {
8633
- var _a27;
8633
+ var _a26;
8634
8634
  if (!showNavItems) return [];
8635
8635
  const normalizedPathname = currentPathname === "" ? "/" : currentPathname;
8636
8636
  const navItems = getMainNavItems({ includePrivate: resolvedAuthStatus === "authenticated" });
@@ -8640,7 +8640,7 @@ var MainNavbar = ({
8640
8640
  if (normalizedPathname.startsWith(`${href}/`)) return href.length;
8641
8641
  return -1;
8642
8642
  };
8643
- const bestMatchHref = (_a27 = navItems.filter((item) => !item.href.startsWith("#")).map((item) => ({ href: item.href, score: scoreRouteMatch(item.href) })).filter((candidate) => candidate.score >= 0).sort((left, right) => right.score - left.score)[0]) == null ? void 0 : _a27.href;
8643
+ const bestMatchHref = (_a26 = navItems.filter((item) => !item.href.startsWith("#")).map((item) => ({ href: item.href, score: scoreRouteMatch(item.href) })).filter((candidate) => candidate.score >= 0).sort((left, right) => right.score - left.score)[0]) == null ? void 0 : _a26.href;
8644
8644
  return navItems.map((item) => {
8645
8645
  const isAnchor = item.href.startsWith("#");
8646
8646
  const isActive = !isAnchor ? item.href === bestMatchHref : false;
@@ -8648,8 +8648,8 @@ var MainNavbar = ({
8648
8648
  ...item,
8649
8649
  isActive,
8650
8650
  onClick: isAnchor ? item.onClick : (event) => {
8651
- var _a28;
8652
- (_a28 = item.onClick) == null ? void 0 : _a28.call(item, event);
8651
+ var _a27;
8652
+ (_a27 = item.onClick) == null ? void 0 : _a27.call(item, event);
8653
8653
  if (!onNavigate || event.defaultPrevented) return;
8654
8654
  event.preventDefault();
8655
8655
  onNavigate(item.href);
@@ -8707,11 +8707,11 @@ var MainNavbar = ({
8707
8707
  }, [getAccessToken]);
8708
8708
  const handleLanguageChange = useCallback6(
8709
8709
  async (nextLanguage) => {
8710
- var _a27;
8710
+ var _a26;
8711
8711
  setAccountsLanguage(nextLanguage);
8712
8712
  if (typeof window === "undefined") return;
8713
8713
  try {
8714
- const token = getAccessToken ? await getAccessToken() : (_a27 = sessionStorage.getItem(ACCESS_TOKEN_STORAGE_KEY)) != null ? _a27 : readStoredIdToken2();
8714
+ const token = getAccessToken ? await getAccessToken() : (_a26 = sessionStorage.getItem(ACCESS_TOKEN_STORAGE_KEY)) != null ? _a26 : readStoredIdToken2();
8715
8715
  if (!token || !isJwtUsable(token)) return;
8716
8716
  const response = await fetch(buildExternalUrl(resolveAccountsApiBaseUrl2(), ACCOUNTS_ME_ENDPOINT), {
8717
8717
  method: "PATCH",
@@ -8734,8 +8734,8 @@ var MainNavbar = ({
8734
8734
  );
8735
8735
  const handleProfileAvatarChange = useCallback6(
8736
8736
  async ({ avatarId, avatarUrl }) => {
8737
- var _a27, _b4, _c2, _d;
8738
- const normalizedAvatarId = (_a27 = parseAssetId(avatarId)) != null ? _a27 : parseAssetId(avatarUrl);
8737
+ var _a26, _b4, _c2, _d;
8738
+ const normalizedAvatarId = (_a26 = parseAssetId(avatarId)) != null ? _a26 : parseAssetId(avatarUrl);
8739
8739
  if (!normalizedAvatarId) {
8740
8740
  throw new Error("ID da imagem inv\xE1lido.");
8741
8741
  }
@@ -9437,7 +9437,7 @@ var DocumentationSearchDialog = ({ open, onOpenChange }) => {
9437
9437
  const totalSections = map.sections.length;
9438
9438
  const mapMatches = normalizedQuery.length === 0 || normalizeText([map.title, map.subtitle, map.searchLabel].join(" ")).includes(normalizedQuery);
9439
9439
  const sections = map.sections.filter((section) => {
9440
- var _a26, _b3, _c;
9440
+ var _a25, _b3, _c;
9441
9441
  if (mapMatches) return true;
9442
9442
  const parent = section.parentId ? parents.get(section.parentId) : null;
9443
9443
  const haystack = normalizeText(
@@ -9446,7 +9446,7 @@ var DocumentationSearchDialog = ({ open, onOpenChange }) => {
9446
9446
  map.searchLabel,
9447
9447
  section.label,
9448
9448
  section.group,
9449
- (_a26 = section.description) != null ? _a26 : "",
9449
+ (_a25 = section.description) != null ? _a25 : "",
9450
9450
  (_b3 = parent == null ? void 0 : parent.label) != null ? _b3 : "",
9451
9451
  ...(_c = section.keywords) != null ? _c : []
9452
9452
  ].join(" ")
@@ -9566,9 +9566,9 @@ var DocumentationSearchDialog = ({ open, onOpenChange }) => {
9566
9566
  // src/components/layout/sidebar-groups.tsx
9567
9567
  var toStableId = (value) => value.toLowerCase().normalize("NFD").replace(/\p{Diacritic}+/gu, "").replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)+/g, "");
9568
9568
  var getGroupMetadata = (item) => {
9569
- var _a26, _b3;
9569
+ var _a25, _b3;
9570
9570
  return {
9571
- id: ((_a26 = item.groupId) == null ? void 0 : _a26.trim()) || "",
9571
+ id: ((_a25 = item.groupId) == null ? void 0 : _a25.trim()) || "",
9572
9572
  label: ((_b3 = item.groupLabel) == null ? void 0 : _b3.trim()) || "",
9573
9573
  icon: item.groupIcon
9574
9574
  };
@@ -9584,7 +9584,7 @@ var buildSidebarGroupsFromNavItems = (items, defaultGroupLabel = "Principal") =>
9584
9584
  if (navItems.length === 0) return [];
9585
9585
  const groupsMap = /* @__PURE__ */ new Map();
9586
9586
  navItems.forEach((item) => {
9587
- var _a26;
9587
+ var _a25;
9588
9588
  const groupId = item.group.id || toStableId(item.group.label || defaultGroupLabel);
9589
9589
  const groupLabel = item.group.label || defaultGroupLabel;
9590
9590
  const existing = groupsMap.get(groupId);
@@ -9592,7 +9592,7 @@ var buildSidebarGroupsFromNavItems = (items, defaultGroupLabel = "Principal") =>
9592
9592
  groupsMap.set(groupId, {
9593
9593
  id: groupId,
9594
9594
  label: groupLabel,
9595
- icon: (_a26 = item.group.icon) != null ? _a26 : item.icon,
9595
+ icon: (_a25 = item.group.icon) != null ? _a25 : item.icon,
9596
9596
  items: [{ id: item.id, label: item.label, icon: item.icon, route: item.route }]
9597
9597
  });
9598
9598
  return;
@@ -9609,8 +9609,8 @@ var defaultSidebarGroups = buildSidebarGroupsFromNavItems(getMainNavItems());
9609
9609
  // src/components/layout/sidebar.tsx
9610
9610
  import { jsx as jsx40, jsxs as jsxs26 } from "react/jsx-runtime";
9611
9611
  var findGroupByRoute = (groups, pathname) => {
9612
- var _a26, _b3;
9613
- return (_b3 = (_a26 = groups.find((group) => group.items.some((item) => item.route === pathname))) == null ? void 0 : _a26.label) != null ? _b3 : null;
9612
+ var _a25, _b3;
9613
+ return (_b3 = (_a25 = groups.find((group) => group.items.some((item) => item.route === pathname))) == null ? void 0 : _a25.label) != null ? _b3 : null;
9614
9614
  };
9615
9615
  var IconFallback = () => /* @__PURE__ */ jsx40(Circle2, { className: "h-3 w-3 opacity-80", "aria-hidden": "true" });
9616
9616
  var DEFAULT_EXPANDED_LOGO_SLOT = /* @__PURE__ */ jsx40("div", { className: "h-10 w-[175px] shrink-0", "aria-hidden": "true" });
@@ -10064,12 +10064,12 @@ var FOOTER_LAYOUT_AREAS = {
10064
10064
  legal: "Barra legal"
10065
10065
  };
10066
10066
  var groupLinksBySection = (links) => {
10067
- var _a26;
10067
+ var _a25;
10068
10068
  const groups = /* @__PURE__ */ new Map();
10069
10069
  for (const link of links) {
10070
10070
  const section = link.section.trim();
10071
10071
  if (!section) continue;
10072
- const bucket = (_a26 = groups.get(section)) != null ? _a26 : [];
10072
+ const bucket = (_a25 = groups.get(section)) != null ? _a25 : [];
10073
10073
  bucket.push({ label: link.label, href: link.href });
10074
10074
  groups.set(section, bucket);
10075
10075
  }
@@ -10079,18 +10079,18 @@ var groupLinksBySection = (links) => {
10079
10079
  }));
10080
10080
  };
10081
10081
  var buildFooterLayout = (links) => {
10082
- var _a26;
10082
+ var _a25;
10083
10083
  const byArea = /* @__PURE__ */ new Map();
10084
10084
  for (const link of links) {
10085
10085
  const area = link.area.trim();
10086
10086
  if (!area) continue;
10087
- const bucket = (_a26 = byArea.get(area)) != null ? _a26 : [];
10087
+ const bucket = (_a25 = byArea.get(area)) != null ? _a25 : [];
10088
10088
  bucket.push(link);
10089
10089
  byArea.set(area, bucket);
10090
10090
  }
10091
10091
  const pickArea = (area) => {
10092
- var _a27;
10093
- return (_a27 = byArea.get(area)) != null ? _a27 : [];
10092
+ var _a26;
10093
+ return (_a26 = byArea.get(area)) != null ? _a26 : [];
10094
10094
  };
10095
10095
  const footerLeftGroups = groupLinksBySection(pickArea(FOOTER_LAYOUT_AREAS.left));
10096
10096
  const footerServiceGroups = [
@@ -10142,9 +10142,9 @@ var requestJson = async (path, init) => {
10142
10142
  return payload;
10143
10143
  };
10144
10144
  var loadFooterLinks = async () => {
10145
- var _a26;
10145
+ var _a25;
10146
10146
  const data = await requestJson("/api/ds/footer-links");
10147
- return ((_a26 = data.links) != null ? _a26 : []).map(toLink);
10147
+ return ((_a25 = data.links) != null ? _a25 : []).map(toLink);
10148
10148
  };
10149
10149
 
10150
10150
  // src/hooks/useFooterLinks.ts
@@ -11184,10 +11184,10 @@ function isThemeMode(value) {
11184
11184
  return value === "light" || value === "dark";
11185
11185
  }
11186
11186
  function readStoredTheme() {
11187
- var _a26;
11187
+ var _a25;
11188
11188
  if (typeof window === "undefined") return null;
11189
11189
  try {
11190
- const storedTheme = (_a26 = window.localStorage.getItem(THEME_STORAGE_KEY2)) != null ? _a26 : window.localStorage.getItem("theme");
11190
+ const storedTheme = (_a25 = window.localStorage.getItem(THEME_STORAGE_KEY2)) != null ? _a25 : window.localStorage.getItem("theme");
11191
11191
  return isThemeMode(storedTheme) ? storedTheme : null;
11192
11192
  } catch (e) {
11193
11193
  return null;
@@ -11210,10 +11210,10 @@ function applyThemeClass(theme) {
11210
11210
  root.style.colorScheme = theme;
11211
11211
  }
11212
11212
  function readThemeFromRoot() {
11213
- var _a26;
11213
+ var _a25;
11214
11214
  if (typeof document === "undefined") return null;
11215
11215
  const root = document.documentElement;
11216
- const datasetTheme = (_a26 = root.dataset.theme) != null ? _a26 : null;
11216
+ const datasetTheme = (_a25 = root.dataset.theme) != null ? _a25 : null;
11217
11217
  if (isThemeMode(datasetTheme)) return datasetTheme;
11218
11218
  if (root.classList.contains("dark")) return "dark";
11219
11219
  if (root.classList.contains("light")) return "light";
@@ -11236,13 +11236,13 @@ var ThemeToggle2 = ({
11236
11236
  defaultTheme = "light",
11237
11237
  onThemeChange
11238
11238
  }) => {
11239
- var _a26;
11239
+ var _a25;
11240
11240
  const themeContext = React31.useContext(ThemeContext);
11241
11241
  const [mounted, setMounted] = React31.useState(false);
11242
11242
  const [internalTheme, setInternalTheme] = React31.useState(defaultTheme);
11243
11243
  const isControlled = typeof theme !== "undefined";
11244
11244
  const usesProviderTheme = !isControlled && themeContext !== null;
11245
- const activeTheme = (_a26 = isControlled ? theme : usesProviderTheme ? themeContext.theme : internalTheme) != null ? _a26 : defaultTheme;
11245
+ const activeTheme = (_a25 = isControlled ? theme : usesProviderTheme ? themeContext.theme : internalTheme) != null ? _a25 : defaultTheme;
11246
11246
  React31.useEffect(() => {
11247
11247
  if (!isControlled && !usesProviderTheme) {
11248
11248
  setInternalTheme(resolveTheme(defaultTheme));
@@ -11267,8 +11267,8 @@ var ThemeToggle2 = ({
11267
11267
  return /* @__PURE__ */ jsx59("div", { className: cn("w-10 h-10 rounded-lg bg-muted", className) });
11268
11268
  }
11269
11269
  const handleToggle = (event) => {
11270
- var _a27;
11271
- const currentTheme = (_a27 = readThemeFromRoot()) != null ? _a27 : activeTheme;
11270
+ var _a26;
11271
+ const currentTheme = (_a26 = readThemeFromRoot()) != null ? _a26 : activeTheme;
11272
11272
  const nextTheme = currentTheme === "dark" ? "light" : "dark";
11273
11273
  if (usesProviderTheme) {
11274
11274
  themeContext.toggleTheme({
@@ -11322,11 +11322,11 @@ function getPreferredTheme() {
11322
11322
  return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
11323
11323
  }
11324
11324
  function getStoredTheme() {
11325
- var _a26;
11325
+ var _a25;
11326
11326
  if (typeof window === "undefined") {
11327
11327
  return null;
11328
11328
  }
11329
- const storedTheme = (_a26 = window.localStorage.getItem(STORAGE_KEY)) != null ? _a26 : window.localStorage.getItem(LEGACY_STORAGE_KEY);
11329
+ const storedTheme = (_a25 = window.localStorage.getItem(STORAGE_KEY)) != null ? _a25 : window.localStorage.getItem(LEGACY_STORAGE_KEY);
11330
11330
  return storedTheme === "light" || storedTheme === "dark" ? storedTheme : null;
11331
11331
  }
11332
11332
  function getThemeFromRoot() {
@@ -11347,8 +11347,8 @@ function getThemeFromRoot() {
11347
11347
  return null;
11348
11348
  }
11349
11349
  function resolveTheme2() {
11350
- var _a26, _b3;
11351
- return (_b3 = (_a26 = getThemeFromRoot()) != null ? _a26 : getStoredTheme()) != null ? _b3 : getPreferredTheme();
11350
+ var _a25, _b3;
11351
+ return (_b3 = (_a25 = getThemeFromRoot()) != null ? _a25 : getStoredTheme()) != null ? _b3 : getPreferredTheme();
11352
11352
  }
11353
11353
  function applyThemeToRoot(theme) {
11354
11354
  const root = document.documentElement;
@@ -11418,7 +11418,7 @@ function ThemeProvider({ children }) {
11418
11418
  return () => observer.disconnect();
11419
11419
  }, []);
11420
11420
  const applyThemeSelection = useCallback8((nextTheme, coords) => {
11421
- var _a26;
11421
+ var _a25;
11422
11422
  const documentWithTransition = document;
11423
11423
  const root = document.documentElement;
11424
11424
  const prefersReducedMotion = window.matchMedia(
@@ -11443,7 +11443,7 @@ function ThemeProvider({ children }) {
11443
11443
  root.style.setProperty("--theme-x", "50%");
11444
11444
  root.style.setProperty("--theme-y", "50%");
11445
11445
  }
11446
- (_a26 = documentWithTransition.startViewTransition) == null ? void 0 : _a26.call(documentWithTransition, () => {
11446
+ (_a25 = documentWithTransition.startViewTransition) == null ? void 0 : _a25.call(documentWithTransition, () => {
11447
11447
  flushSync(() => {
11448
11448
  commitTheme();
11449
11449
  });
@@ -11453,8 +11453,8 @@ function ThemeProvider({ children }) {
11453
11453
  applyThemeSelection(nextTheme);
11454
11454
  }, [applyThemeSelection]);
11455
11455
  const toggleTheme = useCallback8((coords) => {
11456
- var _a26;
11457
- const currentTheme = (_a26 = getThemeFromRoot()) != null ? _a26 : theme;
11456
+ var _a25;
11457
+ const currentTheme = (_a25 = getThemeFromRoot()) != null ? _a25 : theme;
11458
11458
  const nextTheme = currentTheme === "light" ? "dark" : "light";
11459
11459
  applyThemeSelection(nextTheme, coords);
11460
11460
  }, [applyThemeSelection, theme]);
@@ -12161,8 +12161,8 @@ var ChartStyle = ({ id, config }) => {
12161
12161
  ([theme, prefix]) => `
12162
12162
  ${prefix} [data-chart=${id}] {
12163
12163
  ${colorConfig.map(([key, itemConfig]) => {
12164
- var _a26;
12165
- const color = ((_a26 = itemConfig.theme) == null ? void 0 : _a26[theme]) || itemConfig.color;
12164
+ var _a25;
12165
+ const color = ((_a25 = itemConfig.theme) == null ? void 0 : _a25[theme]) || itemConfig.color;
12166
12166
  return color ? ` --color-${key}: ${color};` : null;
12167
12167
  }).join("\n")}
12168
12168
  }
@@ -12191,14 +12191,14 @@ var ChartTooltipContent = React40.forwardRef(
12191
12191
  }, ref) => {
12192
12192
  const { config } = useChart();
12193
12193
  const tooltipLabel = React40.useMemo(() => {
12194
- var _a26;
12194
+ var _a25;
12195
12195
  if (hideLabel || !(payload == null ? void 0 : payload.length)) {
12196
12196
  return null;
12197
12197
  }
12198
12198
  const [item] = payload;
12199
12199
  const key = `${labelKey || item.dataKey || item.name || "value"}`;
12200
12200
  const itemConfig = getPayloadConfigFromPayload(config, item, key);
12201
- const value = !labelKey && typeof label === "string" ? ((_a26 = config[label]) == null ? void 0 : _a26.label) || label : itemConfig == null ? void 0 : itemConfig.label;
12201
+ const value = !labelKey && typeof label === "string" ? ((_a25 = config[label]) == null ? void 0 : _a25.label) || label : itemConfig == null ? void 0 : itemConfig.label;
12202
12202
  if (labelFormatter) {
12203
12203
  return /* @__PURE__ */ jsx72("div", { className: cn("font-medium", labelClassName), children: labelFormatter(value, payload) });
12204
12204
  }
@@ -13918,9 +13918,9 @@ ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
13918
13918
  // src/hooks/useActiveSection.ts
13919
13919
  import { useEffect as useEffect26, useState as useState23 } from "react";
13920
13920
  var resolveActiveFromOffsets = (sectionIds, topById, offset, scrollY) => {
13921
- var _a26;
13921
+ var _a25;
13922
13922
  const line = scrollY + offset;
13923
- let nextActive = (_a26 = sectionIds[0]) != null ? _a26 : "";
13923
+ let nextActive = (_a25 = sectionIds[0]) != null ? _a25 : "";
13924
13924
  for (const id of sectionIds) {
13925
13925
  const top = topById.get(id);
13926
13926
  if (typeof top !== "number") continue;
@@ -13933,10 +13933,10 @@ var resolveActiveFromOffsets = (sectionIds, topById, offset, scrollY) => {
13933
13933
  return nextActive;
13934
13934
  };
13935
13935
  var useActiveSection = (sectionIds, offset = 180) => {
13936
- var _a26;
13937
- const [activeId, setActiveId] = useState23((_a26 = sectionIds[0]) != null ? _a26 : "");
13936
+ var _a25;
13937
+ const [activeId, setActiveId] = useState23((_a25 = sectionIds[0]) != null ? _a25 : "");
13938
13938
  useEffect26(() => {
13939
- var _a27;
13939
+ var _a26;
13940
13940
  if (!sectionIds.length || typeof window === "undefined") return;
13941
13941
  const sections = sectionIds.map((id) => {
13942
13942
  const element = document.getElementById(id);
@@ -13944,7 +13944,7 @@ var useActiveSection = (sectionIds, offset = 180) => {
13944
13944
  return { id, element };
13945
13945
  }).filter((section) => section !== null);
13946
13946
  if (!sections.length) {
13947
- setActiveId((_a27 = sectionIds[0]) != null ? _a27 : "");
13947
+ setActiveId((_a26 = sectionIds[0]) != null ? _a26 : "");
13948
13948
  return;
13949
13949
  }
13950
13950
  const topById = /* @__PURE__ */ new Map();
@@ -14079,9 +14079,9 @@ var useLayoutMode = () => {
14079
14079
  setMode(normalizeLayoutMode(event.newValue));
14080
14080
  };
14081
14081
  const handleModeChange = (event) => {
14082
- var _a26;
14082
+ var _a25;
14083
14083
  const customEvent = event;
14084
- setMode((_a26 = customEvent.detail) != null ? _a26 : readStoredLayoutMode());
14084
+ setMode((_a25 = customEvent.detail) != null ? _a25 : readStoredLayoutMode());
14085
14085
  };
14086
14086
  window.addEventListener("storage", handleStorage);
14087
14087
  window.addEventListener(LAYOUT_MODE_CHANGE_EVENT, handleModeChange);
@@ -14238,7 +14238,7 @@ var FunctionsClient = class {
14238
14238
  */
14239
14239
  invoke(functionName_1) {
14240
14240
  return __awaiter(this, arguments, void 0, function* (functionName, options = {}) {
14241
- var _a26;
14241
+ var _a25;
14242
14242
  let timeoutId;
14243
14243
  let timeoutController;
14244
14244
  try {
@@ -14304,7 +14304,7 @@ var FunctionsClient = class {
14304
14304
  if (!response.ok) {
14305
14305
  throw new FunctionsHttpError(response);
14306
14306
  }
14307
- let responseType = ((_a26 = response.headers.get("Content-Type")) !== null && _a26 !== void 0 ? _a26 : "text/plain").split(";")[0].trim();
14307
+ let responseType = ((_a25 = response.headers.get("Content-Type")) !== null && _a25 !== void 0 ? _a25 : "text/plain").split(";")[0].trim();
14308
14308
  let data;
14309
14309
  if (responseType === "application/json") {
14310
14310
  data = yield response.json();
@@ -15653,7 +15653,7 @@ var WebSocketFactory = class {
15653
15653
  constructor() {
15654
15654
  }
15655
15655
  static detectEnvironment() {
15656
- var _a26;
15656
+ var _a25;
15657
15657
  if (typeof WebSocket !== "undefined") {
15658
15658
  return { type: "native", constructor: WebSocket };
15659
15659
  }
@@ -15670,7 +15670,7 @@ var WebSocketFactory = class {
15670
15670
  workaround: "Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."
15671
15671
  };
15672
15672
  }
15673
- if (typeof globalThis !== "undefined" && globalThis.EdgeRuntime || typeof navigator !== "undefined" && ((_a26 = navigator.userAgent) === null || _a26 === void 0 ? void 0 : _a26.includes("Vercel-Edge"))) {
15673
+ if (typeof globalThis !== "undefined" && globalThis.EdgeRuntime || typeof navigator !== "undefined" && ((_a25 = navigator.userAgent) === null || _a25 === void 0 ? void 0 : _a25.includes("Vercel-Edge"))) {
15674
15674
  return {
15675
15675
  type: "unsupported",
15676
15676
  error: "Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",
@@ -15754,7 +15754,7 @@ Suggested solution: ${env.workaround}`;
15754
15754
  try {
15755
15755
  const env = this.detectEnvironment();
15756
15756
  return env.type === "native" || env.type === "ws";
15757
- } catch (_a26) {
15757
+ } catch (_a25) {
15758
15758
  return false;
15759
15759
  }
15760
15760
  }
@@ -15828,29 +15828,29 @@ var Serializer = class {
15828
15828
  return callback(JSON.stringify(payload));
15829
15829
  }
15830
15830
  _binaryEncodeUserBroadcastPush(message) {
15831
- var _a26;
15832
- if (this._isArrayBuffer((_a26 = message.payload) === null || _a26 === void 0 ? void 0 : _a26.payload)) {
15831
+ var _a25;
15832
+ if (this._isArrayBuffer((_a25 = message.payload) === null || _a25 === void 0 ? void 0 : _a25.payload)) {
15833
15833
  return this._encodeBinaryUserBroadcastPush(message);
15834
15834
  } else {
15835
15835
  return this._encodeJsonUserBroadcastPush(message);
15836
15836
  }
15837
15837
  }
15838
15838
  _encodeBinaryUserBroadcastPush(message) {
15839
- var _a26, _b3;
15840
- const userPayload = (_b3 = (_a26 = message.payload) === null || _a26 === void 0 ? void 0 : _a26.payload) !== null && _b3 !== void 0 ? _b3 : new ArrayBuffer(0);
15839
+ var _a25, _b3;
15840
+ const userPayload = (_b3 = (_a25 = message.payload) === null || _a25 === void 0 ? void 0 : _a25.payload) !== null && _b3 !== void 0 ? _b3 : new ArrayBuffer(0);
15841
15841
  return this._encodeUserBroadcastPush(message, this.BINARY_ENCODING, userPayload);
15842
15842
  }
15843
15843
  _encodeJsonUserBroadcastPush(message) {
15844
- var _a26, _b3;
15845
- const userPayload = (_b3 = (_a26 = message.payload) === null || _a26 === void 0 ? void 0 : _a26.payload) !== null && _b3 !== void 0 ? _b3 : {};
15844
+ var _a25, _b3;
15845
+ const userPayload = (_b3 = (_a25 = message.payload) === null || _a25 === void 0 ? void 0 : _a25.payload) !== null && _b3 !== void 0 ? _b3 : {};
15846
15846
  const encoder = new TextEncoder();
15847
15847
  const encodedUserPayload = encoder.encode(JSON.stringify(userPayload)).buffer;
15848
15848
  return this._encodeUserBroadcastPush(message, this.JSON_ENCODING, encodedUserPayload);
15849
15849
  }
15850
15850
  _encodeUserBroadcastPush(message, encodingType, encodedPayload) {
15851
- var _a26, _b3;
15851
+ var _a25, _b3;
15852
15852
  const topic = message.topic;
15853
- const ref = (_a26 = message.ref) !== null && _a26 !== void 0 ? _a26 : "";
15853
+ const ref = (_a25 = message.ref) !== null && _a25 !== void 0 ? _a25 : "";
15854
15854
  const joinRef = (_b3 = message.join_ref) !== null && _b3 !== void 0 ? _b3 : "";
15855
15855
  const userEvent = message.payload.event;
15856
15856
  const rest = this.allowedMetadataKeys ? this._pick(message.payload, this.allowedMetadataKeys) : {};
@@ -15937,8 +15937,8 @@ var Serializer = class {
15937
15937
  return { join_ref: null, ref: null, topic, event: this.BROADCAST_EVENT, payload: data };
15938
15938
  }
15939
15939
  _isArrayBuffer(buffer) {
15940
- var _a26;
15941
- return buffer instanceof ArrayBuffer || ((_a26 = buffer === null || buffer === void 0 ? void 0 : buffer.constructor) === null || _a26 === void 0 ? void 0 : _a26.name) === "ArrayBuffer";
15940
+ var _a25;
15941
+ return buffer instanceof ArrayBuffer || ((_a25 = buffer === null || buffer === void 0 ? void 0 : buffer.constructor) === null || _a25 === void 0 ? void 0 : _a25.name) === "ArrayBuffer";
15942
15942
  }
15943
15943
  _pick(obj, keys) {
15944
15944
  if (!obj || typeof obj !== "object") {
@@ -16002,8 +16002,8 @@ var PostgresTypes;
16002
16002
  PostgresTypes2["tstzrange"] = "tstzrange";
16003
16003
  })(PostgresTypes || (PostgresTypes = {}));
16004
16004
  var convertChangeData = (columns, record, options = {}) => {
16005
- var _a26;
16006
- const skipTypes = (_a26 = options.skipTypes) !== null && _a26 !== void 0 ? _a26 : [];
16005
+ var _a25;
16006
+ const skipTypes = (_a25 = options.skipTypes) !== null && _a25 !== void 0 ? _a25 : [];
16007
16007
  if (!record) {
16008
16008
  return {};
16009
16009
  }
@@ -16093,7 +16093,7 @@ var toJson = (value) => {
16093
16093
  if (typeof value === "string") {
16094
16094
  try {
16095
16095
  return JSON.parse(value);
16096
- } catch (_a26) {
16096
+ } catch (_a25) {
16097
16097
  return value;
16098
16098
  }
16099
16099
  }
@@ -16185,9 +16185,9 @@ var Push = class {
16185
16185
  this.payload = Object.assign(Object.assign({}, this.payload), payload);
16186
16186
  }
16187
16187
  receive(status, callback) {
16188
- var _a26;
16188
+ var _a25;
16189
16189
  if (this._hasReceived(status)) {
16190
- callback((_a26 = this.receivedResp) === null || _a26 === void 0 ? void 0 : _a26.response);
16190
+ callback((_a25 = this.receivedResp) === null || _a25 === void 0 ? void 0 : _a25.response);
16191
16191
  }
16192
16192
  this.recHooks.push({ status, callback });
16193
16193
  return this;
@@ -16378,8 +16378,8 @@ var RealtimePresence = class _RealtimePresence {
16378
16378
  };
16379
16379
  }
16380
16380
  this.map(joins, (key, newPresences) => {
16381
- var _a26;
16382
- const currentPresences = (_a26 = state[key]) !== null && _a26 !== void 0 ? _a26 : [];
16381
+ var _a25;
16382
+ const currentPresences = (_a25 = state[key]) !== null && _a25 !== void 0 ? _a25 : [];
16383
16383
  state[key] = this.cloneDeep(newPresences);
16384
16384
  if (currentPresences.length > 0) {
16385
16385
  const joinedPresenceRefs = state[key].map((m) => m.presence_ref);
@@ -16507,7 +16507,7 @@ var RealtimeChannel = class _RealtimeChannel {
16507
16507
  * ```
16508
16508
  */
16509
16509
  constructor(topic, params = { config: {} }, socket) {
16510
- var _a26, _b3;
16510
+ var _a25, _b3;
16511
16511
  this.topic = topic;
16512
16512
  this.params = params;
16513
16513
  this.socket = socket;
@@ -16566,19 +16566,19 @@ var RealtimeChannel = class _RealtimeChannel {
16566
16566
  this.presence = new RealtimePresence(this);
16567
16567
  this.broadcastEndpointURL = httpEndpointURL(this.socket.endPoint);
16568
16568
  this.private = this.params.config.private || false;
16569
- if (!this.private && ((_b3 = (_a26 = this.params.config) === null || _a26 === void 0 ? void 0 : _a26.broadcast) === null || _b3 === void 0 ? void 0 : _b3.replay)) {
16569
+ if (!this.private && ((_b3 = (_a25 = this.params.config) === null || _a25 === void 0 ? void 0 : _a25.broadcast) === null || _b3 === void 0 ? void 0 : _b3.replay)) {
16570
16570
  throw `tried to use replay on public channel '${this.topic}'. It must be a private channel.`;
16571
16571
  }
16572
16572
  }
16573
16573
  /** Subscribe registers your client with the server */
16574
16574
  subscribe(callback, timeout = this.timeout) {
16575
- var _a26, _b3, _c;
16575
+ var _a25, _b3, _c;
16576
16576
  if (!this.socket.isConnected()) {
16577
16577
  this.socket.connect();
16578
16578
  }
16579
16579
  if (this.state == CHANNEL_STATES.closed) {
16580
16580
  const { config: { broadcast, presence, private: isPrivate } } = this.params;
16581
- const postgres_changes = (_b3 = (_a26 = this.bindings.postgres_changes) === null || _a26 === void 0 ? void 0 : _a26.map((r) => r.filter)) !== null && _b3 !== void 0 ? _b3 : [];
16581
+ const postgres_changes = (_b3 = (_a25 = this.bindings.postgres_changes) === null || _a25 === void 0 ? void 0 : _a25.map((r) => r.filter)) !== null && _b3 !== void 0 ? _b3 : [];
16582
16582
  const presence_enabled = !!this.bindings[REALTIME_LISTEN_TYPES.PRESENCE] && this.bindings[REALTIME_LISTEN_TYPES.PRESENCE].length > 0 || ((_c = this.params.config.presence) === null || _c === void 0 ? void 0 : _c.enabled) === true;
16583
16583
  const accessTokenPayload = {};
16584
16584
  const config = {
@@ -16596,7 +16596,7 @@ var RealtimeChannel = class _RealtimeChannel {
16596
16596
  this.joinedOnce = true;
16597
16597
  this._rejoin(timeout);
16598
16598
  this.joinPush.receive("ok", async ({ postgres_changes: postgres_changes2 }) => {
16599
- var _a27;
16599
+ var _a26;
16600
16600
  if (!this.socket._isManualToken()) {
16601
16601
  this.socket.setAuth();
16602
16602
  }
@@ -16605,7 +16605,7 @@ var RealtimeChannel = class _RealtimeChannel {
16605
16605
  return;
16606
16606
  } else {
16607
16607
  const clientPostgresBindings = this.bindings.postgres_changes;
16608
- const bindingsLen = (_a27 = clientPostgresBindings === null || clientPostgresBindings === void 0 ? void 0 : clientPostgresBindings.length) !== null && _a27 !== void 0 ? _a27 : 0;
16608
+ const bindingsLen = (_a26 = clientPostgresBindings === null || clientPostgresBindings === void 0 ? void 0 : clientPostgresBindings.length) !== null && _a26 !== void 0 ? _a26 : 0;
16609
16609
  const newPostgresBindings = [];
16610
16610
  for (let i = 0; i < bindingsLen; i++) {
16611
16611
  const clientPostgresBinding = clientPostgresBindings[i];
@@ -16683,7 +16683,7 @@ var RealtimeChannel = class _RealtimeChannel {
16683
16683
  * @returns Promise resolving to object with success status, and error details if failed
16684
16684
  */
16685
16685
  async httpSend(event, payload, opts = {}) {
16686
- var _a26;
16686
+ var _a25;
16687
16687
  if (payload === void 0 || payload === null) {
16688
16688
  return Promise.reject("Payload is required for httpSend()");
16689
16689
  }
@@ -16708,7 +16708,7 @@ var RealtimeChannel = class _RealtimeChannel {
16708
16708
  ]
16709
16709
  })
16710
16710
  };
16711
- const response = await this._fetchWithTimeout(this.broadcastEndpointURL, options, (_a26 = opts.timeout) !== null && _a26 !== void 0 ? _a26 : this.timeout);
16711
+ const response = await this._fetchWithTimeout(this.broadcastEndpointURL, options, (_a25 = opts.timeout) !== null && _a25 !== void 0 ? _a25 : this.timeout);
16712
16712
  if (response.status === 202) {
16713
16713
  return { success: true };
16714
16714
  }
@@ -16730,7 +16730,7 @@ var RealtimeChannel = class _RealtimeChannel {
16730
16730
  * @param opts Options to be used during the send process
16731
16731
  */
16732
16732
  async send(args, opts = {}) {
16733
- var _a26, _b3;
16733
+ var _a25, _b3;
16734
16734
  if (!this._canPush() && args.type === "broadcast") {
16735
16735
  console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");
16736
16736
  const { event, payload: endpoint_payload } = args;
@@ -16756,7 +16756,7 @@ var RealtimeChannel = class _RealtimeChannel {
16756
16756
  })
16757
16757
  };
16758
16758
  try {
16759
- const response = await this._fetchWithTimeout(this.broadcastEndpointURL, options, (_a26 = opts.timeout) !== null && _a26 !== void 0 ? _a26 : this.timeout);
16759
+ const response = await this._fetchWithTimeout(this.broadcastEndpointURL, options, (_a25 = opts.timeout) !== null && _a25 !== void 0 ? _a25 : this.timeout);
16760
16760
  await ((_b3 = response.body) === null || _b3 === void 0 ? void 0 : _b3.cancel());
16761
16761
  return response.ok ? "ok" : "error";
16762
16762
  } catch (error) {
@@ -16768,9 +16768,9 @@ var RealtimeChannel = class _RealtimeChannel {
16768
16768
  }
16769
16769
  } else {
16770
16770
  return new Promise((resolve) => {
16771
- var _a27, _b4, _c;
16771
+ var _a26, _b4, _c;
16772
16772
  const push = this._push(args.type, args, opts.timeout || this.timeout);
16773
- if (args.type === "broadcast" && !((_c = (_b4 = (_a27 = this.params) === null || _a27 === void 0 ? void 0 : _a27.config) === null || _b4 === void 0 ? void 0 : _b4.broadcast) === null || _c === void 0 ? void 0 : _c.ack)) {
16773
+ if (args.type === "broadcast" && !((_c = (_b4 = (_a26 = this.params) === null || _a26 === void 0 ? void 0 : _a26.config) === null || _b4 === void 0 ? void 0 : _b4.broadcast) === null || _c === void 0 ? void 0 : _c.ack)) {
16774
16774
  resolve("ok");
16775
16775
  }
16776
16776
  push.receive("ok", () => resolve("ok"));
@@ -16889,7 +16889,7 @@ var RealtimeChannel = class _RealtimeChannel {
16889
16889
  }
16890
16890
  /** @internal */
16891
16891
  _trigger(type, payload, ref) {
16892
- var _a26, _b3;
16892
+ var _a25, _b3;
16893
16893
  const typeLower = type.toLocaleLowerCase();
16894
16894
  const { close, error, leave, join } = CHANNEL_EVENTS;
16895
16895
  const events = [close, error, leave, join];
@@ -16901,17 +16901,17 @@ var RealtimeChannel = class _RealtimeChannel {
16901
16901
  throw "channel onMessage callbacks must return the payload, modified or unmodified";
16902
16902
  }
16903
16903
  if (["insert", "update", "delete"].includes(typeLower)) {
16904
- (_a26 = this.bindings.postgres_changes) === null || _a26 === void 0 ? void 0 : _a26.filter((bind) => {
16905
- var _a27, _b4, _c;
16906
- return ((_a27 = bind.filter) === null || _a27 === void 0 ? void 0 : _a27.event) === "*" || ((_c = (_b4 = bind.filter) === null || _b4 === void 0 ? void 0 : _b4.event) === null || _c === void 0 ? void 0 : _c.toLocaleLowerCase()) === typeLower;
16904
+ (_a25 = this.bindings.postgres_changes) === null || _a25 === void 0 ? void 0 : _a25.filter((bind) => {
16905
+ var _a26, _b4, _c;
16906
+ return ((_a26 = bind.filter) === null || _a26 === void 0 ? void 0 : _a26.event) === "*" || ((_c = (_b4 = bind.filter) === null || _b4 === void 0 ? void 0 : _b4.event) === null || _c === void 0 ? void 0 : _c.toLocaleLowerCase()) === typeLower;
16907
16907
  }).map((bind) => bind.callback(handledPayload, ref));
16908
16908
  } else {
16909
16909
  (_b3 = this.bindings[typeLower]) === null || _b3 === void 0 ? void 0 : _b3.filter((bind) => {
16910
- var _a27, _b4, _c, _d, _e, _f;
16910
+ var _a26, _b4, _c, _d, _e, _f;
16911
16911
  if (["broadcast", "presence", "postgres_changes"].includes(typeLower)) {
16912
16912
  if ("id" in bind) {
16913
16913
  const bindId = bind.id;
16914
- const bindEvent = (_a27 = bind.filter) === null || _a27 === void 0 ? void 0 : _a27.event;
16914
+ const bindEvent = (_a26 = bind.filter) === null || _a26 === void 0 ? void 0 : _a26.event;
16915
16915
  return bindId && ((_b4 = payload.ids) === null || _b4 === void 0 ? void 0 : _b4.includes(bindId)) && (bindEvent === "*" || (bindEvent === null || bindEvent === void 0 ? void 0 : bindEvent.toLocaleLowerCase()) === ((_c = payload.data) === null || _c === void 0 ? void 0 : _c.type.toLocaleLowerCase()));
16916
16916
  } else {
16917
16917
  const bindEvent = (_e = (_d = bind === null || bind === void 0 ? void 0 : bind.filter) === null || _d === void 0 ? void 0 : _d.event) === null || _e === void 0 ? void 0 : _e.toLocaleLowerCase();
@@ -16979,8 +16979,8 @@ var RealtimeChannel = class _RealtimeChannel {
16979
16979
  const typeLower = type.toLocaleLowerCase();
16980
16980
  if (this.bindings[typeLower]) {
16981
16981
  this.bindings[typeLower] = this.bindings[typeLower].filter((bind) => {
16982
- var _a26;
16983
- return !(((_a26 = bind.type) === null || _a26 === void 0 ? void 0 : _a26.toLocaleLowerCase()) === typeLower && _RealtimeChannel.isEqual(bind.filter, filter));
16982
+ var _a25;
16983
+ return !(((_a25 = bind.type) === null || _a25 === void 0 ? void 0 : _a25.toLocaleLowerCase()) === typeLower && _RealtimeChannel.isEqual(bind.filter, filter));
16984
16984
  });
16985
16985
  }
16986
16986
  return this;
@@ -17110,7 +17110,7 @@ var RealtimeClient = class {
17110
17110
  * ```
17111
17111
  */
17112
17112
  constructor(endPoint, options) {
17113
- var _a26;
17113
+ var _a25;
17114
17114
  this.accessTokenValue = null;
17115
17115
  this.apiKey = null;
17116
17116
  this._manuallySetToken = false;
@@ -17149,7 +17149,7 @@ var RealtimeClient = class {
17149
17149
  }
17150
17150
  return (...args) => fetch(...args);
17151
17151
  };
17152
- if (!((_a26 = options === null || options === void 0 ? void 0 : options.params) === null || _a26 === void 0 ? void 0 : _a26.apikey)) {
17152
+ if (!((_a25 = options === null || options === void 0 ? void 0 : options.params) === null || _a25 === void 0 ? void 0 : _a25.apikey)) {
17153
17153
  throw new Error("API key is required to connect to Realtime");
17154
17154
  }
17155
17155
  this.apiKey = options.params.apikey;
@@ -17334,8 +17334,8 @@ Option 2: Install and provide the "ws" package:
17334
17334
  const { topic, event, payload, ref } = data;
17335
17335
  const callback = () => {
17336
17336
  this.encode(data, (result) => {
17337
- var _a26;
17338
- (_a26 = this.conn) === null || _a26 === void 0 ? void 0 : _a26.send(result);
17337
+ var _a25;
17338
+ (_a25 = this.conn) === null || _a25 === void 0 ? void 0 : _a25.send(result);
17339
17339
  });
17340
17340
  };
17341
17341
  this.log("push", `${topic} ${event} (${ref})`, payload);
@@ -17385,7 +17385,7 @@ Option 2: Install and provide the "ws" package:
17385
17385
  * Sends a heartbeat message if the socket is connected.
17386
17386
  */
17387
17387
  async sendHeartbeat() {
17388
- var _a26;
17388
+ var _a25;
17389
17389
  if (!this.isConnected()) {
17390
17390
  try {
17391
17391
  this.heartbeatCallback("disconnected");
@@ -17404,11 +17404,11 @@ Option 2: Install and provide the "ws" package:
17404
17404
  this.log("error", "error in heartbeat callback", e);
17405
17405
  }
17406
17406
  this._wasManualDisconnect = false;
17407
- (_a26 = this.conn) === null || _a26 === void 0 ? void 0 : _a26.close(WS_CLOSE_NORMAL, "heartbeat timeout");
17407
+ (_a25 = this.conn) === null || _a25 === void 0 ? void 0 : _a25.close(WS_CLOSE_NORMAL, "heartbeat timeout");
17408
17408
  setTimeout(() => {
17409
- var _a27;
17409
+ var _a26;
17410
17410
  if (!this.isConnected()) {
17411
- (_a27 = this.reconnectTimer) === null || _a27 === void 0 ? void 0 : _a27.scheduleTimeout();
17411
+ (_a26 = this.reconnectTimer) === null || _a26 === void 0 ? void 0 : _a26.scheduleTimeout();
17412
17412
  }
17413
17413
  }, CONNECTION_TIMEOUTS.HEARTBEAT_TIMEOUT_FALLBACK);
17414
17414
  return;
@@ -17506,12 +17506,12 @@ Option 2: Install and provide the "ws" package:
17506
17506
  * @internal
17507
17507
  */
17508
17508
  _clearTimer(timer) {
17509
- var _a26;
17509
+ var _a25;
17510
17510
  if (timer === "heartbeat" && this.heartbeatTimer) {
17511
17511
  clearInterval(this.heartbeatTimer);
17512
17512
  this.heartbeatTimer = void 0;
17513
17513
  } else if (timer === "reconnect") {
17514
- (_a26 = this.reconnectTimer) === null || _a26 === void 0 ? void 0 : _a26.reset();
17514
+ (_a25 = this.reconnectTimer) === null || _a25 === void 0 ? void 0 : _a25.reset();
17515
17515
  }
17516
17516
  }
17517
17517
  /**
@@ -17626,13 +17626,13 @@ Option 2: Install and provide the "ws" package:
17626
17626
  }
17627
17627
  /** @internal */
17628
17628
  _onConnClose(event) {
17629
- var _a26;
17629
+ var _a25;
17630
17630
  this._setConnectionState("disconnected");
17631
17631
  this.log("transport", "close", event);
17632
17632
  this._triggerChanError();
17633
17633
  this._clearTimer("heartbeat");
17634
17634
  if (!this._wasManualDisconnect) {
17635
- (_a26 = this.reconnectTimer) === null || _a26 === void 0 ? void 0 : _a26.scheduleTimeout();
17635
+ (_a25 = this.reconnectTimer) === null || _a25 === void 0 ? void 0 : _a25.scheduleTimeout();
17636
17636
  }
17637
17637
  this._triggerStateCallbacks("close", event);
17638
17638
  }
@@ -17780,8 +17780,8 @@ Option 2: Install and provide the "ws" package:
17780
17780
  * @internal
17781
17781
  */
17782
17782
  _initializeOptions(options) {
17783
- var _a26, _b3, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
17784
- this.transport = (_a26 = options === null || options === void 0 ? void 0 : options.transport) !== null && _a26 !== void 0 ? _a26 : null;
17783
+ var _a25, _b3, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
17784
+ this.transport = (_a25 = options === null || options === void 0 ? void 0 : options.transport) !== null && _a25 !== void 0 ? _a25 : null;
17785
17785
  this.timeout = (_b3 = options === null || options === void 0 ? void 0 : options.timeout) !== null && _b3 !== void 0 ? _b3 : DEFAULT_TIMEOUT;
17786
17786
  this.heartbeatIntervalMs = (_c = options === null || options === void 0 ? void 0 : options.heartbeatIntervalMs) !== null && _c !== void 0 ? _c : CONNECTION_TIMEOUTS.HEARTBEAT_INTERVAL;
17787
17787
  this.worker = (_d = options === null || options === void 0 ? void 0 : options.worker) !== null && _d !== void 0 ? _d : false;
@@ -17827,14 +17827,14 @@ Option 2: Install and provide the "ws" package:
17827
17827
  // node_modules/.pnpm/iceberg-js@0.8.1/node_modules/iceberg-js/dist/index.mjs
17828
17828
  var IcebergError = class extends Error {
17829
17829
  constructor(message, opts) {
17830
- var _a26;
17830
+ var _a25;
17831
17831
  super(message);
17832
17832
  this.name = "IcebergError";
17833
17833
  this.status = opts.status;
17834
17834
  this.icebergType = opts.icebergType;
17835
17835
  this.icebergCode = opts.icebergCode;
17836
17836
  this.details = opts.details;
17837
- this.isCommitStateUnknown = opts.icebergType === "CommitStateUnknownException" || [500, 502, 504].includes(opts.status) && ((_a26 = opts.icebergType) == null ? void 0 : _a26.includes("CommitState")) === true;
17837
+ this.isCommitStateUnknown = opts.icebergType === "CommitStateUnknownException" || [500, 502, 504].includes(opts.status) && ((_a25 = opts.icebergType) == null ? void 0 : _a25.includes("CommitState")) === true;
17838
17838
  }
17839
17839
  /**
17840
17840
  * Returns true if the error is a 404 Not Found error.
@@ -17882,8 +17882,8 @@ async function buildAuthHeaders(auth) {
17882
17882
  return {};
17883
17883
  }
17884
17884
  function createFetchClient(options) {
17885
- var _a26;
17886
- const fetchFn = (_a26 = options.fetchImpl) != null ? _a26 : globalThis.fetch;
17885
+ var _a25;
17886
+ const fetchFn = (_a25 = options.fetchImpl) != null ? _a25 : globalThis.fetch;
17887
17887
  return {
17888
17888
  async request({
17889
17889
  method,
@@ -17892,7 +17892,7 @@ function createFetchClient(options) {
17892
17892
  body,
17893
17893
  headers
17894
17894
  }) {
17895
- var _a27;
17895
+ var _a26;
17896
17896
  const url = buildUrl(options.baseUrl, path, query);
17897
17897
  const authHeaders = await buildAuthHeaders(options.auth);
17898
17898
  const res = await fetchFn(url, {
@@ -17911,7 +17911,7 @@ function createFetchClient(options) {
17911
17911
  const errBody = isJson ? data : void 0;
17912
17912
  const errorDetail = errBody == null ? void 0 : errBody.error;
17913
17913
  throw new IcebergError(
17914
- (_a27 = errorDetail == null ? void 0 : errorDetail.message) != null ? _a27 : `Request failed with status ${res.status}`,
17914
+ (_a26 = errorDetail == null ? void 0 : errorDetail.message) != null ? _a26 : `Request failed with status ${res.status}`,
17915
17915
  {
17916
17916
  status: res.status,
17917
17917
  icebergType: errorDetail == null ? void 0 : errorDetail.type,
@@ -18034,11 +18034,11 @@ var TableOperations = class {
18034
18034
  };
18035
18035
  }
18036
18036
  async dropTable(id, options) {
18037
- var _a26;
18037
+ var _a25;
18038
18038
  await this.client.request({
18039
18039
  method: "DELETE",
18040
18040
  path: `${this.prefix}/namespaces/${namespaceToPath2(id.namespace)}/tables/${id.name}`,
18041
- query: { purgeRequested: String((_a26 = options == null ? void 0 : options.purge) != null ? _a26 : false) }
18041
+ query: { purgeRequested: String((_a25 = options == null ? void 0 : options.purge) != null ? _a25 : false) }
18042
18042
  });
18043
18043
  }
18044
18044
  async loadTable(id) {
@@ -18090,7 +18090,7 @@ var IcebergRestCatalog = class {
18090
18090
  * @param options - Configuration options for the catalog client
18091
18091
  */
18092
18092
  constructor(options) {
18093
- var _a26;
18093
+ var _a25;
18094
18094
  let prefix = "v1";
18095
18095
  if (options.catalogName) {
18096
18096
  prefix += `/${options.catalogName}`;
@@ -18101,7 +18101,7 @@ var IcebergRestCatalog = class {
18101
18101
  auth: options.auth,
18102
18102
  fetchImpl: options.fetch
18103
18103
  });
18104
- this.accessDelegation = (_a26 = options.accessDelegation) == null ? void 0 : _a26.join(",");
18104
+ this.accessDelegation = (_a25 = options.accessDelegation) == null ? void 0 : _a25.join(",");
18105
18105
  this.namespaceOps = new NamespaceOperations(this.client, prefix);
18106
18106
  this.tableOps = new TableOperations(this.client, prefix, this.accessDelegation);
18107
18107
  }
@@ -21074,7 +21074,7 @@ var getItemAsync = async (storage, key) => {
21074
21074
  }
21075
21075
  try {
21076
21076
  return JSON.parse(value);
21077
- } catch (_a26) {
21077
+ } catch (_a25) {
21078
21078
  return value;
21079
21079
  }
21080
21080
  };
@@ -21285,7 +21285,7 @@ function deepClone(obj) {
21285
21285
  var _getErrorMessage2 = (err) => err.msg || err.message || err.error_description || err.error || JSON.stringify(err);
21286
21286
  var NETWORK_ERROR_CODES = [502, 503, 504];
21287
21287
  async function handleError2(error) {
21288
- var _a26;
21288
+ var _a25;
21289
21289
  if (!looksLikeFetchResponse(error)) {
21290
21290
  throw new AuthRetryableFetchError(_getErrorMessage2(error), 0);
21291
21291
  }
@@ -21310,7 +21310,7 @@ async function handleError2(error) {
21310
21310
  throw new AuthWeakPasswordError(_getErrorMessage2(data), error.status, data.weak_password.reasons);
21311
21311
  }
21312
21312
  } else if (errorCode === "weak_password") {
21313
- throw new AuthWeakPasswordError(_getErrorMessage2(data), error.status, ((_a26 = data.weak_password) === null || _a26 === void 0 ? void 0 : _a26.reasons) || []);
21313
+ throw new AuthWeakPasswordError(_getErrorMessage2(data), error.status, ((_a25 = data.weak_password) === null || _a25 === void 0 ? void 0 : _a25.reasons) || []);
21314
21314
  } else if (errorCode === "session_not_found") {
21315
21315
  throw new AuthSessionMissingError();
21316
21316
  }
@@ -21326,7 +21326,7 @@ var _getRequestParams2 = (method, options, parameters, body) => {
21326
21326
  return Object.assign(Object.assign({}, params), parameters);
21327
21327
  };
21328
21328
  async function _request(fetcher, method, url, options) {
21329
- var _a26;
21329
+ var _a25;
21330
21330
  const headers = Object.assign({}, options === null || options === void 0 ? void 0 : options.headers);
21331
21331
  if (!headers[API_VERSION_HEADER_NAME]) {
21332
21332
  headers[API_VERSION_HEADER_NAME] = API_VERSIONS["2024-01-01"].name;
@@ -21334,7 +21334,7 @@ async function _request(fetcher, method, url, options) {
21334
21334
  if (options === null || options === void 0 ? void 0 : options.jwt) {
21335
21335
  headers["Authorization"] = `Bearer ${options.jwt}`;
21336
21336
  }
21337
- const qs = (_a26 = options === null || options === void 0 ? void 0 : options.query) !== null && _a26 !== void 0 ? _a26 : {};
21337
+ const qs = (_a25 = options === null || options === void 0 ? void 0 : options.query) !== null && _a25 !== void 0 ? _a25 : {};
21338
21338
  if (options === null || options === void 0 ? void 0 : options.redirectTo) {
21339
21339
  qs["redirect_to"] = options.redirectTo;
21340
21340
  }
@@ -21367,7 +21367,7 @@ async function _handleRequest2(fetcher, method, url, options, parameters, body)
21367
21367
  }
21368
21368
  }
21369
21369
  function _sessionResponse(data) {
21370
- var _a26;
21370
+ var _a25;
21371
21371
  let session = null;
21372
21372
  if (hasSession(data)) {
21373
21373
  session = Object.assign({}, data);
@@ -21375,7 +21375,7 @@ function _sessionResponse(data) {
21375
21375
  session.expires_at = expiresAt(data.expires_in);
21376
21376
  }
21377
21377
  }
21378
- const user = (_a26 = data.user) !== null && _a26 !== void 0 ? _a26 : data;
21378
+ const user = (_a25 = data.user) !== null && _a25 !== void 0 ? _a25 : data;
21379
21379
  return { data: { session, user }, error: null };
21380
21380
  }
21381
21381
  function _sessionResponsePassword(data) {
@@ -21386,8 +21386,8 @@ function _sessionResponsePassword(data) {
21386
21386
  return response;
21387
21387
  }
21388
21388
  function _userResponse(data) {
21389
- var _a26;
21390
- const user = (_a26 = data.user) !== null && _a26 !== void 0 ? _a26 : data;
21389
+ var _a25;
21390
+ const user = (_a25 = data.user) !== null && _a25 !== void 0 ? _a25 : data;
21391
21391
  return { data: { user }, error: null };
21392
21392
  }
21393
21393
  function _ssoResponse(data) {
@@ -21556,14 +21556,14 @@ var GoTrueAdminApi = class {
21556
21556
  * @param params An object which supports `page` and `perPage` as numbers, to alter the paginated results.
21557
21557
  */
21558
21558
  async listUsers(params) {
21559
- var _a26, _b3, _c, _d, _e, _f, _g;
21559
+ var _a25, _b3, _c, _d, _e, _f, _g;
21560
21560
  try {
21561
21561
  const pagination = { nextPage: null, lastPage: 0, total: 0 };
21562
21562
  const response = await _request(this.fetch, "GET", `${this.url}/admin/users`, {
21563
21563
  headers: this.headers,
21564
21564
  noResolveJson: true,
21565
21565
  query: {
21566
- page: (_b3 = (_a26 = params === null || params === void 0 ? void 0 : params.page) === null || _a26 === void 0 ? void 0 : _a26.toString()) !== null && _b3 !== void 0 ? _b3 : "",
21566
+ page: (_b3 = (_a25 = params === null || params === void 0 ? void 0 : params.page) === null || _a25 === void 0 ? void 0 : _a25.toString()) !== null && _b3 !== void 0 ? _b3 : "",
21567
21567
  per_page: (_d = (_c = params === null || params === void 0 ? void 0 : params.perPage) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : ""
21568
21568
  },
21569
21569
  xform: _noResolveJsonResponse
@@ -21697,14 +21697,14 @@ var GoTrueAdminApi = class {
21697
21697
  * This function should only be called on a server. Never expose your `service_role` key in the browser.
21698
21698
  */
21699
21699
  async _listOAuthClients(params) {
21700
- var _a26, _b3, _c, _d, _e, _f, _g;
21700
+ var _a25, _b3, _c, _d, _e, _f, _g;
21701
21701
  try {
21702
21702
  const pagination = { nextPage: null, lastPage: 0, total: 0 };
21703
21703
  const response = await _request(this.fetch, "GET", `${this.url}/admin/oauth/clients`, {
21704
21704
  headers: this.headers,
21705
21705
  noResolveJson: true,
21706
21706
  query: {
21707
- page: (_b3 = (_a26 = params === null || params === void 0 ? void 0 : params.page) === null || _a26 === void 0 ? void 0 : _a26.toString()) !== null && _b3 !== void 0 ? _b3 : "",
21707
+ page: (_b3 = (_a25 = params === null || params === void 0 ? void 0 : params.page) === null || _a25 === void 0 ? void 0 : _a25.toString()) !== null && _b3 !== void 0 ? _b3 : "",
21708
21708
  per_page: (_d = (_c = params === null || params === void 0 ? void 0 : params.perPage) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : ""
21709
21709
  },
21710
21710
  xform: _noResolveJsonResponse
@@ -21957,7 +21957,7 @@ function toHex(value) {
21957
21957
  return "0x" + hex;
21958
21958
  }
21959
21959
  function createSiweMessage(parameters) {
21960
- var _a26;
21960
+ var _a25;
21961
21961
  const { chainId, domain, expirationTime, issuedAt = /* @__PURE__ */ new Date(), nonce, notBefore, requestId, resources, scheme, uri, version: version5 } = parameters;
21962
21962
  {
21963
21963
  if (!Number.isInteger(chainId))
@@ -21970,7 +21970,7 @@ function createSiweMessage(parameters) {
21970
21970
  throw new Error(`@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.`);
21971
21971
  if (version5 !== "1")
21972
21972
  throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${version5}`);
21973
- if ((_a26 = parameters.statement) === null || _a26 === void 0 ? void 0 : _a26.includes("\n"))
21973
+ if ((_a25 = parameters.statement) === null || _a25 === void 0 ? void 0 : _a25.includes("\n"))
21974
21974
  throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${parameters.statement}`);
21975
21975
  }
21976
21976
  const address = getAddress(parameters.address);
@@ -22012,10 +22012,10 @@ ${suffix}`;
22012
22012
  // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/webauthn.errors.js
22013
22013
  var WebAuthnError = class extends Error {
22014
22014
  constructor({ message, code, cause, name }) {
22015
- var _a26;
22015
+ var _a25;
22016
22016
  super(message, { cause });
22017
22017
  this.__isWebAuthnError = true;
22018
- this.name = (_a26 = name !== null && name !== void 0 ? name : cause instanceof Error ? cause.name : void 0) !== null && _a26 !== void 0 ? _a26 : "Unknown Error";
22018
+ this.name = (_a25 = name !== null && name !== void 0 ? name : cause instanceof Error ? cause.name : void 0) !== null && _a25 !== void 0 ? _a25 : "Unknown Error";
22019
22019
  this.code = code;
22020
22020
  }
22021
22021
  };
@@ -22031,7 +22031,7 @@ var WebAuthnUnknownError = class extends WebAuthnError {
22031
22031
  }
22032
22032
  };
22033
22033
  function identifyRegistrationError({ error, options }) {
22034
- var _a26, _b3, _c;
22034
+ var _a25, _b3, _c;
22035
22035
  const { publicKey } = options;
22036
22036
  if (!publicKey) {
22037
22037
  throw Error("options was missing required publicKey property");
@@ -22045,7 +22045,7 @@ function identifyRegistrationError({ error, options }) {
22045
22045
  });
22046
22046
  }
22047
22047
  } else if (error.name === "ConstraintError") {
22048
- if (((_a26 = publicKey.authenticatorSelection) === null || _a26 === void 0 ? void 0 : _a26.requireResidentKey) === true) {
22048
+ if (((_a25 = publicKey.authenticatorSelection) === null || _a25 === void 0 ? void 0 : _a25.requireResidentKey) === true) {
22049
22049
  return new WebAuthnError({
22050
22050
  message: "Discoverable credentials were required but no available authenticator supported it",
22051
22051
  code: "ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",
@@ -22274,7 +22274,7 @@ function deserializeCredentialRequestOptions(options) {
22274
22274
  return result;
22275
22275
  }
22276
22276
  function serializeCredentialCreationResponse(credential) {
22277
- var _a26;
22277
+ var _a25;
22278
22278
  if ("toJSON" in credential && typeof credential.toJSON === "function") {
22279
22279
  return credential.toJSON();
22280
22280
  }
@@ -22289,11 +22289,11 @@ function serializeCredentialCreationResponse(credential) {
22289
22289
  type: "public-key",
22290
22290
  clientExtensionResults: credential.getClientExtensionResults(),
22291
22291
  // Convert null to undefined and cast to AuthenticatorAttachment type
22292
- authenticatorAttachment: (_a26 = credentialWithAttachment.authenticatorAttachment) !== null && _a26 !== void 0 ? _a26 : void 0
22292
+ authenticatorAttachment: (_a25 = credentialWithAttachment.authenticatorAttachment) !== null && _a25 !== void 0 ? _a25 : void 0
22293
22293
  };
22294
22294
  }
22295
22295
  function serializeCredentialRequestResponse(credential) {
22296
- var _a26;
22296
+ var _a25;
22297
22297
  if ("toJSON" in credential && typeof credential.toJSON === "function") {
22298
22298
  return credential.toJSON();
22299
22299
  }
@@ -22313,7 +22313,7 @@ function serializeCredentialRequestResponse(credential) {
22313
22313
  type: "public-key",
22314
22314
  clientExtensionResults,
22315
22315
  // Convert null to undefined and cast to AuthenticatorAttachment type
22316
- authenticatorAttachment: (_a26 = credentialWithAttachment.authenticatorAttachment) !== null && _a26 !== void 0 ? _a26 : void 0
22316
+ authenticatorAttachment: (_a25 = credentialWithAttachment.authenticatorAttachment) !== null && _a25 !== void 0 ? _a25 : void 0
22317
22317
  };
22318
22318
  }
22319
22319
  function isValidDomain(hostname) {
@@ -22323,8 +22323,8 @@ function isValidDomain(hostname) {
22323
22323
  );
22324
22324
  }
22325
22325
  function browserSupportsWebAuthn() {
22326
- var _a26, _b3;
22327
- return !!(isBrowser() && "PublicKeyCredential" in window && window.PublicKeyCredential && "credentials" in navigator && typeof ((_a26 = navigator === null || navigator === void 0 ? void 0 : navigator.credentials) === null || _a26 === void 0 ? void 0 : _a26.create) === "function" && typeof ((_b3 = navigator === null || navigator === void 0 ? void 0 : navigator.credentials) === null || _b3 === void 0 ? void 0 : _b3.get) === "function");
22326
+ var _a25, _b3;
22327
+ return !!(isBrowser() && "PublicKeyCredential" in window && window.PublicKeyCredential && "credentials" in navigator && typeof ((_a25 = navigator === null || navigator === void 0 ? void 0 : navigator.credentials) === null || _a25 === void 0 ? void 0 : _a25.create) === "function" && typeof ((_b3 = navigator === null || navigator === void 0 ? void 0 : navigator.credentials) === null || _b3 === void 0 ? void 0 : _b3.get) === "function");
22328
22328
  }
22329
22329
  async function createCredential(options) {
22330
22330
  try {
@@ -22472,7 +22472,7 @@ var WebAuthnApi = class {
22472
22472
  * @see {@link https://w3c.github.io/webauthn/#sctn-verifying-assertion W3C WebAuthn Spec - Verifying Assertion}
22473
22473
  */
22474
22474
  async _challenge({ factorId, webauthn, friendlyName, signal }, overrides) {
22475
- var _a26;
22475
+ var _a25;
22476
22476
  try {
22477
22477
  const { data: challengeResponse, error: challengeError } = await this.client.mfa.challenge({
22478
22478
  factorId,
@@ -22489,7 +22489,7 @@ var WebAuthnApi = class {
22489
22489
  if (!nameToUse) {
22490
22490
  const currentUser = await this.client.getUser();
22491
22491
  const userData = currentUser.data.user;
22492
- const fallbackName = ((_a26 = userData === null || userData === void 0 ? void 0 : userData.user_metadata) === null || _a26 === void 0 ? void 0 : _a26.name) || (userData === null || userData === void 0 ? void 0 : userData.email) || (userData === null || userData === void 0 ? void 0 : userData.id) || "User";
22492
+ const fallbackName = ((_a25 = userData === null || userData === void 0 ? void 0 : userData.user_metadata) === null || _a25 === void 0 ? void 0 : _a25.name) || (userData === null || userData === void 0 ? void 0 : userData.email) || (userData === null || userData === void 0 ? void 0 : userData.id) || "User";
22493
22493
  user.name = `${user.id}:${fallbackName}`;
22494
22494
  } else {
22495
22495
  user.name = `${user.id}:${nameToUse}`;
@@ -22662,8 +22662,8 @@ var WebAuthnApi = class {
22662
22662
  });
22663
22663
  if (!factor) {
22664
22664
  await this.client.mfa.listFactors().then((factors) => {
22665
- var _a26;
22666
- return (_a26 = factors.data) === null || _a26 === void 0 ? void 0 : _a26.all.find((v) => v.factor_type === "webauthn" && v.friendly_name === friendlyName && v.status !== "unverified");
22665
+ var _a25;
22666
+ return (_a25 = factors.data) === null || _a25 === void 0 ? void 0 : _a25.all.find((v) => v.factor_type === "webauthn" && v.friendly_name === friendlyName && v.status !== "unverified");
22667
22667
  }).then((factor2) => factor2 ? this.client.mfa.unenroll({ factorId: factor2 === null || factor2 === void 0 ? void 0 : factor2.id }) : void 0);
22668
22668
  return { data: null, error: enrollError };
22669
22669
  }
@@ -22725,15 +22725,15 @@ var GoTrueClient = class _GoTrueClient {
22725
22725
  * The JWKS used for verifying asymmetric JWTs
22726
22726
  */
22727
22727
  get jwks() {
22728
- var _a26, _b3;
22729
- return (_b3 = (_a26 = GLOBAL_JWKS[this.storageKey]) === null || _a26 === void 0 ? void 0 : _a26.jwks) !== null && _b3 !== void 0 ? _b3 : { keys: [] };
22728
+ var _a25, _b3;
22729
+ return (_b3 = (_a25 = GLOBAL_JWKS[this.storageKey]) === null || _a25 === void 0 ? void 0 : _a25.jwks) !== null && _b3 !== void 0 ? _b3 : { keys: [] };
22730
22730
  }
22731
22731
  set jwks(value) {
22732
22732
  GLOBAL_JWKS[this.storageKey] = Object.assign(Object.assign({}, GLOBAL_JWKS[this.storageKey]), { jwks: value });
22733
22733
  }
22734
22734
  get jwks_cached_at() {
22735
- var _a26, _b3;
22736
- return (_b3 = (_a26 = GLOBAL_JWKS[this.storageKey]) === null || _a26 === void 0 ? void 0 : _a26.cachedAt) !== null && _b3 !== void 0 ? _b3 : Number.MIN_SAFE_INTEGER;
22735
+ var _a25, _b3;
22736
+ return (_b3 = (_a25 = GLOBAL_JWKS[this.storageKey]) === null || _a25 === void 0 ? void 0 : _a25.cachedAt) !== null && _b3 !== void 0 ? _b3 : Number.MIN_SAFE_INTEGER;
22737
22737
  }
22738
22738
  set jwks_cached_at(value) {
22739
22739
  GLOBAL_JWKS[this.storageKey] = Object.assign(Object.assign({}, GLOBAL_JWKS[this.storageKey]), { cachedAt: value });
@@ -22753,7 +22753,7 @@ var GoTrueClient = class _GoTrueClient {
22753
22753
  * ```
22754
22754
  */
22755
22755
  constructor(options) {
22756
- var _a26, _b3, _c;
22756
+ var _a25, _b3, _c;
22757
22757
  this.userStorage = null;
22758
22758
  this.memoryStorage = null;
22759
22759
  this.stateChangeEmitters = /* @__PURE__ */ new Map();
@@ -22771,7 +22771,7 @@ var GoTrueClient = class _GoTrueClient {
22771
22771
  this.logger = console.log;
22772
22772
  const settings = Object.assign(Object.assign({}, DEFAULT_OPTIONS), options);
22773
22773
  this.storageKey = settings.storageKey;
22774
- this.instanceID = (_a26 = _GoTrueClient.nextInstanceID[this.storageKey]) !== null && _a26 !== void 0 ? _a26 : 0;
22774
+ this.instanceID = (_a25 = _GoTrueClient.nextInstanceID[this.storageKey]) !== null && _a25 !== void 0 ? _a25 : 0;
22775
22775
  _GoTrueClient.nextInstanceID[this.storageKey] = this.instanceID + 1;
22776
22776
  this.logDebugMessages = !!settings.debug;
22777
22777
  if (typeof settings.debug === "function") {
@@ -22914,7 +22914,7 @@ var GoTrueClient = class _GoTrueClient {
22914
22914
  * the whole lifetime of the client
22915
22915
  */
22916
22916
  async _initialize() {
22917
- var _a26;
22917
+ var _a25;
22918
22918
  try {
22919
22919
  let params = {};
22920
22920
  let callbackUrlType = "none";
@@ -22931,7 +22931,7 @@ var GoTrueClient = class _GoTrueClient {
22931
22931
  if (error) {
22932
22932
  this._debug("#_initialize()", "error detecting session from URL", error);
22933
22933
  if (isAuthImplicitGrantRedirectError(error)) {
22934
- const errorCode = (_a26 = error.details) === null || _a26 === void 0 ? void 0 : _a26.code;
22934
+ const errorCode = (_a25 = error.details) === null || _a25 === void 0 ? void 0 : _a25.code;
22935
22935
  if (errorCode === "identity_already_exists" || errorCode === "identity_not_found" || errorCode === "single_identity_not_deletable") {
22936
22936
  return { error };
22937
22937
  }
@@ -22970,12 +22970,12 @@ var GoTrueClient = class _GoTrueClient {
22970
22970
  * @returns A session where the is_anonymous claim in the access token JWT set to true
22971
22971
  */
22972
22972
  async signInAnonymously(credentials) {
22973
- var _a26, _b3, _c;
22973
+ var _a25, _b3, _c;
22974
22974
  try {
22975
22975
  const res = await _request(this.fetch, "POST", `${this.url}/signup`, {
22976
22976
  headers: this.headers,
22977
22977
  body: {
22978
- data: (_b3 = (_a26 = credentials === null || credentials === void 0 ? void 0 : credentials.options) === null || _a26 === void 0 ? void 0 : _a26.data) !== null && _b3 !== void 0 ? _b3 : {},
22978
+ data: (_b3 = (_a25 = credentials === null || credentials === void 0 ? void 0 : credentials.options) === null || _a25 === void 0 ? void 0 : _a25.data) !== null && _b3 !== void 0 ? _b3 : {},
22979
22979
  gotrue_meta_security: { captcha_token: (_c = credentials === null || credentials === void 0 ? void 0 : credentials.options) === null || _c === void 0 ? void 0 : _c.captchaToken }
22980
22980
  },
22981
22981
  xform: _sessionResponse
@@ -23009,7 +23009,7 @@ var GoTrueClient = class _GoTrueClient {
23009
23009
  * @returns A user if the server has "autoconfirm" OFF
23010
23010
  */
23011
23011
  async signUp(credentials) {
23012
- var _a26, _b3, _c;
23012
+ var _a25, _b3, _c;
23013
23013
  try {
23014
23014
  let res;
23015
23015
  if ("email" in credentials) {
@@ -23026,7 +23026,7 @@ var GoTrueClient = class _GoTrueClient {
23026
23026
  body: {
23027
23027
  email,
23028
23028
  password,
23029
- data: (_a26 = options === null || options === void 0 ? void 0 : options.data) !== null && _a26 !== void 0 ? _a26 : {},
23029
+ data: (_a25 = options === null || options === void 0 ? void 0 : options.data) !== null && _a25 !== void 0 ? _a25 : {},
23030
23030
  gotrue_meta_security: { captcha_token: options === null || options === void 0 ? void 0 : options.captchaToken },
23031
23031
  code_challenge: codeChallenge,
23032
23032
  code_challenge_method: codeChallengeMethod
@@ -23132,9 +23132,9 @@ var GoTrueClient = class _GoTrueClient {
23132
23132
  * This method supports the PKCE flow.
23133
23133
  */
23134
23134
  async signInWithOAuth(credentials) {
23135
- var _a26, _b3, _c, _d;
23135
+ var _a25, _b3, _c, _d;
23136
23136
  return await this._handleProviderSignIn(credentials.provider, {
23137
- redirectTo: (_a26 = credentials.options) === null || _a26 === void 0 ? void 0 : _a26.redirectTo,
23137
+ redirectTo: (_a25 = credentials.options) === null || _a25 === void 0 ? void 0 : _a25.redirectTo,
23138
23138
  scopes: (_b3 = credentials.options) === null || _b3 === void 0 ? void 0 : _b3.scopes,
23139
23139
  queryParams: (_c = credentials.options) === null || _c === void 0 ? void 0 : _c.queryParams,
23140
23140
  skipBrowserRedirect: (_d = credentials.options) === null || _d === void 0 ? void 0 : _d.skipBrowserRedirect
@@ -23168,7 +23168,7 @@ var GoTrueClient = class _GoTrueClient {
23168
23168
  }
23169
23169
  }
23170
23170
  async signInWithEthereum(credentials) {
23171
- var _a26, _b3, _c, _d, _e, _f, _g, _h, _j, _k, _l;
23171
+ var _a25, _b3, _c, _d, _e, _f, _g, _h, _j, _k, _l;
23172
23172
  let message;
23173
23173
  let signature;
23174
23174
  if ("message" in credentials) {
@@ -23192,7 +23192,7 @@ var GoTrueClient = class _GoTrueClient {
23192
23192
  throw new Error(`@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.`);
23193
23193
  }
23194
23194
  }
23195
- const url = new URL((_a26 = options === null || options === void 0 ? void 0 : options.url) !== null && _a26 !== void 0 ? _a26 : window.location.href);
23195
+ const url = new URL((_a25 = options === null || options === void 0 ? void 0 : options.url) !== null && _a25 !== void 0 ? _a25 : window.location.href);
23196
23196
  const accounts = await resolvedWallet.request({
23197
23197
  method: "eth_requestAccounts"
23198
23198
  }).then((accs) => accs).catch(() => {
@@ -23259,7 +23259,7 @@ var GoTrueClient = class _GoTrueClient {
23259
23259
  }
23260
23260
  }
23261
23261
  async signInWithSolana(credentials) {
23262
- var _a26, _b3, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
23262
+ var _a25, _b3, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
23263
23263
  let message;
23264
23264
  let signature;
23265
23265
  if ("message" in credentials) {
@@ -23283,7 +23283,7 @@ var GoTrueClient = class _GoTrueClient {
23283
23283
  throw new Error(`@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.`);
23284
23284
  }
23285
23285
  }
23286
- const url = new URL((_a26 = options === null || options === void 0 ? void 0 : options.url) !== null && _a26 !== void 0 ? _a26 : window.location.href);
23286
+ const url = new URL((_a25 = options === null || options === void 0 ? void 0 : options.url) !== null && _a25 !== void 0 ? _a25 : window.location.href);
23287
23287
  if ("signIn" in resolvedWallet && resolvedWallet.signIn) {
23288
23288
  const output = await resolvedWallet.signIn(Object.assign(Object.assign(Object.assign({ issuedAt: (/* @__PURE__ */ new Date()).toISOString() }, options === null || options === void 0 ? void 0 : options.signInWithSolana), {
23289
23289
  // non-overridable properties
@@ -23455,7 +23455,7 @@ var GoTrueClient = class _GoTrueClient {
23455
23455
  * This method supports PKCE when an email is passed.
23456
23456
  */
23457
23457
  async signInWithOtp(credentials) {
23458
- var _a26, _b3, _c, _d, _e;
23458
+ var _a25, _b3, _c, _d, _e;
23459
23459
  try {
23460
23460
  if ("email" in credentials) {
23461
23461
  const { email, options } = credentials;
@@ -23469,7 +23469,7 @@ var GoTrueClient = class _GoTrueClient {
23469
23469
  headers: this.headers,
23470
23470
  body: {
23471
23471
  email,
23472
- data: (_a26 = options === null || options === void 0 ? void 0 : options.data) !== null && _a26 !== void 0 ? _a26 : {},
23472
+ data: (_a25 = options === null || options === void 0 ? void 0 : options.data) !== null && _a25 !== void 0 ? _a25 : {},
23473
23473
  create_user: (_b3 = options === null || options === void 0 ? void 0 : options.shouldCreateUser) !== null && _b3 !== void 0 ? _b3 : true,
23474
23474
  gotrue_meta_security: { captcha_token: options === null || options === void 0 ? void 0 : options.captchaToken },
23475
23475
  code_challenge: codeChallenge,
@@ -23509,12 +23509,12 @@ var GoTrueClient = class _GoTrueClient {
23509
23509
  * Log in a user given a User supplied OTP or TokenHash received through mobile or email.
23510
23510
  */
23511
23511
  async verifyOtp(params) {
23512
- var _a26, _b3;
23512
+ var _a25, _b3;
23513
23513
  try {
23514
23514
  let redirectTo = void 0;
23515
23515
  let captchaToken = void 0;
23516
23516
  if ("options" in params) {
23517
- redirectTo = (_a26 = params.options) === null || _a26 === void 0 ? void 0 : _a26.redirectTo;
23517
+ redirectTo = (_a25 = params.options) === null || _a25 === void 0 ? void 0 : _a25.redirectTo;
23518
23518
  captchaToken = (_b3 = params.options) === null || _b3 === void 0 ? void 0 : _b3.captchaToken;
23519
23519
  }
23520
23520
  const { data, error } = await _request(this.fetch, "POST", `${this.url}/verify`, {
@@ -23559,7 +23559,7 @@ var GoTrueClient = class _GoTrueClient {
23559
23559
  * organization's SSO Identity Provider UUID directly instead.
23560
23560
  */
23561
23561
  async signInWithSSO(params) {
23562
- var _a26, _b3, _c, _d, _e;
23562
+ var _a25, _b3, _c, _d, _e;
23563
23563
  try {
23564
23564
  let codeChallenge = null;
23565
23565
  let codeChallengeMethod = null;
@@ -23568,7 +23568,7 @@ var GoTrueClient = class _GoTrueClient {
23568
23568
  [codeChallenge, codeChallengeMethod] = await getCodeChallengeAndMethod(this.storage, this.storageKey);
23569
23569
  }
23570
23570
  const result = await _request(this.fetch, "POST", `${this.url}/sso`, {
23571
- body: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, "providerId" in params ? { provider_id: params.providerId } : null), "domain" in params ? { domain: params.domain } : null), { redirect_to: (_b3 = (_a26 = params.options) === null || _a26 === void 0 ? void 0 : _a26.redirectTo) !== null && _b3 !== void 0 ? _b3 : void 0 }), ((_c = params === null || params === void 0 ? void 0 : params.options) === null || _c === void 0 ? void 0 : _c.captchaToken) ? { gotrue_meta_security: { captcha_token: params.options.captchaToken } } : null), { skip_http_redirect: true, code_challenge: codeChallenge, code_challenge_method: codeChallengeMethod }),
23571
+ body: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, "providerId" in params ? { provider_id: params.providerId } : null), "domain" in params ? { domain: params.domain } : null), { redirect_to: (_b3 = (_a25 = params.options) === null || _a25 === void 0 ? void 0 : _a25.redirectTo) !== null && _b3 !== void 0 ? _b3 : void 0 }), ((_c = params === null || params === void 0 ? void 0 : params.options) === null || _c === void 0 ? void 0 : _c.captchaToken) ? { gotrue_meta_security: { captcha_token: params.options.captchaToken } } : null), { skip_http_redirect: true, code_challenge: codeChallenge, code_challenge_method: codeChallengeMethod }),
23572
23572
  headers: this.headers,
23573
23573
  xform: _ssoResponse
23574
23574
  });
@@ -23822,12 +23822,12 @@ var GoTrueClient = class _GoTrueClient {
23822
23822
  });
23823
23823
  }
23824
23824
  return await this._useSession(async (result) => {
23825
- var _a26, _b3, _c;
23825
+ var _a25, _b3, _c;
23826
23826
  const { data, error } = result;
23827
23827
  if (error) {
23828
23828
  throw error;
23829
23829
  }
23830
- if (!((_a26 = data.session) === null || _a26 === void 0 ? void 0 : _a26.access_token) && !this.hasCustomAuthorizationHeader) {
23830
+ if (!((_a25 = data.session) === null || _a25 === void 0 ? void 0 : _a25.access_token) && !this.hasCustomAuthorizationHeader) {
23831
23831
  return { data: { user: null }, error: new AuthSessionMissingError() };
23832
23832
  }
23833
23833
  return await _request(this.fetch, "GET", `${this.url}/user`, {
@@ -23969,13 +23969,13 @@ var GoTrueClient = class _GoTrueClient {
23969
23969
  async _refreshSession(currentSession) {
23970
23970
  try {
23971
23971
  return await this._useSession(async (result) => {
23972
- var _a26;
23972
+ var _a25;
23973
23973
  if (!currentSession) {
23974
23974
  const { data, error: error2 } = result;
23975
23975
  if (error2) {
23976
23976
  throw error2;
23977
23977
  }
23978
- currentSession = (_a26 = data.session) !== null && _a26 !== void 0 ? _a26 : void 0;
23978
+ currentSession = (_a25 = data.session) !== null && _a25 !== void 0 ? _a25 : void 0;
23979
23979
  }
23980
23980
  if (!(currentSession === null || currentSession === void 0 ? void 0 : currentSession.refresh_token)) {
23981
23981
  throw new AuthSessionMissingError();
@@ -24113,12 +24113,12 @@ var GoTrueClient = class _GoTrueClient {
24113
24113
  }
24114
24114
  async _signOut({ scope } = { scope: "global" }) {
24115
24115
  return await this._useSession(async (result) => {
24116
- var _a26;
24116
+ var _a25;
24117
24117
  const { data, error: sessionError } = result;
24118
24118
  if (sessionError && !isAuthSessionMissingError(sessionError)) {
24119
24119
  return this._returnResult({ error: sessionError });
24120
24120
  }
24121
- const accessToken = (_a26 = data.session) === null || _a26 === void 0 ? void 0 : _a26.access_token;
24121
+ const accessToken = (_a25 = data.session) === null || _a25 === void 0 ? void 0 : _a25.access_token;
24122
24122
  if (accessToken) {
24123
24123
  const { error } = await this.admin.signOut(accessToken, scope);
24124
24124
  if (error) {
@@ -24156,12 +24156,12 @@ var GoTrueClient = class _GoTrueClient {
24156
24156
  }
24157
24157
  async _emitInitialSession(id) {
24158
24158
  return await this._useSession(async (result) => {
24159
- var _a26, _b3;
24159
+ var _a25, _b3;
24160
24160
  try {
24161
24161
  const { data: { session }, error } = result;
24162
24162
  if (error)
24163
24163
  throw error;
24164
- await ((_a26 = this.stateChangeEmitters.get(id)) === null || _a26 === void 0 ? void 0 : _a26.callback("INITIAL_SESSION", session));
24164
+ await ((_a25 = this.stateChangeEmitters.get(id)) === null || _a25 === void 0 ? void 0 : _a25.callback("INITIAL_SESSION", session));
24165
24165
  this._debug("INITIAL_SESSION", "callback id", id, "session", session);
24166
24166
  } catch (err) {
24167
24167
  await ((_b3 = this.stateChangeEmitters.get(id)) === null || _b3 === void 0 ? void 0 : _b3.callback("INITIAL_SESSION", null));
@@ -24212,12 +24212,12 @@ var GoTrueClient = class _GoTrueClient {
24212
24212
  * Gets all the identities linked to a user.
24213
24213
  */
24214
24214
  async getUserIdentities() {
24215
- var _a26;
24215
+ var _a25;
24216
24216
  try {
24217
24217
  const { data, error } = await this.getUser();
24218
24218
  if (error)
24219
24219
  throw error;
24220
- return this._returnResult({ data: { identities: (_a26 = data.user.identities) !== null && _a26 !== void 0 ? _a26 : [] }, error: null });
24220
+ return this._returnResult({ data: { identities: (_a25 = data.user.identities) !== null && _a25 !== void 0 ? _a25 : [] }, error: null });
24221
24221
  } catch (error) {
24222
24222
  if (isAuthError(error)) {
24223
24223
  return this._returnResult({ data: null, error });
@@ -24232,15 +24232,15 @@ var GoTrueClient = class _GoTrueClient {
24232
24232
  return this.linkIdentityOAuth(credentials);
24233
24233
  }
24234
24234
  async linkIdentityOAuth(credentials) {
24235
- var _a26;
24235
+ var _a25;
24236
24236
  try {
24237
24237
  const { data, error } = await this._useSession(async (result) => {
24238
- var _a27, _b3, _c, _d, _e;
24238
+ var _a26, _b3, _c, _d, _e;
24239
24239
  const { data: data2, error: error2 } = result;
24240
24240
  if (error2)
24241
24241
  throw error2;
24242
24242
  const url = await this._getUrlForProvider(`${this.url}/user/identities/authorize`, credentials.provider, {
24243
- redirectTo: (_a27 = credentials.options) === null || _a27 === void 0 ? void 0 : _a27.redirectTo,
24243
+ redirectTo: (_a26 = credentials.options) === null || _a26 === void 0 ? void 0 : _a26.redirectTo,
24244
24244
  scopes: (_b3 = credentials.options) === null || _b3 === void 0 ? void 0 : _b3.scopes,
24245
24245
  queryParams: (_c = credentials.options) === null || _c === void 0 ? void 0 : _c.queryParams,
24246
24246
  skipBrowserRedirect: true
@@ -24252,7 +24252,7 @@ var GoTrueClient = class _GoTrueClient {
24252
24252
  });
24253
24253
  if (error)
24254
24254
  throw error;
24255
- if (isBrowser() && !((_a26 = credentials.options) === null || _a26 === void 0 ? void 0 : _a26.skipBrowserRedirect)) {
24255
+ if (isBrowser() && !((_a25 = credentials.options) === null || _a25 === void 0 ? void 0 : _a25.skipBrowserRedirect)) {
24256
24256
  window.location.assign(data === null || data === void 0 ? void 0 : data.url);
24257
24257
  }
24258
24258
  return this._returnResult({
@@ -24268,7 +24268,7 @@ var GoTrueClient = class _GoTrueClient {
24268
24268
  }
24269
24269
  async linkIdentityIdToken(credentials) {
24270
24270
  return await this._useSession(async (result) => {
24271
- var _a26;
24271
+ var _a25;
24272
24272
  try {
24273
24273
  const { error: sessionError, data: { session } } = result;
24274
24274
  if (sessionError)
@@ -24276,7 +24276,7 @@ var GoTrueClient = class _GoTrueClient {
24276
24276
  const { options, provider, token, access_token, nonce } = credentials;
24277
24277
  const res = await _request(this.fetch, "POST", `${this.url}/token?grant_type=id_token`, {
24278
24278
  headers: this.headers,
24279
- jwt: (_a26 = session === null || session === void 0 ? void 0 : session.access_token) !== null && _a26 !== void 0 ? _a26 : void 0,
24279
+ jwt: (_a25 = session === null || session === void 0 ? void 0 : session.access_token) !== null && _a25 !== void 0 ? _a25 : void 0,
24280
24280
  body: {
24281
24281
  provider,
24282
24282
  id_token: token,
@@ -24316,14 +24316,14 @@ var GoTrueClient = class _GoTrueClient {
24316
24316
  async unlinkIdentity(identity) {
24317
24317
  try {
24318
24318
  return await this._useSession(async (result) => {
24319
- var _a26, _b3;
24319
+ var _a25, _b3;
24320
24320
  const { data, error } = result;
24321
24321
  if (error) {
24322
24322
  throw error;
24323
24323
  }
24324
24324
  return await _request(this.fetch, "DELETE", `${this.url}/user/identities/${identity.identity_id}`, {
24325
24325
  headers: this.headers,
24326
- jwt: (_b3 = (_a26 = data.session) === null || _a26 === void 0 ? void 0 : _a26.access_token) !== null && _b3 !== void 0 ? _b3 : void 0
24326
+ jwt: (_b3 = (_a25 = data.session) === null || _a25 === void 0 ? void 0 : _a25.access_token) !== null && _b3 !== void 0 ? _b3 : void 0
24327
24327
  });
24328
24328
  });
24329
24329
  } catch (error) {
@@ -24388,7 +24388,7 @@ var GoTrueClient = class _GoTrueClient {
24388
24388
  * Note: this method is async to accommodate for AsyncStorage e.g. in React native.
24389
24389
  */
24390
24390
  async _recoverAndRefresh() {
24391
- var _a26, _b3;
24391
+ var _a25, _b3;
24392
24392
  const debugName = "#_recoverAndRefresh()";
24393
24393
  this._debug(debugName, "begin");
24394
24394
  try {
@@ -24399,7 +24399,7 @@ var GoTrueClient = class _GoTrueClient {
24399
24399
  maybeUser = { user: currentSession.user };
24400
24400
  await setItemAsync(this.userStorage, this.storageKey + "-user", maybeUser);
24401
24401
  }
24402
- currentSession.user = (_a26 = maybeUser === null || maybeUser === void 0 ? void 0 : maybeUser.user) !== null && _a26 !== void 0 ? _a26 : userNotAvailableProxy();
24402
+ currentSession.user = (_a25 = maybeUser === null || maybeUser === void 0 ? void 0 : maybeUser.user) !== null && _a25 !== void 0 ? _a25 : userNotAvailableProxy();
24403
24403
  } else if (currentSession && !currentSession.user) {
24404
24404
  if (!currentSession.user) {
24405
24405
  const separateUser = await getItemAsync(this.storage, this.storageKey + "-user");
@@ -24459,7 +24459,7 @@ var GoTrueClient = class _GoTrueClient {
24459
24459
  }
24460
24460
  }
24461
24461
  async _callRefreshToken(refreshToken) {
24462
- var _a26, _b3;
24462
+ var _a25, _b3;
24463
24463
  if (!refreshToken) {
24464
24464
  throw new AuthSessionMissingError();
24465
24465
  }
@@ -24487,7 +24487,7 @@ var GoTrueClient = class _GoTrueClient {
24487
24487
  if (!isAuthRetryableFetchError(error)) {
24488
24488
  await this._removeSession();
24489
24489
  }
24490
- (_a26 = this.refreshingDeferred) === null || _a26 === void 0 ? void 0 : _a26.resolve(result);
24490
+ (_a25 = this.refreshingDeferred) === null || _a25 === void 0 ? void 0 : _a25.resolve(result);
24491
24491
  return result;
24492
24492
  }
24493
24493
  (_b3 = this.refreshingDeferred) === null || _b3 === void 0 ? void 0 : _b3.reject(error);
@@ -24782,14 +24782,14 @@ var GoTrueClient = class _GoTrueClient {
24782
24782
  async _unenroll(params) {
24783
24783
  try {
24784
24784
  return await this._useSession(async (result) => {
24785
- var _a26;
24785
+ var _a25;
24786
24786
  const { data: sessionData, error: sessionError } = result;
24787
24787
  if (sessionError) {
24788
24788
  return this._returnResult({ data: null, error: sessionError });
24789
24789
  }
24790
24790
  return await _request(this.fetch, "DELETE", `${this.url}/factors/${params.factorId}`, {
24791
24791
  headers: this.headers,
24792
- jwt: (_a26 = sessionData === null || sessionData === void 0 ? void 0 : sessionData.session) === null || _a26 === void 0 ? void 0 : _a26.access_token
24792
+ jwt: (_a25 = sessionData === null || sessionData === void 0 ? void 0 : sessionData.session) === null || _a25 === void 0 ? void 0 : _a25.access_token
24793
24793
  });
24794
24794
  });
24795
24795
  } catch (error) {
@@ -24802,7 +24802,7 @@ var GoTrueClient = class _GoTrueClient {
24802
24802
  async _enroll(params) {
24803
24803
  try {
24804
24804
  return await this._useSession(async (result) => {
24805
- var _a26, _b3;
24805
+ var _a25, _b3;
24806
24806
  const { data: sessionData, error: sessionError } = result;
24807
24807
  if (sessionError) {
24808
24808
  return this._returnResult({ data: null, error: sessionError });
@@ -24811,7 +24811,7 @@ var GoTrueClient = class _GoTrueClient {
24811
24811
  const { data, error } = await _request(this.fetch, "POST", `${this.url}/factors`, {
24812
24812
  body,
24813
24813
  headers: this.headers,
24814
- jwt: (_a26 = sessionData === null || sessionData === void 0 ? void 0 : sessionData.session) === null || _a26 === void 0 ? void 0 : _a26.access_token
24814
+ jwt: (_a25 = sessionData === null || sessionData === void 0 ? void 0 : sessionData.session) === null || _a25 === void 0 ? void 0 : _a25.access_token
24815
24815
  });
24816
24816
  if (error) {
24817
24817
  return this._returnResult({ data: null, error });
@@ -24832,7 +24832,7 @@ var GoTrueClient = class _GoTrueClient {
24832
24832
  return this._acquireLock(this.lockAcquireTimeout, async () => {
24833
24833
  try {
24834
24834
  return await this._useSession(async (result) => {
24835
- var _a26;
24835
+ var _a25;
24836
24836
  const { data: sessionData, error: sessionError } = result;
24837
24837
  if (sessionError) {
24838
24838
  return this._returnResult({ data: null, error: sessionError });
@@ -24843,7 +24843,7 @@ var GoTrueClient = class _GoTrueClient {
24843
24843
  const { data, error } = await _request(this.fetch, "POST", `${this.url}/factors/${params.factorId}/verify`, {
24844
24844
  body,
24845
24845
  headers: this.headers,
24846
- jwt: (_a26 = sessionData === null || sessionData === void 0 ? void 0 : sessionData.session) === null || _a26 === void 0 ? void 0 : _a26.access_token
24846
+ jwt: (_a25 = sessionData === null || sessionData === void 0 ? void 0 : sessionData.session) === null || _a25 === void 0 ? void 0 : _a25.access_token
24847
24847
  });
24848
24848
  if (error) {
24849
24849
  return this._returnResult({ data: null, error });
@@ -24864,7 +24864,7 @@ var GoTrueClient = class _GoTrueClient {
24864
24864
  return this._acquireLock(this.lockAcquireTimeout, async () => {
24865
24865
  try {
24866
24866
  return await this._useSession(async (result) => {
24867
- var _a26;
24867
+ var _a25;
24868
24868
  const { data: sessionData, error: sessionError } = result;
24869
24869
  if (sessionError) {
24870
24870
  return this._returnResult({ data: null, error: sessionError });
@@ -24872,7 +24872,7 @@ var GoTrueClient = class _GoTrueClient {
24872
24872
  const response = await _request(this.fetch, "POST", `${this.url}/factors/${params.factorId}/challenge`, {
24873
24873
  body: params,
24874
24874
  headers: this.headers,
24875
- jwt: (_a26 = sessionData === null || sessionData === void 0 ? void 0 : sessionData.session) === null || _a26 === void 0 ? void 0 : _a26.access_token
24875
+ jwt: (_a25 = sessionData === null || sessionData === void 0 ? void 0 : sessionData.session) === null || _a25 === void 0 ? void 0 : _a25.access_token
24876
24876
  });
24877
24877
  if (response.error) {
24878
24878
  return response;
@@ -24922,7 +24922,7 @@ var GoTrueClient = class _GoTrueClient {
24922
24922
  * {@see GoTrueMFAApi#listFactors}
24923
24923
  */
24924
24924
  async _listFactors() {
24925
- var _a26;
24925
+ var _a25;
24926
24926
  const { data: { user }, error: userError } = await this.getUser();
24927
24927
  if (userError) {
24928
24928
  return { data: null, error: userError };
@@ -24933,7 +24933,7 @@ var GoTrueClient = class _GoTrueClient {
24933
24933
  totp: [],
24934
24934
  webauthn: []
24935
24935
  };
24936
- for (const factor of (_a26 = user === null || user === void 0 ? void 0 : user.factors) !== null && _a26 !== void 0 ? _a26 : []) {
24936
+ for (const factor of (_a25 = user === null || user === void 0 ? void 0 : user.factors) !== null && _a25 !== void 0 ? _a25 : []) {
24937
24937
  data.all.push(factor);
24938
24938
  if (factor.status === "verified") {
24939
24939
  ;
@@ -24949,7 +24949,7 @@ var GoTrueClient = class _GoTrueClient {
24949
24949
  * {@see GoTrueMFAApi#getAuthenticatorAssuranceLevel}
24950
24950
  */
24951
24951
  async _getAuthenticatorAssuranceLevel(jwt) {
24952
- var _a26, _b3, _c, _d;
24952
+ var _a25, _b3, _c, _d;
24953
24953
  if (jwt) {
24954
24954
  try {
24955
24955
  const { payload: payload2 } = decodeJWT(jwt);
@@ -24962,7 +24962,7 @@ var GoTrueClient = class _GoTrueClient {
24962
24962
  if (userError) {
24963
24963
  return this._returnResult({ data: null, error: userError });
24964
24964
  }
24965
- const verifiedFactors2 = (_b3 = (_a26 = user === null || user === void 0 ? void 0 : user.factors) === null || _a26 === void 0 ? void 0 : _a26.filter((factor) => factor.status === "verified")) !== null && _b3 !== void 0 ? _b3 : [];
24965
+ const verifiedFactors2 = (_b3 = (_a25 = user === null || user === void 0 ? void 0 : user.factors) === null || _a25 === void 0 ? void 0 : _a25.filter((factor) => factor.status === "verified")) !== null && _b3 !== void 0 ? _b3 : [];
24966
24966
  if (verifiedFactors2.length > 0) {
24967
24967
  nextLevel2 = "aal2";
24968
24968
  }
@@ -25599,10 +25599,10 @@ if (shouldShowDeprecationWarning()) console.warn("\u26A0\uFE0F Node.js 18 and b
25599
25599
  var cachedStargate = null;
25600
25600
  var cachedPublic = null;
25601
25601
  function getSupabase() {
25602
- var _a26;
25602
+ var _a25;
25603
25603
  if (cachedStargate) return cachedStargate;
25604
25604
  const url = getRuntimeEnv("VITE_SUPABASE_URL");
25605
- const anon = (_a26 = getRuntimeEnv("VITE_SUPABASE_ANON_KEY")) != null ? _a26 : getRuntimeEnv("VITE_SUPABASE_PUBLISHABLE_KEY");
25605
+ const anon = (_a25 = getRuntimeEnv("VITE_SUPABASE_ANON_KEY")) != null ? _a25 : getRuntimeEnv("VITE_SUPABASE_PUBLISHABLE_KEY");
25606
25606
  const schema = getRuntimeEnvOr("VITE_SUPABASE_SCHEMA", "public");
25607
25607
  if (!url || !anon) {
25608
25608
  return null;
@@ -25617,10 +25617,10 @@ function getSupabase() {
25617
25617
  return cachedStargate;
25618
25618
  }
25619
25619
  function getSupabasePublic() {
25620
- var _a26;
25620
+ var _a25;
25621
25621
  if (cachedPublic) return cachedPublic;
25622
25622
  const url = getRuntimeEnv("VITE_SUPABASE_URL");
25623
- const anon = (_a26 = getRuntimeEnv("VITE_SUPABASE_ANON_KEY")) != null ? _a26 : getRuntimeEnv("VITE_SUPABASE_PUBLISHABLE_KEY");
25623
+ const anon = (_a25 = getRuntimeEnv("VITE_SUPABASE_ANON_KEY")) != null ? _a25 : getRuntimeEnv("VITE_SUPABASE_PUBLISHABLE_KEY");
25624
25624
  if (!url || !anon) {
25625
25625
  return null;
25626
25626
  }
@@ -25836,13 +25836,13 @@ var toTimestampMs = (value) => {
25836
25836
  return Number.isNaN(parsed) ? void 0 : parsed;
25837
25837
  };
25838
25838
  var readStoredProfileAvatar = () => {
25839
- var _a26;
25839
+ var _a25;
25840
25840
  if (typeof window === "undefined") return void 0;
25841
25841
  const raw = localStorage.getItem(STORAGE_KEYS.profileAvatar) || sessionStorage.getItem(STORAGE_KEYS.profileAvatar);
25842
25842
  if (!raw) return void 0;
25843
25843
  try {
25844
25844
  const parsed = JSON.parse(raw);
25845
- return (_a26 = toNonEmptyString(parsed.avatarUrl)) != null ? _a26 : toNonEmptyString(parsed.avatarId);
25845
+ return (_a25 = toNonEmptyString(parsed.avatarUrl)) != null ? _a25 : toNonEmptyString(parsed.avatarId);
25846
25846
  } catch (e) {
25847
25847
  return toNonEmptyString(raw);
25848
25848
  }
@@ -25873,8 +25873,8 @@ var readPresenceRow = (payload) => {
25873
25873
  return null;
25874
25874
  };
25875
25875
  var isMissingColumnError = (error, column) => {
25876
- var _a26;
25877
- const message = ((_a26 = error == null ? void 0 : error.message) != null ? _a26 : "").toLowerCase();
25876
+ var _a25;
25877
+ const message = ((_a25 = error == null ? void 0 : error.message) != null ? _a25 : "").toLowerCase();
25878
25878
  const code = error == null ? void 0 : error.code;
25879
25879
  const token = column.trim().toLowerCase();
25880
25880
  if (!token) return false;
@@ -25896,8 +25896,8 @@ var readStoredPresence = () => {
25896
25896
  return isUserPresenceStatus(stored) ? stored : DEFAULT_PRESENCE_STATUS;
25897
25897
  };
25898
25898
  var readStoredPresenceSource = () => {
25899
- var _a26;
25900
- const stored = (_a26 = sessionStorage.getItem(STORAGE_KEYS.presenceSource)) != null ? _a26 : localStorage.getItem(LOCAL_STORAGE_KEYS.presenceSource);
25899
+ var _a25;
25900
+ const stored = (_a25 = sessionStorage.getItem(STORAGE_KEYS.presenceSource)) != null ? _a25 : localStorage.getItem(LOCAL_STORAGE_KEYS.presenceSource);
25901
25901
  if (isPresenceSource(stored)) return stored;
25902
25902
  return "auto";
25903
25903
  };
@@ -25944,9 +25944,9 @@ var readClaimValue = (claims, keys) => {
25944
25944
  return void 0;
25945
25945
  };
25946
25946
  var readClaimRole = (claims) => {
25947
- var _a26, _b3, _c;
25947
+ var _a25, _b3, _c;
25948
25948
  if (!claims) return void 0;
25949
- const roleClaim = (_c = (_b3 = (_a26 = claims.role) != null ? _a26 : claims.roles) != null ? _b3 : claims["https://cupcode.com/role"]) != null ? _c : claims["https://cupcode.com/roles"];
25949
+ const roleClaim = (_c = (_b3 = (_a25 = claims.role) != null ? _a25 : claims.roles) != null ? _b3 : claims["https://cupcode.com/role"]) != null ? _c : claims["https://cupcode.com/roles"];
25950
25950
  if (typeof roleClaim === "string") return toNonEmptyString(roleClaim);
25951
25951
  if (Array.isArray(roleClaim)) {
25952
25952
  return roleClaim.find((entry) => typeof entry === "string" && entry.trim() !== "");
@@ -25957,7 +25957,7 @@ var buildUserFromTokens = ({
25957
25957
  idToken,
25958
25958
  accessToken
25959
25959
  }) => {
25960
- var _a26;
25960
+ var _a25;
25961
25961
  const idClaims = decodeJwt(idToken != null ? idToken : void 0);
25962
25962
  const accessClaims = decodeJwt(accessToken != null ? accessToken : void 0);
25963
25963
  if (!idClaims && !accessClaims) return null;
@@ -25984,7 +25984,7 @@ var buildUserFromTokens = ({
25984
25984
  "id",
25985
25985
  "sub"
25986
25986
  ]);
25987
- const resolvedSub = (_a26 = readFromClaims(["sub"])) != null ? _a26 : resolvedId;
25987
+ const resolvedSub = (_a25 = readFromClaims(["sub"])) != null ? _a25 : resolvedId;
25988
25988
  const preferredUsername = readFromClaims([
25989
25989
  "preferred_username",
25990
25990
  "preferredUsername",
@@ -26063,11 +26063,11 @@ var AuthProvider = ({ children }) => {
26063
26063
  }
26064
26064
  }, []);
26065
26065
  const resolvePresenceUserId = useCallback12(async (targetUser) => {
26066
- var _a26, _b3, _c, _d;
26066
+ var _a25, _b3, _c, _d;
26067
26067
  const sub = toNonEmptyString(targetUser == null ? void 0 : targetUser.sub);
26068
26068
  const id = toNonEmptyString(targetUser == null ? void 0 : targetUser.id);
26069
26069
  const userId = toNonEmptyString(targetUser == null ? void 0 : targetUser.userId);
26070
- const email = (_a26 = toNonEmptyString(targetUser == null ? void 0 : targetUser.email)) == null ? void 0 : _a26.toLowerCase();
26070
+ const email = (_a25 = toNonEmptyString(targetUser == null ? void 0 : targetUser.email)) == null ? void 0 : _a25.toLowerCase();
26071
26071
  const identityKey = [sub != null ? sub : "", id != null ? id : "", userId != null ? userId : "", email != null ? email : ""].join("|");
26072
26072
  if (resolvedPresenceIdentityKeyRef.current === identityKey && resolvedPresenceUserIdRef.current) {
26073
26073
  return resolvedPresenceUserIdRef.current;
@@ -26102,9 +26102,9 @@ var AuthProvider = ({ children }) => {
26102
26102
  }, []);
26103
26103
  const syncPresenceFromRecord = useCallback12(
26104
26104
  (rawRow) => {
26105
- var _a26, _b3, _c;
26105
+ var _a25, _b3, _c;
26106
26106
  if (!rawRow) return;
26107
- const statusValue = toNonEmptyString((_a26 = rawRow[USER_PRESENCE_STATUS_COLUMN]) != null ? _a26 : rawRow.status);
26107
+ const statusValue = toNonEmptyString((_a25 = rawRow[USER_PRESENCE_STATUS_COLUMN]) != null ? _a25 : rawRow.status);
26108
26108
  if (!isUserPresenceStatus(statusValue)) return;
26109
26109
  const sourceValue = normalizePresenceSource((_b3 = rawRow[USER_PRESENCE_SOURCE_COLUMN]) != null ? _b3 : rawRow.status_source);
26110
26110
  const lastActiveTimestamp = toTimestampMs((_c = rawRow[USER_PRESENCE_LAST_ACTIVE_COLUMN]) != null ? _c : rawRow.last_active_at);
@@ -26180,8 +26180,8 @@ var AuthProvider = ({ children }) => {
26180
26180
  );
26181
26181
  const touchPresence = useCallback12(
26182
26182
  async (options) => {
26183
- var _a26;
26184
- const targetUser = (_a26 = options == null ? void 0 : options.targetUser) != null ? _a26 : user;
26183
+ var _a25;
26184
+ const targetUser = (_a25 = options == null ? void 0 : options.targetUser) != null ? _a25 : user;
26185
26185
  const userId = await resolvePresenceUserId(targetUser);
26186
26186
  if (!userId) return;
26187
26187
  const now = Date.now();
@@ -26306,7 +26306,7 @@ var AuthProvider = ({ children }) => {
26306
26306
  }, []);
26307
26307
  const startAuthorization = useCallback12(
26308
26308
  async (options) => {
26309
- var _a26, _b3;
26309
+ var _a25, _b3;
26310
26310
  const config = getAccountsConfig();
26311
26311
  const { authUrl } = await resolveOidcEndpoints(config);
26312
26312
  if (!authUrl) {
@@ -26316,7 +26316,7 @@ var AuthProvider = ({ children }) => {
26316
26316
  const challenge = await generateCodeChallenge(verifier);
26317
26317
  const state = generateState();
26318
26318
  const nonce = generateNonce();
26319
- const redirectTo = (_a26 = options == null ? void 0 : options.redirectTo) != null ? _a26 : window.location.pathname + window.location.search + window.location.hash;
26319
+ const redirectTo = (_a25 = options == null ? void 0 : options.redirectTo) != null ? _a25 : window.location.pathname + window.location.search + window.location.hash;
26320
26320
  const mode = (_b3 = options == null ? void 0 : options.mode) != null ? _b3 : "interactive";
26321
26321
  if (mode === "interactive") {
26322
26322
  clearLogoutIntent();
@@ -26351,14 +26351,14 @@ var AuthProvider = ({ children }) => {
26351
26351
  useEffect28(() => {
26352
26352
  let cancelled = false;
26353
26353
  const initializeAuth = async () => {
26354
- var _a26;
26354
+ var _a25;
26355
26355
  const stored = readStoredToken();
26356
26356
  const storedPresence = readStoredPresence();
26357
26357
  setPresenceStatusState(storedPresence);
26358
26358
  if (stored == null ? void 0 : stored.accessToken) {
26359
26359
  if (cancelled) return;
26360
26360
  const hydratedUser = buildUserFromTokens({
26361
- idToken: (_a26 = stored.idToken) != null ? _a26 : void 0,
26361
+ idToken: (_a25 = stored.idToken) != null ? _a25 : void 0,
26362
26362
  accessToken: stored.accessToken
26363
26363
  });
26364
26364
  setAccessToken(stored.accessToken);
@@ -26394,13 +26394,13 @@ var AuthProvider = ({ children }) => {
26394
26394
  };
26395
26395
  }, [attemptSilentLogin]);
26396
26396
  useEffect28(() => {
26397
- var _a26;
26397
+ var _a25;
26398
26398
  if (status !== "authenticated") return;
26399
26399
  if (user) return;
26400
26400
  const stored = readStoredToken();
26401
26401
  if (!(stored == null ? void 0 : stored.accessToken)) return;
26402
26402
  const hydratedUser = buildUserFromTokens({
26403
- idToken: (_a26 = stored.idToken) != null ? _a26 : void 0,
26403
+ idToken: (_a25 = stored.idToken) != null ? _a25 : void 0,
26404
26404
  accessToken: stored.accessToken
26405
26405
  });
26406
26406
  if (!hydratedUser) return;
@@ -26446,9 +26446,9 @@ var AuthProvider = ({ children }) => {
26446
26446
  table: USER_PRESENCE_TABLE
26447
26447
  },
26448
26448
  (payload) => {
26449
- var _a26, _b3;
26449
+ var _a25, _b3;
26450
26450
  const row = payload.new || payload.old;
26451
- const rowUserId = toNonEmptyString((_b3 = (_a26 = row == null ? void 0 : row[USER_PRESENCE_USER_ID_COLUMN]) != null ? _a26 : row == null ? void 0 : row.user_id) != null ? _b3 : row == null ? void 0 : row.id);
26451
+ const rowUserId = toNonEmptyString((_b3 = (_a25 = row == null ? void 0 : row[USER_PRESENCE_USER_ID_COLUMN]) != null ? _a25 : row == null ? void 0 : row.user_id) != null ? _b3 : row == null ? void 0 : row.id);
26452
26452
  if (!rowUserId || rowUserId !== currentUserId) return;
26453
26453
  if (payload.eventType === "DELETE") {
26454
26454
  storePresenceStatus("offline", "system");
@@ -26522,9 +26522,9 @@ var AuthProvider = ({ children }) => {
26522
26522
  });
26523
26523
  }, [startAuthorization]);
26524
26524
  const completeLogin = useCallback12(async () => {
26525
- var _a26;
26525
+ var _a25;
26526
26526
  const params = new URLSearchParams(window.location.search);
26527
- const redirectTo = (_a26 = sessionStorage.getItem(STORAGE_KEYS.redirect)) != null ? _a26 : "/";
26527
+ const redirectTo = (_a25 = sessionStorage.getItem(STORAGE_KEYS.redirect)) != null ? _a25 : "/";
26528
26528
  const authMode = sessionStorage.getItem(STORAGE_KEYS.authMode);
26529
26529
  const isSilentAuth = authMode === "silent";
26530
26530
  const error = params.get("error");
@@ -26596,10 +26596,10 @@ var AuthProvider = ({ children }) => {
26596
26596
  }
26597
26597
  }, [clearAuthFlowState]);
26598
26598
  const logout = useCallback12(async () => {
26599
- var _a26, _b3;
26599
+ var _a25, _b3;
26600
26600
  const config = getAccountsConfig();
26601
26601
  const { logoutUrl } = await resolveOidcEndpoints(config);
26602
- const idToken = (_a26 = sessionStorage.getItem(STORAGE_KEYS.idToken)) != null ? _a26 : void 0;
26602
+ const idToken = (_a25 = sessionStorage.getItem(STORAGE_KEYS.idToken)) != null ? _a25 : void 0;
26603
26603
  const refreshToken = (_b3 = sessionStorage.getItem(STORAGE_KEYS.refreshToken)) != null ? _b3 : void 0;
26604
26604
  const currentUser = user;
26605
26605
  await setPresenceNetworkStatus("offline", "system", currentUser);
@@ -26623,8 +26623,8 @@ var AuthProvider = ({ children }) => {
26623
26623
  return refreshInFlightRef.current;
26624
26624
  }
26625
26625
  const run = (async () => {
26626
- var _a26, _b3, _c;
26627
- const refreshToken = (_a26 = sessionStorage.getItem(STORAGE_KEYS.refreshToken)) == null ? void 0 : _a26.trim();
26626
+ var _a25, _b3, _c;
26627
+ const refreshToken = (_a25 = sessionStorage.getItem(STORAGE_KEYS.refreshToken)) == null ? void 0 : _a25.trim();
26628
26628
  if (!refreshToken) {
26629
26629
  throw new Error("Sess\xE3o expirada. Fa\xE7a login novamente.");
26630
26630
  }
@@ -26657,11 +26657,11 @@ var AuthProvider = ({ children }) => {
26657
26657
  }
26658
26658
  }, []);
26659
26659
  const getAccessToken = useCallback12(async () => {
26660
- var _a26;
26660
+ var _a25;
26661
26661
  const stored = readStoredToken();
26662
26662
  if (stored == null ? void 0 : stored.accessToken) return stored.accessToken;
26663
26663
  if (accessToken) return accessToken;
26664
- const hasRefreshToken = Boolean((_a26 = sessionStorage.getItem(STORAGE_KEYS.refreshToken)) == null ? void 0 : _a26.trim());
26664
+ const hasRefreshToken = Boolean((_a25 = sessionStorage.getItem(STORAGE_KEYS.refreshToken)) == null ? void 0 : _a25.trim());
26665
26665
  if (hasRefreshToken) {
26666
26666
  return refreshAccessToken();
26667
26667
  }
@@ -26701,65 +26701,6 @@ var useAuth = () => {
26701
26701
  }
26702
26702
  return ctx;
26703
26703
  };
26704
-
26705
- // src/lib/cupcodeRuntimeEnv.ts
26706
- var import_meta2 = {};
26707
- var TELESCUP_CDN_HOSTS2 = /* @__PURE__ */ new Set([
26708
- "cdn.telescup.com.br",
26709
- "telescup.cupcode.dev",
26710
- "cdn.cupcode.com.br"
26711
- ]);
26712
- var normalize = (value) => {
26713
- if (value === null || typeof value === "undefined") return void 0;
26714
- const normalized = String(value).trim();
26715
- return normalized.length > 0 ? normalized : void 0;
26716
- };
26717
- var isTelescupCdnUrl2 = (value) => {
26718
- if (!value) return false;
26719
- try {
26720
- return TELESCUP_CDN_HOSTS2.has(new URL(value).hostname);
26721
- } catch (e) {
26722
- return false;
26723
- }
26724
- };
26725
- var deriveAppsApiBaseUrl = () => {
26726
- const explicit = normalize(import_meta2.env.VITE_APPS_API_BASE_URL) || normalize(import_meta2.env.VITE_APPS_API_BASE);
26727
- if (explicit) return explicit.replace(/\/+$/, "");
26728
- return void 0;
26729
- };
26730
- var resolveTelescupFunctionsBase = (appsApiBaseUrl) => {
26731
- const explicit = normalize(import_meta2.env.VITE_TELESCUP_BASE_URL);
26732
- if (explicit && !isTelescupCdnUrl2(explicit)) {
26733
- return explicit.replace(/\/+$/, "");
26734
- }
26735
- if (appsApiBaseUrl) {
26736
- return `${appsApiBaseUrl}/api/telescup`;
26737
- }
26738
- return void 0;
26739
- };
26740
- var runtimeSupabaseUrl = normalize(import_meta2.env.VITE_SUPABASE_URL);
26741
- var runtimeSupabaseAnonKey = normalize(import_meta2.env.VITE_SUPABASE_ANON_KEY) || normalize(import_meta2.env.VITE_SUPABASE_PUBLISHABLE_KEY);
26742
- var runtimeSupabasePublishableKey = normalize(import_meta2.env.VITE_SUPABASE_PUBLISHABLE_KEY) || runtimeSupabaseAnonKey;
26743
- var runtimeAppsApiBaseUrl = deriveAppsApiBaseUrl();
26744
- var runtimeTelescupCdnBase = normalize(import_meta2.env.VITE_TELESCUP_CDN_BASE) || normalize(import_meta2.env.VITE_TELESCUP_API_BASE) || "https://cdn.telescup.com.br";
26745
- var runtimeTelescupFunctionsBase = resolveTelescupFunctionsBase(runtimeAppsApiBaseUrl);
26746
- var runtimeAccountsBaseUrl = normalize(import_meta2.env.VITE_ACCOUNTS_BASE_URL) || normalize(import_meta2.env.VITE_OIDC_ISSUER);
26747
- var cupcodeRuntimeEnv = {
26748
- VITE_SUPABASE_URL: runtimeSupabaseUrl,
26749
- VITE_SUPABASE_ANON_KEY: runtimeSupabaseAnonKey,
26750
- VITE_SUPABASE_PUBLISHABLE_KEY: runtimeSupabasePublishableKey,
26751
- VITE_APPS_API_BASE_URL: runtimeAppsApiBaseUrl,
26752
- VITE_APPS_API_BASE: runtimeAppsApiBaseUrl,
26753
- VITE_TELESCUP_BASE_URL: runtimeTelescupFunctionsBase,
26754
- VITE_TELESCUP_API_BASE: runtimeTelescupCdnBase,
26755
- VITE_ACCOUNTS_BASE_URL: runtimeAccountsBaseUrl
26756
- };
26757
- var globalWithCupcodeEnv = globalThis;
26758
- var _a25;
26759
- globalWithCupcodeEnv.__CUPCODE_ENV__ = {
26760
- ...(_a25 = globalWithCupcodeEnv.__CUPCODE_ENV__) != null ? _a25 : {},
26761
- ...cupcodeRuntimeEnv
26762
- };
26763
26704
  export {
26764
26705
  Accordion,
26765
26706
  AccordionContent2 as AccordionContent,
@@ -27125,7 +27066,6 @@ export {
27125
27066
  cn,
27126
27067
  completeTelescupOidcCallback,
27127
27068
  createTelescupClient,
27128
- cupcodeRuntimeEnv,
27129
27069
  decodeJwt,
27130
27070
  defaultSidebarGroups,
27131
27071
  ensureTelescupOidcToken,