@cupcodev/ui 2.1.0 → 3.0.2

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
@@ -2593,8 +2593,8 @@ ModalDescription.displayName = DialogPrimitive.Description.displayName;
2593
2593
 
2594
2594
  // src/components/cupcode/NavbarCupcode.tsx
2595
2595
  import * as React9 from "react";
2596
- import { Menu } from "lucide-react";
2597
- import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
2596
+ import { Menu, X as X3 } from "lucide-react";
2597
+ import { Fragment as Fragment2, jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
2598
2598
  var NavbarCupcode = ({
2599
2599
  logo,
2600
2600
  items,
@@ -2603,14 +2603,15 @@ var NavbarCupcode = ({
2603
2603
  }) => {
2604
2604
  const [isOpen, setIsOpen] = React9.useState(false);
2605
2605
  const navRef = React9.useRef(null);
2606
+ const mobileDrawerRef = React9.useRef(null);
2606
2607
  const mobileMenuId = React9.useId();
2607
2608
  React9.useEffect(() => {
2608
2609
  if (!isOpen) return;
2609
2610
  const handlePointerDown = (event) => {
2610
- var _a78;
2611
+ var _a78, _b7;
2611
2612
  const target = event.target;
2612
2613
  if (!(target instanceof Node)) return;
2613
- if (!((_a78 = navRef.current) == null ? void 0 : _a78.contains(target))) {
2614
+ if (!((_a78 = navRef.current) == null ? void 0 : _a78.contains(target)) && !((_b7 = mobileDrawerRef.current) == null ? void 0 : _b7.contains(target))) {
2614
2615
  setIsOpen(false);
2615
2616
  }
2616
2617
  };
@@ -2646,34 +2647,50 @@ var NavbarCupcode = ({
2646
2647
  window.removeEventListener("resize", handleResize);
2647
2648
  };
2648
2649
  }, []);
2649
- return /* @__PURE__ */ jsx21(
2650
- "nav",
2651
- {
2652
- ref: navRef,
2653
- className: cn(
2654
- "fixed left-2 right-2 top-[max(env(safe-area-inset-top),0.75rem)] z-[200] overflow-hidden rounded-2xl",
2655
- "glass border-border/70 shadow-[var(--elevation-3)] md:left-4 md:right-4",
2656
- className
2657
- ),
2658
- children: /* @__PURE__ */ jsxs17("div", { className: "cc-container", children: [
2659
- /* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between h-16", children: [
2660
- /* @__PURE__ */ jsx21("div", { className: "flex-shrink-0", children: logo }),
2661
- /* @__PURE__ */ jsx21("div", { className: "hidden md:flex items-center space-x-8", children: items.map((item, index) => {
2662
- const key = `${item.label}-${index}`;
2663
- const isActive = item.isActive;
2664
- const baseClasses = cn(
2665
- "flex items-center gap-2 text-sm font-semibold text-foreground",
2666
- "hover:text-primary transition-colors duration-200",
2667
- "relative after:absolute after:bottom-0 after:left-0 after:h-0.5 after:w-0",
2668
- "after:bg-primary after:transition-all after:duration-300",
2669
- "hover:after:w-full",
2670
- isActive && "text-primary after:w-full"
2671
- );
2672
- const handleClick = (event) => {
2673
- var _a78;
2674
- (_a78 = item.onClick) == null ? void 0 : _a78.call(item, event);
2675
- };
2676
- if (item.href.startsWith("#")) {
2650
+ return /* @__PURE__ */ jsxs17(Fragment2, { children: [
2651
+ /* @__PURE__ */ jsx21(
2652
+ "nav",
2653
+ {
2654
+ ref: navRef,
2655
+ className: cn(
2656
+ "fixed left-2 right-2 top-[max(env(safe-area-inset-top),0.75rem)] z-[200] overflow-hidden rounded-2xl",
2657
+ "glass border-border/70 shadow-[var(--elevation-3)] md:left-4 md:right-4",
2658
+ className
2659
+ ),
2660
+ children: /* @__PURE__ */ jsxs17("div", { className: "cc-container", children: [
2661
+ /* @__PURE__ */ jsxs17("div", { className: "hidden h-16 items-center justify-between md:flex", children: [
2662
+ /* @__PURE__ */ jsx21("div", { className: "flex-shrink-0", children: logo }),
2663
+ /* @__PURE__ */ jsx21("div", { className: "flex items-center space-x-8", children: items.map((item, index) => {
2664
+ const key = `${item.label}-${index}`;
2665
+ const isActive = item.isActive;
2666
+ const baseClasses = cn(
2667
+ "flex items-center gap-2 text-sm font-semibold text-foreground",
2668
+ "hover:text-primary transition-colors duration-200",
2669
+ "relative after:absolute after:bottom-0 after:left-0 after:h-0.5 after:w-0",
2670
+ "after:bg-primary after:transition-all after:duration-300",
2671
+ "hover:after:w-full",
2672
+ isActive && "text-primary after:w-full"
2673
+ );
2674
+ const handleClick = (event) => {
2675
+ var _a78;
2676
+ (_a78 = item.onClick) == null ? void 0 : _a78.call(item, event);
2677
+ };
2678
+ if (item.href.startsWith("#")) {
2679
+ return /* @__PURE__ */ jsxs17(
2680
+ "a",
2681
+ {
2682
+ href: item.href,
2683
+ className: baseClasses,
2684
+ onClick: handleClick,
2685
+ "aria-current": isActive ? "page" : void 0,
2686
+ children: [
2687
+ item.icon && /* @__PURE__ */ jsx21("span", { children: item.icon }),
2688
+ item.label
2689
+ ]
2690
+ },
2691
+ key
2692
+ );
2693
+ }
2677
2694
  return /* @__PURE__ */ jsxs17(
2678
2695
  "a",
2679
2696
  {
@@ -2688,73 +2705,92 @@ var NavbarCupcode = ({
2688
2705
  },
2689
2706
  key
2690
2707
  );
2691
- }
2692
- return /* @__PURE__ */ jsxs17(
2693
- "a",
2708
+ }) }),
2709
+ actions && /* @__PURE__ */ jsx21("div", { className: "flex", children: actions })
2710
+ ] }),
2711
+ /* @__PURE__ */ jsxs17("div", { className: "relative flex h-16 items-center md:hidden", children: [
2712
+ /* @__PURE__ */ jsx21(
2713
+ "button",
2694
2714
  {
2695
- href: item.href,
2696
- className: baseClasses,
2697
- onClick: handleClick,
2698
- "aria-current": isActive ? "page" : void 0,
2699
- children: [
2700
- item.icon && /* @__PURE__ */ jsx21("span", { children: item.icon }),
2701
- item.label
2702
- ]
2703
- },
2704
- key
2705
- );
2706
- }) }),
2707
- actions && /* @__PURE__ */ jsx21("div", { className: "hidden md:flex", children: actions }),
2708
- /* @__PURE__ */ jsx21(
2709
- "button",
2710
- {
2711
- type: "button",
2712
- onClick: () => setIsOpen(!isOpen),
2713
- "aria-controls": mobileMenuId,
2714
- "aria-expanded": isOpen,
2715
- "aria-label": isOpen ? "Fechar menu de navega\xE7\xE3o" : "Abrir menu de navega\xE7\xE3o",
2716
- className: "md:hidden inline-flex h-10 w-10 items-center justify-center rounded-lg transition-colors hover:bg-primary/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
2717
- children: /* @__PURE__ */ jsx21(Menu, { className: cn("h-6 w-6 text-foreground", isOpen && "text-primary") })
2718
- }
2719
- )
2720
- ] }),
2721
- isOpen && /* @__PURE__ */ jsxs17(
2722
- "div",
2723
- {
2724
- id: mobileMenuId,
2725
- className: "md:hidden max-h-[calc(100dvh-5rem)] space-y-3 overflow-y-auto border-t border-border/60 py-4 animate-slide-up",
2726
- children: [
2727
- items.map((item, index) => {
2728
- const key = `${item.label}-${index}`;
2729
- const isActive = item.isActive;
2730
- const classes = cn(
2731
- "flex min-h-11 items-center gap-2 rounded-lg px-4 py-2.5 text-sm font-semibold text-foreground transition-colors hover:bg-primary/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
2732
- isActive && "text-primary"
2733
- );
2734
- const handleClick = (event) => {
2735
- var _a78;
2736
- (_a78 = item.onClick) == null ? void 0 : _a78.call(item, event);
2737
- setIsOpen(false);
2738
- };
2739
- if (item.href.startsWith("#")) {
2740
- return /* @__PURE__ */ jsxs17("a", { href: item.href, className: classes, onClick: handleClick, children: [
2741
- item.icon && /* @__PURE__ */ jsx21("span", { children: item.icon }),
2742
- item.label
2743
- ] }, key);
2715
+ type: "button",
2716
+ onClick: () => setIsOpen(!isOpen),
2717
+ "aria-controls": mobileMenuId,
2718
+ "aria-expanded": isOpen,
2719
+ "aria-label": isOpen ? "Fechar menu de navega\xE7\xE3o" : "Abrir menu de navega\xE7\xE3o",
2720
+ className: "z-10 inline-flex h-10 w-10 items-center justify-center rounded-lg transition-colors hover:bg-primary/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
2721
+ children: /* @__PURE__ */ jsx21(Menu, { className: cn("h-6 w-6 text-foreground", isOpen && "text-primary") })
2722
+ }
2723
+ ),
2724
+ /* @__PURE__ */ jsx21("div", { className: "pointer-events-none absolute left-1/2 top-1/2 z-0 w-[min(62vw,18rem)] -translate-x-1/2 -translate-y-1/2 overflow-hidden", children: /* @__PURE__ */ jsx21("div", { className: "flex items-center justify-center", children: logo }) }),
2725
+ /* @__PURE__ */ jsx21("div", { className: "z-10 ml-auto flex items-center", children: actions != null ? actions : /* @__PURE__ */ jsx21("span", { className: "inline-flex h-10 w-10", "aria-hidden": "true" }) })
2726
+ ] })
2727
+ ] })
2728
+ }
2729
+ ),
2730
+ isOpen && /* @__PURE__ */ jsxs17("div", { className: "fixed inset-0 z-[240] md:hidden", children: [
2731
+ /* @__PURE__ */ jsx21(
2732
+ "button",
2733
+ {
2734
+ type: "button",
2735
+ onClick: () => setIsOpen(false),
2736
+ className: "absolute inset-0 bg-black/45 backdrop-blur-[1.5px]",
2737
+ "aria-label": "Fechar menu de navega\xE7\xE3o"
2738
+ }
2739
+ ),
2740
+ /* @__PURE__ */ jsxs17(
2741
+ "div",
2742
+ {
2743
+ id: mobileMenuId,
2744
+ ref: mobileDrawerRef,
2745
+ className: cn(
2746
+ "glass-strong absolute inset-y-0 left-0 z-10 w-[min(84vw,22rem)] border-r border-border/70 px-3 pb-[max(env(safe-area-inset-bottom),0.75rem)] pt-[max(env(safe-area-inset-top),0.9rem)] text-foreground shadow-[var(--elevation-5)]",
2747
+ "data-[state=open]:animate-in data-[state=open]:slide-in-from-left data-[state=open]:duration-300"
2748
+ ),
2749
+ "data-state": "open",
2750
+ children: [
2751
+ /* @__PURE__ */ jsxs17("div", { className: "mb-4 flex items-center justify-between border-b border-border/60 pb-3", children: [
2752
+ /* @__PURE__ */ jsx21("span", { className: "text-sm font-semibold text-foreground/80", children: "Menu" }),
2753
+ /* @__PURE__ */ jsx21(
2754
+ "button",
2755
+ {
2756
+ type: "button",
2757
+ onClick: () => setIsOpen(false),
2758
+ className: "inline-flex h-9 w-9 items-center justify-center rounded-full border border-border/70 bg-background/50 text-foreground transition-colors hover:bg-muted/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
2759
+ "aria-label": "Fechar menu de navega\xE7\xE3o",
2760
+ children: /* @__PURE__ */ jsx21(X3, { className: "h-4 w-4" })
2744
2761
  }
2762
+ )
2763
+ ] }),
2764
+ /* @__PURE__ */ jsx21("div", { className: "cc-scrollbar cc-scrollbar-purple max-h-[calc(100dvh-9rem)] space-y-2 overflow-y-auto pr-1", children: items.map((item, index) => {
2765
+ const key = `${item.label}-${index}`;
2766
+ const isActive = item.isActive;
2767
+ const classes = cn(
2768
+ "flex min-h-11 items-center gap-2 rounded-lg px-4 py-2.5 text-sm font-semibold text-foreground transition-colors hover:bg-primary/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
2769
+ isActive && "text-primary"
2770
+ );
2771
+ const handleClick = (event) => {
2772
+ var _a78;
2773
+ (_a78 = item.onClick) == null ? void 0 : _a78.call(item, event);
2774
+ setIsOpen(false);
2775
+ };
2776
+ if (item.href.startsWith("#")) {
2745
2777
  return /* @__PURE__ */ jsxs17("a", { href: item.href, className: classes, onClick: handleClick, children: [
2746
2778
  item.icon && /* @__PURE__ */ jsx21("span", { children: item.icon }),
2747
2779
  item.label
2748
2780
  ] }, key);
2749
- }),
2750
- actions && /* @__PURE__ */ jsx21("div", { className: "px-4 pb-[max(env(safe-area-inset-bottom),0.5rem)] pt-2", children: actions })
2751
- ]
2752
- }
2753
- )
2754
- ] })
2755
- }
2756
- );
2781
+ }
2782
+ return /* @__PURE__ */ jsxs17("a", { href: item.href, className: classes, onClick: handleClick, children: [
2783
+ item.icon && /* @__PURE__ */ jsx21("span", { children: item.icon }),
2784
+ item.label
2785
+ ] }, key);
2786
+ }) })
2787
+ ]
2788
+ }
2789
+ )
2790
+ ] })
2791
+ ] });
2757
2792
  };
2793
+ var NavbarCupcode_default = NavbarCupcode;
2758
2794
 
2759
2795
  // src/components/cupcode/MainNavbar.tsx
2760
2796
  import { useCallback as useCallback6, useEffect as useEffect16, useMemo as useMemo9, useRef as useRef12, useState as useState13 } from "react";
@@ -2845,7 +2881,7 @@ import {
2845
2881
  UserRound,
2846
2882
  UsersRound,
2847
2883
  Volume2,
2848
- X as X4
2884
+ X as X5
2849
2885
  } from "lucide-react";
2850
2886
  import {
2851
2887
  useCallback as useCallback5,
@@ -3192,7 +3228,7 @@ AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
3192
3228
  // src/components/ui/dialog.tsx
3193
3229
  import * as React15 from "react";
3194
3230
  import * as DialogPrimitive2 from "@radix-ui/react-dialog";
3195
- import { X as X3 } from "lucide-react";
3231
+ import { X as X4 } from "lucide-react";
3196
3232
  import { jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
3197
3233
  var Dialog = DialogPrimitive2.Root;
3198
3234
  var DialogTrigger = DialogPrimitive2.Trigger;
@@ -3224,7 +3260,7 @@ var DialogContent = React15.forwardRef(({ className, children, ...props }, ref)
3224
3260
  children: [
3225
3261
  children,
3226
3262
  /* @__PURE__ */ jsxs21(DialogPrimitive2.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-accent data-[state=open]:text-muted-foreground hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none", children: [
3227
- /* @__PURE__ */ jsx28(X3, { className: "h-4 w-4" }),
3263
+ /* @__PURE__ */ jsx28(X4, { className: "h-4 w-4" }),
3228
3264
  /* @__PURE__ */ jsx28("span", { className: "sr-only", children: "Close" })
3229
3265
  ] })
3230
3266
  ]
@@ -5978,7 +6014,7 @@ var Textarea = React25.forwardRef(({ className, ...props }, ref) => {
5978
6014
  Textarea.displayName = "Textarea";
5979
6015
 
5980
6016
  // src/components/cupcode/TelescupUpload.tsx
5981
- import { Fragment as Fragment2, jsx as jsx41, jsxs as jsxs26 } from "react/jsx-runtime";
6017
+ import { Fragment as Fragment3, jsx as jsx41, jsxs as jsxs26 } from "react/jsx-runtime";
5982
6018
  var DEFAULT_LABELS = {
5983
6019
  title: "Biblioteca Telescup",
5984
6020
  tabs: {
@@ -6286,7 +6322,7 @@ var TelescupMetaEditor = ({
6286
6322
  ] }),
6287
6323
  /* @__PURE__ */ jsxs26("div", { className: "flex flex-wrap gap-2", children: [
6288
6324
  /* @__PURE__ */ jsx41(Button, { variant: "secondary", onClick: handleSave, disabled: saving, children: labels.meta.save }),
6289
- enableAI ? /* @__PURE__ */ jsxs26(Fragment2, { children: [
6325
+ enableAI ? /* @__PURE__ */ jsxs26(Fragment3, { children: [
6290
6326
  /* @__PURE__ */ jsx41(Button, { variant: "outline", onClick: handleGenerateAlt, disabled: aiLoading, children: labels.meta.generateAlt }),
6291
6327
  /* @__PURE__ */ jsx41(Button, { variant: "outline", onClick: handleTranslate, disabled: aiLoading, children: labels.meta.translate })
6292
6328
  ] }) : null
@@ -6514,7 +6550,7 @@ var TelescupUpload = ({
6514
6550
  )
6515
6551
  ] });
6516
6552
  if (!isControlled && renderTrigger) {
6517
- return /* @__PURE__ */ jsxs26(Fragment2, { children: [
6553
+ return /* @__PURE__ */ jsxs26(Fragment3, { children: [
6518
6554
  renderTrigger({ open: () => setInternalOpen(true) }),
6519
6555
  mode === "drawer" ? /* @__PURE__ */ jsx41(Drawer, { open: isOpen, onOpenChange: (next) => !next ? handleClose() : setInternalOpen(next), children: /* @__PURE__ */ jsx41(DrawerContent, { className: "h-[90vh] p-6", children: content }) }) : /* @__PURE__ */ jsx41(Dialog, { open: isOpen, onOpenChange: (next) => !next ? handleClose() : setInternalOpen(next), children: /* @__PURE__ */ jsxs26(DialogContent, { className: "max-w-5xl z-[4600]", children: [
6520
6556
  /* @__PURE__ */ jsx41(DialogTitle, { className: "sr-only", children: labels.title }),
@@ -6524,7 +6560,7 @@ var TelescupUpload = ({
6524
6560
  ] });
6525
6561
  }
6526
6562
  if (!isControlled && !renderTrigger) {
6527
- return /* @__PURE__ */ jsxs26(Fragment2, { children: [
6563
+ return /* @__PURE__ */ jsxs26(Fragment3, { children: [
6528
6564
  /* @__PURE__ */ jsx41(Button, { onClick: () => setInternalOpen(true), children: labels.actions.select }),
6529
6565
  mode === "drawer" ? /* @__PURE__ */ jsx41(Drawer, { open: isOpen, onOpenChange: (next) => !next ? handleClose() : setInternalOpen(next), children: /* @__PURE__ */ jsx41(DrawerContent, { className: "h-[90vh] p-6", children: content }) }) : /* @__PURE__ */ jsx41(Dialog, { open: isOpen, onOpenChange: (next) => !next ? handleClose() : setInternalOpen(next), children: /* @__PURE__ */ jsxs26(DialogContent, { className: "max-w-5xl z-[4600]", children: [
6530
6566
  /* @__PURE__ */ jsx41(DialogTitle, { className: "sr-only", children: labels.title }),
@@ -6541,7 +6577,7 @@ var TelescupUpload = ({
6541
6577
  };
6542
6578
 
6543
6579
  // src/components/cupcode/UserMenuCupcode.tsx
6544
- import { Fragment as Fragment3, jsx as jsx42, jsxs as jsxs27 } from "react/jsx-runtime";
6580
+ import { Fragment as Fragment4, jsx as jsx42, jsxs as jsxs27 } from "react/jsx-runtime";
6545
6581
  var PRESENCE_META = {
6546
6582
  online: { label: "On-line", group: "online", kind: "dot", dotClass: "bg-success" },
6547
6583
  away: { label: "Ausente", group: "away", kind: "crescent" },
@@ -8870,7 +8906,7 @@ var UserMenuCupcode = ({
8870
8906
  !hasTelescupAvatarSupport ? /* @__PURE__ */ jsx42("p", { className: "text-center text-xs text-muted-foreground", children: "Telescup indispon\xEDvel neste ambiente." }) : null
8871
8907
  ] }),
8872
8908
  /* @__PURE__ */ jsxs27(DialogPrimitive3.Close, { className: "absolute right-3 top-3 inline-flex h-8 w-8 items-center justify-center rounded-full border border-border/70 bg-background/70 text-muted-foreground transition-all hover:bg-background hover:text-foreground", children: [
8873
- /* @__PURE__ */ jsx42(X4, { className: "h-4 w-4" }),
8909
+ /* @__PURE__ */ jsx42(X5, { className: "h-4 w-4" }),
8874
8910
  /* @__PURE__ */ jsx42("span", { className: "sr-only", children: "Fechar" })
8875
8911
  ] })
8876
8912
  ] })
@@ -9085,7 +9121,7 @@ var UserMenuCupcode = ({
9085
9121
  onClick: () => setIsNotificationsPreferencesBackVisible(false),
9086
9122
  className: "inline-flex h-7 items-center gap-1 rounded-md border border-border/70 px-2 text-xs font-semibold text-foreground transition-all hover:bg-muted/45",
9087
9123
  children: [
9088
- /* @__PURE__ */ jsx42(X4, { className: "h-3 w-3" }),
9124
+ /* @__PURE__ */ jsx42(X5, { className: "h-3 w-3" }),
9089
9125
  "Voltar"
9090
9126
  ]
9091
9127
  }
@@ -9373,7 +9409,7 @@ var UserMenuCupcode = ({
9373
9409
  "mt-0.5 truncate text-[10px]",
9374
9410
  hasUnread ? "text-red-600 dark:text-red-300" : "text-muted-foreground"
9375
9411
  ),
9376
- children: chatSettings.showMessagePreview ? /* @__PURE__ */ jsxs27(Fragment3, { children: [
9412
+ children: chatSettings.showMessagePreview ? /* @__PURE__ */ jsxs27(Fragment4, { children: [
9377
9413
  lastMessage.sender === "me" ? "Voc\xEA: " : "",
9378
9414
  summarizeChatText(lastMessage.text, 44)
9379
9415
  ] }) : "Nova mensagem"
@@ -9438,7 +9474,7 @@ var UserMenuCupcode = ({
9438
9474
  },
9439
9475
  children: [
9440
9476
  chatError ? /* @__PURE__ */ jsx42("p", { className: "mx-2.5 mt-2 rounded-lg border border-destructive/40 bg-destructive/10 px-2 py-1.5 text-[11px] text-destructive", children: chatError }) : null,
9441
- activeChatUser ? /* @__PURE__ */ jsxs27(Fragment3, { children: [
9477
+ activeChatUser ? /* @__PURE__ */ jsxs27(Fragment4, { children: [
9442
9478
  /* @__PURE__ */ jsx42("header", { className: "border-b border-border/70 bg-background/35 px-3 py-2.5", children: /* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between gap-2", children: [
9443
9479
  /* @__PURE__ */ jsxs27(
9444
9480
  "button",
@@ -9497,7 +9533,7 @@ var UserMenuCupcode = ({
9497
9533
  }
9498
9534
  ) }),
9499
9535
  /* @__PURE__ */ jsxs27(DropdownMenuContent, { align: "end", className: "z-[1700] w-52", children: [
9500
- !activeChatUser.isGroup ? /* @__PURE__ */ jsxs27(Fragment3, { children: [
9536
+ !activeChatUser.isGroup ? /* @__PURE__ */ jsxs27(Fragment4, { children: [
9501
9537
  /* @__PURE__ */ jsxs27(DropdownMenuItem, { onSelect: openActiveChatUserProfile, className: "text-xs", children: [
9502
9538
  /* @__PURE__ */ jsx42(UserRound, { className: "mr-2 h-3.5 w-3.5" }),
9503
9539
  "Ver perfil"
@@ -9775,7 +9811,7 @@ var UserMenuCupcode = ({
9775
9811
  onClick: () => setReplyToMessageId(null),
9776
9812
  className: "inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-md border border-transparent text-muted-foreground transition-all hover:border-border/70 hover:bg-background/45 hover:text-foreground",
9777
9813
  "aria-label": "Cancelar resposta",
9778
- children: /* @__PURE__ */ jsx42(X4, { className: "h-3 w-3" })
9814
+ children: /* @__PURE__ */ jsx42(X5, { className: "h-3 w-3" })
9779
9815
  }
9780
9816
  )
9781
9817
  ] }) : null,
@@ -10589,42 +10625,44 @@ var UserMenuCupcode = ({
10589
10625
  /* @__PURE__ */ jsxs27(DialogPrimitive3.Content, { className: "glass-strong fixed inset-y-0 right-0 z-[700] w-full max-w-[27rem] overflow-hidden border-l border-border/70 text-foreground shadow-[var(--elevation-5)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right data-[state=closed]:duration-300 data-[state=open]:duration-500", children: [
10590
10626
  /* @__PURE__ */ jsx42(DialogPrimitive3.Title, { className: "sr-only", children: "Menu do usu\xE1rio" }),
10591
10627
  /* @__PURE__ */ jsx42(DialogPrimitive3.Description, { className: "sr-only", children: "Painel lateral com perfil, notifica\xE7\xF5es, chat e configura\xE7\xF5es." }),
10592
- /* @__PURE__ */ jsxs27(DialogPrimitive3.Close, { className: "absolute right-3 top-3 z-10 flex h-10 w-10 items-center justify-center rounded-full border border-border/70 bg-background/40 text-foreground transition-all hover:bg-muted/60 sm:-right-[58px]", children: [
10593
- /* @__PURE__ */ jsx42(X4, { className: "h-5 w-5" }),
10594
- /* @__PURE__ */ jsx42("span", { className: "sr-only", children: "Fechar menu" })
10595
- ] }),
10596
10628
  /* @__PURE__ */ jsxs27("div", { className: "relative flex h-full flex-col p-3 sm:p-4", children: [
10597
- /* @__PURE__ */ jsx42("div", { className: "glass-subtle rounded-[1.3rem] p-1", children: /* @__PURE__ */ jsx42("div", { className: "grid grid-cols-5 gap-1", children: TAB_ITEMS.map((tab) => {
10598
- const Icon3 = tab.icon;
10599
- const isCurrent = tab.id === activeTab;
10600
- const isChatTab = tab.id === "chat";
10601
- const isNotificationsTab = tab.id === "notifications";
10602
- const hasChatUnread = isChatTab && visibleChatUnreadCount > 0;
10603
- const hasNotificationUnread = isNotificationsTab && !isBadgeSuppressedByFocus && unreadGeneralNotificationsCount > 0;
10604
- return /* @__PURE__ */ jsx42(
10605
- "button",
10606
- {
10607
- type: "button",
10608
- onClick: () => {
10609
- setIsLogoutConfirmOpen(false);
10610
- setActiveTab(tab.id);
10629
+ /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-2", children: [
10630
+ /* @__PURE__ */ jsxs27(DialogPrimitive3.Close, { className: "inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-full border border-border/70 bg-background/75 text-primary transition-all hover:bg-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40", children: [
10631
+ /* @__PURE__ */ jsx42(X5, { className: "h-5 w-5" }),
10632
+ /* @__PURE__ */ jsx42("span", { className: "sr-only", children: "Fechar menu" })
10633
+ ] }),
10634
+ /* @__PURE__ */ jsx42("div", { className: "glass-subtle flex-1 rounded-[1.3rem] p-1", children: /* @__PURE__ */ jsx42("div", { className: "grid grid-cols-5 gap-1", children: TAB_ITEMS.map((tab) => {
10635
+ const Icon3 = tab.icon;
10636
+ const isCurrent = tab.id === activeTab;
10637
+ const isChatTab = tab.id === "chat";
10638
+ const isNotificationsTab = tab.id === "notifications";
10639
+ const hasChatUnread = isChatTab && visibleChatUnreadCount > 0;
10640
+ const hasNotificationUnread = isNotificationsTab && !isBadgeSuppressedByFocus && unreadGeneralNotificationsCount > 0;
10641
+ return /* @__PURE__ */ jsx42(
10642
+ "button",
10643
+ {
10644
+ type: "button",
10645
+ onClick: () => {
10646
+ setIsLogoutConfirmOpen(false);
10647
+ setActiveTab(tab.id);
10648
+ },
10649
+ title: tab.label,
10650
+ className: cn(
10651
+ "flex h-9 w-full items-center justify-center rounded-xl transition-all",
10652
+ isCurrent ? "bg-background text-foreground shadow-[var(--elevation-2)]" : "text-muted-foreground hover:bg-muted/50 hover:text-foreground"
10653
+ ),
10654
+ "aria-current": isCurrent ? "page" : void 0,
10655
+ "aria-label": tab.label,
10656
+ children: /* @__PURE__ */ jsxs27("span", { className: "relative inline-flex", children: [
10657
+ /* @__PURE__ */ jsx42(Icon3, { className: "h-4 w-4" }),
10658
+ hasNotificationUnread ? /* @__PURE__ */ jsx42("span", { className: "absolute -right-1.5 -top-1.5 inline-flex h-3.5 min-w-[0.9rem] items-center justify-center rounded-full bg-destructive px-0.5 text-[9px] font-bold leading-none text-destructive-foreground", children: unreadGeneralNotificationsCount > 99 ? "99+" : unreadGeneralNotificationsCount }) : null,
10659
+ hasChatUnread ? /* @__PURE__ */ jsx42("span", { className: "absolute -right-1.5 -top-1.5 inline-flex h-3.5 min-w-[0.9rem] items-center justify-center rounded-full bg-destructive px-0.5 text-[9px] font-bold leading-none text-destructive-foreground", children: visibleChatUnreadCount > 99 ? "99+" : visibleChatUnreadCount }) : null
10660
+ ] })
10611
10661
  },
10612
- title: tab.label,
10613
- className: cn(
10614
- "flex h-9 w-full items-center justify-center rounded-xl transition-all",
10615
- isCurrent ? "bg-background text-foreground shadow-[var(--elevation-2)]" : "text-muted-foreground hover:bg-muted/50 hover:text-foreground"
10616
- ),
10617
- "aria-current": isCurrent ? "page" : void 0,
10618
- "aria-label": tab.label,
10619
- children: /* @__PURE__ */ jsxs27("span", { className: "relative inline-flex", children: [
10620
- /* @__PURE__ */ jsx42(Icon3, { className: "h-4 w-4" }),
10621
- hasNotificationUnread ? /* @__PURE__ */ jsx42("span", { className: "absolute -right-1.5 -top-1.5 inline-flex h-3.5 min-w-[0.9rem] items-center justify-center rounded-full bg-destructive px-0.5 text-[9px] font-bold leading-none text-destructive-foreground", children: unreadGeneralNotificationsCount > 99 ? "99+" : unreadGeneralNotificationsCount }) : null,
10622
- hasChatUnread ? /* @__PURE__ */ jsx42("span", { className: "absolute -right-1.5 -top-1.5 inline-flex h-3.5 min-w-[0.9rem] items-center justify-center rounded-full bg-destructive px-0.5 text-[9px] font-bold leading-none text-destructive-foreground", children: visibleChatUnreadCount > 99 ? "99+" : visibleChatUnreadCount }) : null
10623
- ] })
10624
- },
10625
- tab.id
10626
- );
10627
- }) }) }),
10662
+ tab.id
10663
+ );
10664
+ }) }) })
10665
+ ] }),
10628
10666
  /* @__PURE__ */ jsx42(
10629
10667
  "div",
10630
10668
  {
@@ -10702,6 +10740,7 @@ var UserMenuCupcode = ({
10702
10740
  }
10703
10741
  );
10704
10742
  };
10743
+ var UserMenuCupcode_default = UserMenuCupcode;
10705
10744
 
10706
10745
  // src/lib/navigation.tsx
10707
10746
  import { BookOpen, Home, Layers } from "lucide-react";
@@ -10724,7 +10763,7 @@ var getMainNavItems = () => [
10724
10763
  }
10725
10764
  ];
10726
10765
 
10727
- // node_modules/tslib/tslib.es6.mjs
10766
+ // node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs
10728
10767
  function __rest(s, e) {
10729
10768
  var t = {};
10730
10769
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -10764,7 +10803,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
10764
10803
  });
10765
10804
  }
10766
10805
 
10767
- // node_modules/@supabase/functions-js/dist/module/helper.js
10806
+ // node_modules/.pnpm/@supabase+functions-js@2.95.1/node_modules/@supabase/functions-js/dist/module/helper.js
10768
10807
  var resolveFetch = (customFetch) => {
10769
10808
  if (customFetch) {
10770
10809
  return (...args) => customFetch(...args);
@@ -10772,7 +10811,7 @@ var resolveFetch = (customFetch) => {
10772
10811
  return (...args) => fetch(...args);
10773
10812
  };
10774
10813
 
10775
- // node_modules/@supabase/functions-js/dist/module/types.js
10814
+ // node_modules/.pnpm/@supabase+functions-js@2.95.1/node_modules/@supabase/functions-js/dist/module/types.js
10776
10815
  var FunctionsError = class extends Error {
10777
10816
  constructor(message, name = "FunctionsError", context) {
10778
10817
  super(message);
@@ -10814,7 +10853,7 @@ var FunctionRegion;
10814
10853
  FunctionRegion2["UsWest2"] = "us-west-2";
10815
10854
  })(FunctionRegion || (FunctionRegion = {}));
10816
10855
 
10817
- // node_modules/@supabase/functions-js/dist/module/FunctionsClient.js
10856
+ // node_modules/.pnpm/@supabase+functions-js@2.95.1/node_modules/@supabase/functions-js/dist/module/FunctionsClient.js
10818
10857
  var FunctionsClient = class {
10819
10858
  /**
10820
10859
  * Creates a new Functions client bound to an Edge Functions URL.
@@ -10954,7 +10993,7 @@ var FunctionsClient = class {
10954
10993
  }
10955
10994
  };
10956
10995
 
10957
- // node_modules/@supabase/postgrest-js/dist/index.mjs
10996
+ // node_modules/.pnpm/@supabase+postgrest-js@2.95.1/node_modules/@supabase/postgrest-js/dist/index.mjs
10958
10997
  var PostgrestError = class extends Error {
10959
10998
  /**
10960
10999
  * @example
@@ -10992,7 +11031,7 @@ var PostgrestBuilder = class {
10992
11031
  * ```
10993
11032
  */
10994
11033
  constructor(builder) {
10995
- var _builder$shouldThrowO, _builder$isMaybeSingl;
11034
+ var _builder$shouldThrowO, _builder$isMaybeSingl, _builder$urlLengthLim;
10996
11035
  this.shouldThrowOnError = false;
10997
11036
  this.method = builder.method;
10998
11037
  this.url = builder.url;
@@ -11002,6 +11041,7 @@ var PostgrestBuilder = class {
11002
11041
  this.shouldThrowOnError = (_builder$shouldThrowO = builder.shouldThrowOnError) !== null && _builder$shouldThrowO !== void 0 ? _builder$shouldThrowO : false;
11003
11042
  this.signal = builder.signal;
11004
11043
  this.isMaybeSingle = (_builder$isMaybeSingl = builder.isMaybeSingle) !== null && _builder$isMaybeSingl !== void 0 ? _builder$isMaybeSingl : false;
11044
+ this.urlLengthLimit = (_builder$urlLengthLim = builder.urlLengthLimit) !== null && _builder$urlLengthLim !== void 0 ? _builder$urlLengthLim : 8e3;
11005
11045
  if (builder.fetch) this.fetch = builder.fetch;
11006
11046
  else this.fetch = fetch;
11007
11047
  }
@@ -11102,6 +11142,8 @@ var PostgrestBuilder = class {
11102
11142
  if (!this.shouldThrowOnError) res = res.catch((fetchError) => {
11103
11143
  var _fetchError$name2;
11104
11144
  let errorDetails = "";
11145
+ let hint = "";
11146
+ let code = "";
11105
11147
  const cause = fetchError === null || fetchError === void 0 ? void 0 : fetchError.cause;
11106
11148
  if (cause) {
11107
11149
  var _cause$message, _cause$code, _fetchError$name, _cause$name;
@@ -11118,12 +11160,22 @@ ${cause.stack}`;
11118
11160
  var _fetchError$stack;
11119
11161
  errorDetails = (_fetchError$stack = fetchError === null || fetchError === void 0 ? void 0 : fetchError.stack) !== null && _fetchError$stack !== void 0 ? _fetchError$stack : "";
11120
11162
  }
11163
+ const urlLength = this.url.toString().length;
11164
+ if ((fetchError === null || fetchError === void 0 ? void 0 : fetchError.name) === "AbortError" || (fetchError === null || fetchError === void 0 ? void 0 : fetchError.code) === "ABORT_ERR") {
11165
+ code = "";
11166
+ hint = "Request was aborted (timeout or manual cancellation)";
11167
+ if (urlLength > this.urlLengthLimit) hint += `. Note: Your request URL is ${urlLength} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`;
11168
+ } else if ((cause === null || cause === void 0 ? void 0 : cause.name) === "HeadersOverflowError" || (cause === null || cause === void 0 ? void 0 : cause.code) === "UND_ERR_HEADERS_OVERFLOW") {
11169
+ code = "";
11170
+ hint = "HTTP headers exceeded server limits (typically 16KB)";
11171
+ if (urlLength > this.urlLengthLimit) hint += `. Your request URL is ${urlLength} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`;
11172
+ }
11121
11173
  return {
11122
11174
  error: {
11123
11175
  message: `${(_fetchError$name2 = fetchError === null || fetchError === void 0 ? void 0 : fetchError.name) !== null && _fetchError$name2 !== void 0 ? _fetchError$name2 : "FetchError"}: ${fetchError === null || fetchError === void 0 ? void 0 : fetchError.message}`,
11124
11176
  details: errorDetails,
11125
- hint: "",
11126
- code: ""
11177
+ hint,
11178
+ code
11127
11179
  },
11128
11180
  data: null,
11129
11181
  count: null,
@@ -11765,11 +11817,12 @@ var PostgrestQueryBuilder = class {
11765
11817
  * )
11766
11818
  * ```
11767
11819
  */
11768
- constructor(url, { headers = {}, schema, fetch: fetch$1 }) {
11820
+ constructor(url, { headers = {}, schema, fetch: fetch$1, urlLengthLimit = 8e3 }) {
11769
11821
  this.url = url;
11770
11822
  this.headers = new Headers(headers);
11771
11823
  this.schema = schema;
11772
11824
  this.fetch = fetch$1;
11825
+ this.urlLengthLimit = urlLengthLimit;
11773
11826
  }
11774
11827
  /**
11775
11828
  * Clone URL and headers to prevent shared state between operations.
@@ -11800,6 +11853,10 @@ var PostgrestQueryBuilder = class {
11800
11853
  *
11801
11854
  * `"estimated"`: Uses exact count for low numbers and planned count for high
11802
11855
  * numbers.
11856
+ *
11857
+ * @remarks
11858
+ * When using `count` with `.range()` or `.limit()`, the returned `count` is the total number of rows
11859
+ * that match your filters, not the number of rows in the current page. Use this to build pagination UI.
11803
11860
  */
11804
11861
  select(columns, options) {
11805
11862
  const { head: head2 = false, count: count2 } = options !== null && options !== void 0 ? options : {};
@@ -11818,7 +11875,8 @@ var PostgrestQueryBuilder = class {
11818
11875
  url,
11819
11876
  headers,
11820
11877
  schema: this.schema,
11821
- fetch: this.fetch
11878
+ fetch: this.fetch,
11879
+ urlLengthLimit: this.urlLengthLimit
11822
11880
  });
11823
11881
  }
11824
11882
  /**
@@ -11866,7 +11924,8 @@ var PostgrestQueryBuilder = class {
11866
11924
  headers,
11867
11925
  schema: this.schema,
11868
11926
  body: values,
11869
- fetch: (_this$fetch = this.fetch) !== null && _this$fetch !== void 0 ? _this$fetch : fetch
11927
+ fetch: (_this$fetch = this.fetch) !== null && _this$fetch !== void 0 ? _this$fetch : fetch,
11928
+ urlLengthLimit: this.urlLengthLimit
11870
11929
  });
11871
11930
  }
11872
11931
  /**
@@ -11975,7 +12034,8 @@ var PostgrestQueryBuilder = class {
11975
12034
  headers,
11976
12035
  schema: this.schema,
11977
12036
  body: values,
11978
- fetch: (_this$fetch2 = this.fetch) !== null && _this$fetch2 !== void 0 ? _this$fetch2 : fetch
12037
+ fetch: (_this$fetch2 = this.fetch) !== null && _this$fetch2 !== void 0 ? _this$fetch2 : fetch,
12038
+ urlLengthLimit: this.urlLengthLimit
11979
12039
  });
11980
12040
  }
11981
12041
  /**
@@ -12010,7 +12070,8 @@ var PostgrestQueryBuilder = class {
12010
12070
  headers,
12011
12071
  schema: this.schema,
12012
12072
  body: values,
12013
- fetch: (_this$fetch3 = this.fetch) !== null && _this$fetch3 !== void 0 ? _this$fetch3 : fetch
12073
+ fetch: (_this$fetch3 = this.fetch) !== null && _this$fetch3 !== void 0 ? _this$fetch3 : fetch,
12074
+ urlLengthLimit: this.urlLengthLimit
12014
12075
  });
12015
12076
  }
12016
12077
  /**
@@ -12042,10 +12103,62 @@ var PostgrestQueryBuilder = class {
12042
12103
  url,
12043
12104
  headers,
12044
12105
  schema: this.schema,
12045
- fetch: (_this$fetch4 = this.fetch) !== null && _this$fetch4 !== void 0 ? _this$fetch4 : fetch
12106
+ fetch: (_this$fetch4 = this.fetch) !== null && _this$fetch4 !== void 0 ? _this$fetch4 : fetch,
12107
+ urlLengthLimit: this.urlLengthLimit
12046
12108
  });
12047
12109
  }
12048
12110
  };
12111
+ function _typeof(o) {
12112
+ "@babel/helpers - typeof";
12113
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
12114
+ return typeof o$1;
12115
+ } : function(o$1) {
12116
+ return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
12117
+ }, _typeof(o);
12118
+ }
12119
+ function toPrimitive(t, r) {
12120
+ if ("object" != _typeof(t) || !t) return t;
12121
+ var e = t[Symbol.toPrimitive];
12122
+ if (void 0 !== e) {
12123
+ var i = e.call(t, r || "default");
12124
+ if ("object" != _typeof(i)) return i;
12125
+ throw new TypeError("@@toPrimitive must return a primitive value.");
12126
+ }
12127
+ return ("string" === r ? String : Number)(t);
12128
+ }
12129
+ function toPropertyKey(t) {
12130
+ var i = toPrimitive(t, "string");
12131
+ return "symbol" == _typeof(i) ? i : i + "";
12132
+ }
12133
+ function _defineProperty(e, r, t) {
12134
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
12135
+ value: t,
12136
+ enumerable: true,
12137
+ configurable: true,
12138
+ writable: true
12139
+ }) : e[r] = t, e;
12140
+ }
12141
+ function ownKeys(e, r) {
12142
+ var t = Object.keys(e);
12143
+ if (Object.getOwnPropertySymbols) {
12144
+ var o = Object.getOwnPropertySymbols(e);
12145
+ r && (o = o.filter(function(r$1) {
12146
+ return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
12147
+ })), t.push.apply(t, o);
12148
+ }
12149
+ return t;
12150
+ }
12151
+ function _objectSpread2(e) {
12152
+ for (var r = 1; r < arguments.length; r++) {
12153
+ var t = null != arguments[r] ? arguments[r] : {};
12154
+ r % 2 ? ownKeys(Object(t), true).forEach(function(r$1) {
12155
+ _defineProperty(e, r$1, t[r$1]);
12156
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
12157
+ Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
12158
+ });
12159
+ }
12160
+ return e;
12161
+ }
12049
12162
  var PostgrestClient = class PostgrestClient2 {
12050
12163
  /**
12051
12164
  * Creates a PostgREST client.
@@ -12055,6 +12168,8 @@ var PostgrestClient = class PostgrestClient2 {
12055
12168
  * @param options.headers - Custom headers
12056
12169
  * @param options.schema - Postgres schema to switch to
12057
12170
  * @param options.fetch - Custom fetch
12171
+ * @param options.timeout - Optional timeout in milliseconds for all requests. When set, requests will automatically abort after this duration to prevent indefinite hangs.
12172
+ * @param options.urlLengthLimit - Maximum URL length in characters before warnings/errors are triggered. Defaults to 8000.
12058
12173
  * @example
12059
12174
  * ```ts
12060
12175
  * import PostgrestClient from '@supabase/postgrest-js'
@@ -12062,14 +12177,38 @@ var PostgrestClient = class PostgrestClient2 {
12062
12177
  * const postgrest = new PostgrestClient('https://xyzcompany.supabase.co/rest/v1', {
12063
12178
  * headers: { apikey: 'public-anon-key' },
12064
12179
  * schema: 'public',
12180
+ * timeout: 30000, // 30 second timeout
12065
12181
  * })
12066
12182
  * ```
12067
12183
  */
12068
- constructor(url, { headers = {}, schema, fetch: fetch$1 } = {}) {
12184
+ constructor(url, { headers = {}, schema, fetch: fetch$1, timeout, urlLengthLimit = 8e3 } = {}) {
12069
12185
  this.url = url;
12070
12186
  this.headers = new Headers(headers);
12071
12187
  this.schemaName = schema;
12072
- this.fetch = fetch$1;
12188
+ this.urlLengthLimit = urlLengthLimit;
12189
+ const originalFetch = fetch$1 !== null && fetch$1 !== void 0 ? fetch$1 : globalThis.fetch;
12190
+ if (timeout !== void 0 && timeout > 0) this.fetch = (input, init) => {
12191
+ const controller = new AbortController();
12192
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
12193
+ const existingSignal = init === null || init === void 0 ? void 0 : init.signal;
12194
+ if (existingSignal) {
12195
+ if (existingSignal.aborted) {
12196
+ clearTimeout(timeoutId);
12197
+ return originalFetch(input, init);
12198
+ }
12199
+ const abortHandler = () => {
12200
+ clearTimeout(timeoutId);
12201
+ controller.abort();
12202
+ };
12203
+ existingSignal.addEventListener("abort", abortHandler, { once: true });
12204
+ return originalFetch(input, _objectSpread2(_objectSpread2({}, init), {}, { signal: controller.signal })).finally(() => {
12205
+ clearTimeout(timeoutId);
12206
+ existingSignal.removeEventListener("abort", abortHandler);
12207
+ });
12208
+ }
12209
+ return originalFetch(input, _objectSpread2(_objectSpread2({}, init), {}, { signal: controller.signal })).finally(() => clearTimeout(timeoutId));
12210
+ };
12211
+ else this.fetch = originalFetch;
12073
12212
  }
12074
12213
  /**
12075
12214
  * Perform a query on a table or a view.
@@ -12081,7 +12220,8 @@ var PostgrestClient = class PostgrestClient2 {
12081
12220
  return new PostgrestQueryBuilder(new URL(`${this.url}/${relation}`), {
12082
12221
  headers: new Headers(this.headers),
12083
12222
  schema: this.schemaName,
12084
- fetch: this.fetch
12223
+ fetch: this.fetch,
12224
+ urlLengthLimit: this.urlLengthLimit
12085
12225
  });
12086
12226
  }
12087
12227
  /**
@@ -12095,7 +12235,8 @@ var PostgrestClient = class PostgrestClient2 {
12095
12235
  return new PostgrestClient2(this.url, {
12096
12236
  headers: this.headers,
12097
12237
  schema,
12098
- fetch: this.fetch
12238
+ fetch: this.fetch,
12239
+ urlLengthLimit: this.urlLengthLimit
12099
12240
  });
12100
12241
  }
12101
12242
  /**
@@ -12158,12 +12299,13 @@ var PostgrestClient = class PostgrestClient2 {
12158
12299
  headers,
12159
12300
  schema: this.schemaName,
12160
12301
  body,
12161
- fetch: (_this$fetch = this.fetch) !== null && _this$fetch !== void 0 ? _this$fetch : fetch
12302
+ fetch: (_this$fetch = this.fetch) !== null && _this$fetch !== void 0 ? _this$fetch : fetch,
12303
+ urlLengthLimit: this.urlLengthLimit
12162
12304
  });
12163
12305
  }
12164
12306
  };
12165
12307
 
12166
- // node_modules/@supabase/realtime-js/dist/module/lib/websocket-factory.js
12308
+ // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/lib/websocket-factory.js
12167
12309
  var WebSocketFactory = class {
12168
12310
  /**
12169
12311
  * Static-only utility – prevent instantiation.
@@ -12279,10 +12421,10 @@ Suggested solution: ${env.workaround}`;
12279
12421
  };
12280
12422
  var websocket_factory_default = WebSocketFactory;
12281
12423
 
12282
- // node_modules/@supabase/realtime-js/dist/module/lib/version.js
12283
- var version = "2.91.0";
12424
+ // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/lib/version.js
12425
+ var version = "2.95.1";
12284
12426
 
12285
- // node_modules/@supabase/realtime-js/dist/module/lib/constants.js
12427
+ // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/lib/constants.js
12286
12428
  var DEFAULT_VERSION = `realtime-js/${version}`;
12287
12429
  var VSN_1_0_0 = "1.0.0";
12288
12430
  var VSN_2_0_0 = "2.0.0";
@@ -12326,7 +12468,7 @@ var CONNECTION_STATE;
12326
12468
  CONNECTION_STATE2["Closed"] = "closed";
12327
12469
  })(CONNECTION_STATE || (CONNECTION_STATE = {}));
12328
12470
 
12329
- // node_modules/@supabase/realtime-js/dist/module/lib/serializer.js
12471
+ // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/lib/serializer.js
12330
12472
  var Serializer = class {
12331
12473
  constructor(allowedMetadataKeys) {
12332
12474
  this.HEADER_LENGTH = 1;
@@ -12466,7 +12608,7 @@ var Serializer = class {
12466
12608
  }
12467
12609
  };
12468
12610
 
12469
- // node_modules/@supabase/realtime-js/dist/module/lib/timer.js
12611
+ // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/lib/timer.js
12470
12612
  var Timer = class {
12471
12613
  constructor(callback, timerCalc) {
12472
12614
  this.callback = callback;
@@ -12491,7 +12633,7 @@ var Timer = class {
12491
12633
  }
12492
12634
  };
12493
12635
 
12494
- // node_modules/@supabase/realtime-js/dist/module/lib/transformers.js
12636
+ // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/lib/transformers.js
12495
12637
  var PostgresTypes;
12496
12638
  (function(PostgresTypes2) {
12497
12639
  PostgresTypes2["abstime"] = "abstime";
@@ -12654,7 +12796,7 @@ var httpEndpointURL = (socketUrl) => {
12654
12796
  return wsUrl.href;
12655
12797
  };
12656
12798
 
12657
- // node_modules/@supabase/realtime-js/dist/module/lib/push.js
12799
+ // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/lib/push.js
12658
12800
  var Push = class {
12659
12801
  /**
12660
12802
  * Initializes the Push
@@ -12753,7 +12895,7 @@ var Push = class {
12753
12895
  }
12754
12896
  };
12755
12897
 
12756
- // node_modules/@supabase/realtime-js/dist/module/RealtimePresence.js
12898
+ // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.js
12757
12899
  var REALTIME_PRESENCE_LISTEN_EVENTS;
12758
12900
  (function(REALTIME_PRESENCE_LISTEN_EVENTS2) {
12759
12901
  REALTIME_PRESENCE_LISTEN_EVENTS2["SYNC"] = "sync";
@@ -12985,7 +13127,7 @@ var RealtimePresence = class _RealtimePresence {
12985
13127
  }
12986
13128
  };
12987
13129
 
12988
- // node_modules/@supabase/realtime-js/dist/module/RealtimeChannel.js
13130
+ // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/RealtimeChannel.js
12989
13131
  var REALTIME_POSTGRES_CHANGES_LISTEN_EVENT;
12990
13132
  (function(REALTIME_POSTGRES_CHANGES_LISTEN_EVENT2) {
12991
13133
  REALTIME_POSTGRES_CHANGES_LISTEN_EVENT2["ALL"] = "*";
@@ -13425,15 +13567,15 @@ var RealtimeChannel = class _RealtimeChannel {
13425
13567
  }).map((bind) => bind.callback(handledPayload, ref));
13426
13568
  } else {
13427
13569
  (_b7 = this.bindings[typeLower]) === null || _b7 === void 0 ? void 0 : _b7.filter((bind) => {
13428
- var _a79, _b8, _c, _d, _e, _f, _g, _h;
13570
+ var _a79, _b8, _c, _d, _e, _f;
13429
13571
  if (["broadcast", "presence", "postgres_changes"].includes(typeLower)) {
13430
13572
  if ("id" in bind) {
13431
13573
  const bindId = bind.id;
13432
13574
  const bindEvent = (_a79 = bind.filter) === null || _a79 === void 0 ? void 0 : _a79.event;
13433
- return bindId && ((_b8 = payload.ids) === null || _b8 === void 0 ? void 0 : _b8.includes(bindId)) && (bindEvent === "*" || (bindEvent === null || bindEvent === void 0 ? void 0 : bindEvent.toLocaleLowerCase()) === ((_c = payload.data) === null || _c === void 0 ? void 0 : _c.type.toLocaleLowerCase())) && (!((_d = bind.filter) === null || _d === void 0 ? void 0 : _d.table) || bind.filter.table === ((_e = payload.data) === null || _e === void 0 ? void 0 : _e.table));
13575
+ return bindId && ((_b8 = payload.ids) === null || _b8 === void 0 ? void 0 : _b8.includes(bindId)) && (bindEvent === "*" || (bindEvent === null || bindEvent === void 0 ? void 0 : bindEvent.toLocaleLowerCase()) === ((_c = payload.data) === null || _c === void 0 ? void 0 : _c.type.toLocaleLowerCase()));
13434
13576
  } else {
13435
- const bindEvent = (_g = (_f = bind === null || bind === void 0 ? void 0 : bind.filter) === null || _f === void 0 ? void 0 : _f.event) === null || _g === void 0 ? void 0 : _g.toLocaleLowerCase();
13436
- return bindEvent === "*" || bindEvent === ((_h = payload === null || payload === void 0 ? void 0 : payload.event) === null || _h === void 0 ? void 0 : _h.toLocaleLowerCase());
13577
+ 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();
13578
+ return bindEvent === "*" || bindEvent === ((_f = payload === null || payload === void 0 ? void 0 : payload.event) === null || _f === void 0 ? void 0 : _f.toLocaleLowerCase());
13437
13579
  }
13438
13580
  } else {
13439
13581
  return bind.type.toLocaleLowerCase() === typeLower;
@@ -13581,7 +13723,7 @@ var RealtimeChannel = class _RealtimeChannel {
13581
13723
  }
13582
13724
  };
13583
13725
 
13584
- // node_modules/@supabase/realtime-js/dist/module/RealtimeClient.js
13726
+ // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/RealtimeClient.js
13585
13727
  var noop2 = () => {
13586
13728
  };
13587
13729
  var CONNECTION_TIMEOUTS = {
@@ -13767,6 +13909,9 @@ Option 2: Install and provide the "ws" package:
13767
13909
  */
13768
13910
  async removeChannel(channel) {
13769
13911
  const status = await channel.unsubscribe();
13912
+ if (status === "ok") {
13913
+ this._remove(channel);
13914
+ }
13770
13915
  if (this.channels.length === 0) {
13771
13916
  this.disconnect();
13772
13917
  }
@@ -14157,6 +14302,11 @@ Option 2: Install and provide the "ws" package:
14157
14302
  this.log("transport", `${error}`);
14158
14303
  this._triggerChanError();
14159
14304
  this._triggerStateCallbacks("error", error);
14305
+ try {
14306
+ this.heartbeatCallback("error");
14307
+ } catch (e) {
14308
+ this.log("error", "error in heartbeat callback", e);
14309
+ }
14160
14310
  }
14161
14311
  /** @internal */
14162
14312
  _triggerChanError() {
@@ -14334,7 +14484,7 @@ Option 2: Install and provide the "ws" package:
14334
14484
  }
14335
14485
  };
14336
14486
 
14337
- // node_modules/iceberg-js/dist/index.mjs
14487
+ // node_modules/.pnpm/iceberg-js@0.8.1/node_modules/iceberg-js/dist/index.mjs
14338
14488
  var IcebergError = class extends Error {
14339
14489
  constructor(message, opts) {
14340
14490
  var _a78;
@@ -14872,21 +15022,24 @@ var IcebergRestCatalog = class {
14872
15022
  }
14873
15023
  };
14874
15024
 
14875
- // node_modules/@supabase/storage-js/dist/index.mjs
15025
+ // node_modules/.pnpm/@supabase+storage-js@2.95.1/node_modules/@supabase/storage-js/dist/index.mjs
14876
15026
  var StorageError = class extends Error {
14877
- constructor(message) {
15027
+ constructor(message, namespace = "storage", status, statusCode) {
14878
15028
  super(message);
14879
15029
  this.__isStorageError = true;
14880
- this.name = "StorageError";
15030
+ this.namespace = namespace;
15031
+ this.name = namespace === "vectors" ? "StorageVectorsError" : "StorageError";
15032
+ this.status = status;
15033
+ this.statusCode = statusCode;
14881
15034
  }
14882
15035
  };
14883
15036
  function isStorageError(error) {
14884
15037
  return typeof error === "object" && error !== null && "__isStorageError" in error;
14885
15038
  }
14886
15039
  var StorageApiError = class extends StorageError {
14887
- constructor(message, status, statusCode) {
14888
- super(message);
14889
- this.name = "StorageApiError";
15040
+ constructor(message, status, statusCode, namespace = "storage") {
15041
+ super(message, namespace, status, statusCode);
15042
+ this.name = namespace === "vectors" ? "StorageVectorsApiError" : "StorageApiError";
14890
15043
  this.status = status;
14891
15044
  this.statusCode = statusCode;
14892
15045
  }
@@ -14900,18 +15053,20 @@ var StorageApiError = class extends StorageError {
14900
15053
  }
14901
15054
  };
14902
15055
  var StorageUnknownError = class extends StorageError {
14903
- constructor(message, originalError) {
14904
- super(message);
14905
- this.name = "StorageUnknownError";
15056
+ constructor(message, originalError, namespace = "storage") {
15057
+ super(message, namespace);
15058
+ this.name = namespace === "vectors" ? "StorageVectorsUnknownError" : "StorageUnknownError";
14906
15059
  this.originalError = originalError;
14907
15060
  }
14908
15061
  };
14909
- var resolveFetch$1 = (customFetch) => {
15062
+ var resolveFetch2 = (customFetch) => {
14910
15063
  if (customFetch) return (...args) => customFetch(...args);
14911
15064
  return (...args) => fetch(...args);
14912
15065
  };
14913
- var resolveResponse$1 = () => {
14914
- return Response;
15066
+ var isPlainObject = (value) => {
15067
+ if (typeof value !== "object" || value === null) return false;
15068
+ const prototype = Object.getPrototypeOf(value);
15069
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
14915
15070
  };
14916
15071
  var recursiveToCamel = (item) => {
14917
15072
  if (Array.isArray(item)) return item.map((el) => recursiveToCamel(el));
@@ -14923,11 +15078,6 @@ var recursiveToCamel = (item) => {
14923
15078
  });
14924
15079
  return result;
14925
15080
  };
14926
- var isPlainObject$1 = (value) => {
14927
- if (typeof value !== "object" || value === null) return false;
14928
- const prototype = Object.getPrototypeOf(value);
14929
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
14930
- };
14931
15081
  var isValidBucketName = (bucketName) => {
14932
15082
  if (!bucketName || typeof bucketName !== "string") return false;
14933
15083
  if (bucketName.length === 0 || bucketName.length > 100) return false;
@@ -14935,37 +15085,37 @@ var isValidBucketName = (bucketName) => {
14935
15085
  if (bucketName.includes("/") || bucketName.includes("\\")) return false;
14936
15086
  return /^[\w!.\*'() &$@=;:+,?-]+$/.test(bucketName);
14937
15087
  };
14938
- function _typeof(o) {
15088
+ function _typeof2(o) {
14939
15089
  "@babel/helpers - typeof";
14940
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
15090
+ return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
14941
15091
  return typeof o$1;
14942
15092
  } : function(o$1) {
14943
15093
  return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
14944
- }, _typeof(o);
15094
+ }, _typeof2(o);
14945
15095
  }
14946
- function toPrimitive(t, r) {
14947
- if ("object" != _typeof(t) || !t) return t;
15096
+ function toPrimitive2(t, r) {
15097
+ if ("object" != _typeof2(t) || !t) return t;
14948
15098
  var e = t[Symbol.toPrimitive];
14949
15099
  if (void 0 !== e) {
14950
15100
  var i = e.call(t, r || "default");
14951
- if ("object" != _typeof(i)) return i;
15101
+ if ("object" != _typeof2(i)) return i;
14952
15102
  throw new TypeError("@@toPrimitive must return a primitive value.");
14953
15103
  }
14954
15104
  return ("string" === r ? String : Number)(t);
14955
15105
  }
14956
- function toPropertyKey(t) {
14957
- var i = toPrimitive(t, "string");
14958
- return "symbol" == _typeof(i) ? i : i + "";
15106
+ function toPropertyKey2(t) {
15107
+ var i = toPrimitive2(t, "string");
15108
+ return "symbol" == _typeof2(i) ? i : i + "";
14959
15109
  }
14960
- function _defineProperty(e, r, t) {
14961
- return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
15110
+ function _defineProperty2(e, r, t) {
15111
+ return (r = toPropertyKey2(r)) in e ? Object.defineProperty(e, r, {
14962
15112
  value: t,
14963
15113
  enumerable: true,
14964
15114
  configurable: true,
14965
15115
  writable: true
14966
15116
  }) : e[r] = t, e;
14967
15117
  }
14968
- function ownKeys(e, r) {
15118
+ function ownKeys2(e, r) {
14969
15119
  var t = Object.keys(e);
14970
15120
  if (Object.getOwnPropertySymbols) {
14971
15121
  var o = Object.getOwnPropertySymbols(e);
@@ -14975,75 +15125,166 @@ function ownKeys(e, r) {
14975
15125
  }
14976
15126
  return t;
14977
15127
  }
14978
- function _objectSpread2(e) {
15128
+ function _objectSpread22(e) {
14979
15129
  for (var r = 1; r < arguments.length; r++) {
14980
15130
  var t = null != arguments[r] ? arguments[r] : {};
14981
- r % 2 ? ownKeys(Object(t), true).forEach(function(r$1) {
14982
- _defineProperty(e, r$1, t[r$1]);
14983
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
15131
+ r % 2 ? ownKeys2(Object(t), true).forEach(function(r$1) {
15132
+ _defineProperty2(e, r$1, t[r$1]);
15133
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys2(Object(t)).forEach(function(r$1) {
14984
15134
  Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
14985
15135
  });
14986
15136
  }
14987
15137
  return e;
14988
15138
  }
14989
- var _getErrorMessage$1 = (err) => {
15139
+ var _getErrorMessage = (err) => {
14990
15140
  var _err$error;
14991
15141
  return err.msg || err.message || err.error_description || (typeof err.error === "string" ? err.error : (_err$error = err.error) === null || _err$error === void 0 ? void 0 : _err$error.message) || JSON.stringify(err);
14992
15142
  };
14993
- var handleError$1 = async (error, reject, options) => {
14994
- if (error instanceof await resolveResponse$1() && !(options === null || options === void 0 ? void 0 : options.noResolveJson)) error.json().then((err) => {
14995
- const status = error.status || 500;
14996
- const statusCode = (err === null || err === void 0 ? void 0 : err.statusCode) || status + "";
14997
- reject(new StorageApiError(_getErrorMessage$1(err), status, statusCode));
14998
- }).catch((err) => {
14999
- reject(new StorageUnknownError(_getErrorMessage$1(err), err));
15000
- });
15001
- else reject(new StorageUnknownError(_getErrorMessage$1(error), error));
15143
+ var handleError = async (error, reject, options, namespace) => {
15144
+ if (error && typeof error === "object" && "status" in error && "ok" in error && typeof error.status === "number" && !(options === null || options === void 0 ? void 0 : options.noResolveJson)) {
15145
+ const responseError = error;
15146
+ const status = responseError.status || 500;
15147
+ if (typeof responseError.json === "function") responseError.json().then((err) => {
15148
+ const statusCode = (err === null || err === void 0 ? void 0 : err.statusCode) || (err === null || err === void 0 ? void 0 : err.code) || status + "";
15149
+ reject(new StorageApiError(_getErrorMessage(err), status, statusCode, namespace));
15150
+ }).catch(() => {
15151
+ if (namespace === "vectors") {
15152
+ const statusCode = status + "";
15153
+ reject(new StorageApiError(responseError.statusText || `HTTP ${status} error`, status, statusCode, namespace));
15154
+ } else {
15155
+ const statusCode = status + "";
15156
+ reject(new StorageApiError(responseError.statusText || `HTTP ${status} error`, status, statusCode, namespace));
15157
+ }
15158
+ });
15159
+ else {
15160
+ const statusCode = status + "";
15161
+ reject(new StorageApiError(responseError.statusText || `HTTP ${status} error`, status, statusCode, namespace));
15162
+ }
15163
+ } else reject(new StorageUnknownError(_getErrorMessage(error), error, namespace));
15002
15164
  };
15003
- var _getRequestParams$1 = (method, options, parameters, body) => {
15165
+ var _getRequestParams = (method, options, parameters, body) => {
15004
15166
  const params = {
15005
15167
  method,
15006
15168
  headers: (options === null || options === void 0 ? void 0 : options.headers) || {}
15007
15169
  };
15008
- if (method === "GET" || !body) return params;
15009
- if (isPlainObject$1(body)) {
15010
- params.headers = _objectSpread2({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers);
15170
+ if (method === "GET" || method === "HEAD" || !body) return _objectSpread22(_objectSpread22({}, params), parameters);
15171
+ if (isPlainObject(body)) {
15172
+ params.headers = _objectSpread22({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers);
15011
15173
  params.body = JSON.stringify(body);
15012
15174
  } else params.body = body;
15013
15175
  if (options === null || options === void 0 ? void 0 : options.duplex) params.duplex = options.duplex;
15014
- return _objectSpread2(_objectSpread2({}, params), parameters);
15176
+ return _objectSpread22(_objectSpread22({}, params), parameters);
15015
15177
  };
15016
- async function _handleRequest$1(fetcher, method, url, options, parameters, body) {
15178
+ async function _handleRequest(fetcher, method, url, options, parameters, body, namespace) {
15017
15179
  return new Promise((resolve, reject) => {
15018
- fetcher(url, _getRequestParams$1(method, options, parameters, body)).then((result) => {
15180
+ fetcher(url, _getRequestParams(method, options, parameters, body)).then((result) => {
15019
15181
  if (!result.ok) throw result;
15020
15182
  if (options === null || options === void 0 ? void 0 : options.noResolveJson) return result;
15183
+ if (namespace === "vectors") {
15184
+ const contentType = result.headers.get("content-type");
15185
+ if (result.headers.get("content-length") === "0" || result.status === 204) return {};
15186
+ if (!contentType || !contentType.includes("application/json")) return {};
15187
+ }
15021
15188
  return result.json();
15022
- }).then((data) => resolve(data)).catch((error) => handleError$1(error, reject, options));
15189
+ }).then((data) => resolve(data)).catch((error) => handleError(error, reject, options, namespace));
15023
15190
  });
15024
15191
  }
15025
- async function get(fetcher, url, options, parameters) {
15026
- return _handleRequest$1(fetcher, "GET", url, options, parameters);
15027
- }
15028
- async function post$1(fetcher, url, body, options, parameters) {
15029
- return _handleRequest$1(fetcher, "POST", url, options, parameters, body);
15030
- }
15031
- async function put(fetcher, url, body, options, parameters) {
15032
- return _handleRequest$1(fetcher, "PUT", url, options, parameters, body);
15033
- }
15034
- async function head(fetcher, url, options, parameters) {
15035
- return _handleRequest$1(fetcher, "HEAD", url, _objectSpread2(_objectSpread2({}, options), {}, { noResolveJson: true }), parameters);
15036
- }
15037
- async function remove(fetcher, url, body, options, parameters) {
15038
- return _handleRequest$1(fetcher, "DELETE", url, options, parameters, body);
15192
+ function createFetchApi(namespace = "storage") {
15193
+ return {
15194
+ get: async (fetcher, url, options, parameters) => {
15195
+ return _handleRequest(fetcher, "GET", url, options, parameters, void 0, namespace);
15196
+ },
15197
+ post: async (fetcher, url, body, options, parameters) => {
15198
+ return _handleRequest(fetcher, "POST", url, options, parameters, body, namespace);
15199
+ },
15200
+ put: async (fetcher, url, body, options, parameters) => {
15201
+ return _handleRequest(fetcher, "PUT", url, options, parameters, body, namespace);
15202
+ },
15203
+ head: async (fetcher, url, options, parameters) => {
15204
+ return _handleRequest(fetcher, "HEAD", url, _objectSpread22(_objectSpread22({}, options), {}, { noResolveJson: true }), parameters, void 0, namespace);
15205
+ },
15206
+ remove: async (fetcher, url, body, options, parameters) => {
15207
+ return _handleRequest(fetcher, "DELETE", url, options, parameters, body, namespace);
15208
+ }
15209
+ };
15039
15210
  }
15040
- var StreamDownloadBuilder = class {
15041
- constructor(downloadFn, shouldThrowOnError) {
15042
- this.downloadFn = downloadFn;
15043
- this.shouldThrowOnError = shouldThrowOnError;
15044
- }
15045
- then(onfulfilled, onrejected) {
15046
- return this.execute().then(onfulfilled, onrejected);
15211
+ var defaultApi = createFetchApi("storage");
15212
+ var { get, post, put, head, remove } = defaultApi;
15213
+ var vectorsApi = createFetchApi("vectors");
15214
+ var BaseApiClient = class {
15215
+ /**
15216
+ * Creates a new BaseApiClient instance
15217
+ * @param url - Base URL for API requests
15218
+ * @param headers - Default headers for API requests
15219
+ * @param fetch - Optional custom fetch implementation
15220
+ * @param namespace - Error namespace ('storage' or 'vectors')
15221
+ */
15222
+ constructor(url, headers = {}, fetch$1, namespace = "storage") {
15223
+ this.shouldThrowOnError = false;
15224
+ this.url = url;
15225
+ this.headers = headers;
15226
+ this.fetch = resolveFetch2(fetch$1);
15227
+ this.namespace = namespace;
15228
+ }
15229
+ /**
15230
+ * Enable throwing errors instead of returning them.
15231
+ * When enabled, errors are thrown instead of returned in { data, error } format.
15232
+ *
15233
+ * @returns this - For method chaining
15234
+ */
15235
+ throwOnError() {
15236
+ this.shouldThrowOnError = true;
15237
+ return this;
15238
+ }
15239
+ /**
15240
+ * Handles API operation with standardized error handling
15241
+ * Eliminates repetitive try-catch blocks across all API methods
15242
+ *
15243
+ * This wrapper:
15244
+ * 1. Executes the operation
15245
+ * 2. Returns { data, error: null } on success
15246
+ * 3. Returns { data: null, error } on failure (if shouldThrowOnError is false)
15247
+ * 4. Throws error on failure (if shouldThrowOnError is true)
15248
+ *
15249
+ * @typeParam T - The expected data type from the operation
15250
+ * @param operation - Async function that performs the API call
15251
+ * @returns Promise with { data, error } tuple
15252
+ *
15253
+ * @example
15254
+ * ```typescript
15255
+ * async listBuckets() {
15256
+ * return this.handleOperation(async () => {
15257
+ * return await get(this.fetch, `${this.url}/bucket`, {
15258
+ * headers: this.headers,
15259
+ * })
15260
+ * })
15261
+ * }
15262
+ * ```
15263
+ */
15264
+ async handleOperation(operation) {
15265
+ var _this = this;
15266
+ try {
15267
+ return {
15268
+ data: await operation(),
15269
+ error: null
15270
+ };
15271
+ } catch (error) {
15272
+ if (_this.shouldThrowOnError) throw error;
15273
+ if (isStorageError(error)) return {
15274
+ data: null,
15275
+ error
15276
+ };
15277
+ throw error;
15278
+ }
15279
+ }
15280
+ };
15281
+ var StreamDownloadBuilder = class {
15282
+ constructor(downloadFn, shouldThrowOnError) {
15283
+ this.downloadFn = downloadFn;
15284
+ this.shouldThrowOnError = shouldThrowOnError;
15285
+ }
15286
+ then(onfulfilled, onrejected) {
15287
+ return this.execute().then(onfulfilled, onrejected);
15047
15288
  }
15048
15289
  async execute() {
15049
15290
  var _this = this;
@@ -15117,22 +15358,10 @@ var DEFAULT_FILE_OPTIONS = {
15117
15358
  contentType: "text/plain;charset=UTF-8",
15118
15359
  upsert: false
15119
15360
  };
15120
- var StorageFileApi = class {
15361
+ var StorageFileApi = class extends BaseApiClient {
15121
15362
  constructor(url, headers = {}, bucketId, fetch$1) {
15122
- this.shouldThrowOnError = false;
15123
- this.url = url;
15124
- this.headers = headers;
15363
+ super(url, headers, fetch$1, "storage");
15125
15364
  this.bucketId = bucketId;
15126
- this.fetch = resolveFetch$1(fetch$1);
15127
- }
15128
- /**
15129
- * Enable throwing errors instead of returning them.
15130
- *
15131
- * @category File Buckets
15132
- */
15133
- throwOnError() {
15134
- this.shouldThrowOnError = true;
15135
- return this;
15136
15365
  }
15137
15366
  /**
15138
15367
  * Uploads a file to an existing bucket or replaces an existing file at the specified path with a new one.
@@ -15143,10 +15372,10 @@ var StorageFileApi = class {
15143
15372
  */
15144
15373
  async uploadOrUpdate(method, path, fileBody, fileOptions) {
15145
15374
  var _this = this;
15146
- try {
15375
+ return _this.handleOperation(async () => {
15147
15376
  let body;
15148
- const options = _objectSpread2(_objectSpread2({}, DEFAULT_FILE_OPTIONS), fileOptions);
15149
- let headers = _objectSpread2(_objectSpread2({}, _this.headers), method === "POST" && { "x-upsert": String(options.upsert) });
15377
+ const options = _objectSpread22(_objectSpread22({}, DEFAULT_FILE_OPTIONS), fileOptions);
15378
+ let headers = _objectSpread22(_objectSpread22({}, _this.headers), method === "POST" && { "x-upsert": String(options.upsert) });
15150
15379
  const metadata = options.metadata;
15151
15380
  if (typeof Blob !== "undefined" && fileBody instanceof Blob) {
15152
15381
  body = new FormData();
@@ -15164,26 +15393,16 @@ var StorageFileApi = class {
15164
15393
  if (metadata) headers["x-metadata"] = _this.toBase64(_this.encodeMetadata(metadata));
15165
15394
  if ((typeof ReadableStream !== "undefined" && body instanceof ReadableStream || body && typeof body === "object" && "pipe" in body && typeof body.pipe === "function") && !options.duplex) options.duplex = "half";
15166
15395
  }
15167
- if (fileOptions === null || fileOptions === void 0 ? void 0 : fileOptions.headers) headers = _objectSpread2(_objectSpread2({}, headers), fileOptions.headers);
15396
+ if (fileOptions === null || fileOptions === void 0 ? void 0 : fileOptions.headers) headers = _objectSpread22(_objectSpread22({}, headers), fileOptions.headers);
15168
15397
  const cleanPath = _this._removeEmptyFolders(path);
15169
15398
  const _path = _this._getFinalPath(cleanPath);
15170
- const data = await (method == "PUT" ? put : post$1)(_this.fetch, `${_this.url}/object/${_path}`, body, _objectSpread2({ headers }, (options === null || options === void 0 ? void 0 : options.duplex) ? { duplex: options.duplex } : {}));
15399
+ const data = await (method == "PUT" ? put : post)(_this.fetch, `${_this.url}/object/${_path}`, body, _objectSpread22({ headers }, (options === null || options === void 0 ? void 0 : options.duplex) ? { duplex: options.duplex } : {}));
15171
15400
  return {
15172
- data: {
15173
- path: cleanPath,
15174
- id: data.Id,
15175
- fullPath: data.Key
15176
- },
15177
- error: null
15178
- };
15179
- } catch (error) {
15180
- if (_this.shouldThrowOnError) throw error;
15181
- if (isStorageError(error)) return {
15182
- data: null,
15183
- error
15401
+ path: cleanPath,
15402
+ id: data.Id,
15403
+ fullPath: data.Key
15184
15404
  };
15185
- throw error;
15186
- }
15405
+ });
15187
15406
  }
15188
15407
  /**
15189
15408
  * Uploads a file to an existing bucket.
@@ -15269,10 +15488,10 @@ var StorageFileApi = class {
15269
15488
  const _path = _this3._getFinalPath(cleanPath);
15270
15489
  const url = new URL(_this3.url + `/object/upload/sign/${_path}`);
15271
15490
  url.searchParams.set("token", token);
15272
- try {
15491
+ return _this3.handleOperation(async () => {
15273
15492
  let body;
15274
- const options = _objectSpread2({ upsert: DEFAULT_FILE_OPTIONS.upsert }, fileOptions);
15275
- const headers = _objectSpread2(_objectSpread2({}, _this3.headers), { "x-upsert": String(options.upsert) });
15493
+ const options = _objectSpread22({ upsert: DEFAULT_FILE_OPTIONS.upsert }, fileOptions);
15494
+ const headers = _objectSpread22(_objectSpread22({}, _this3.headers), { "x-upsert": String(options.upsert) });
15276
15495
  if (typeof Blob !== "undefined" && fileBody instanceof Blob) {
15277
15496
  body = new FormData();
15278
15497
  body.append("cacheControl", options.cacheControl);
@@ -15286,20 +15505,10 @@ var StorageFileApi = class {
15286
15505
  headers["content-type"] = options.contentType;
15287
15506
  }
15288
15507
  return {
15289
- data: {
15290
- path: cleanPath,
15291
- fullPath: (await put(_this3.fetch, url.toString(), body, { headers })).Key
15292
- },
15293
- error: null
15294
- };
15295
- } catch (error) {
15296
- if (_this3.shouldThrowOnError) throw error;
15297
- if (isStorageError(error)) return {
15298
- data: null,
15299
- error
15508
+ path: cleanPath,
15509
+ fullPath: (await put(_this3.fetch, url.toString(), body, { headers })).Key
15300
15510
  };
15301
- throw error;
15302
- }
15511
+ });
15303
15512
  }
15304
15513
  /**
15305
15514
  * Creates a signed upload URL.
@@ -15333,30 +15542,20 @@ var StorageFileApi = class {
15333
15542
  */
15334
15543
  async createSignedUploadUrl(path, options) {
15335
15544
  var _this4 = this;
15336
- try {
15545
+ return _this4.handleOperation(async () => {
15337
15546
  let _path = _this4._getFinalPath(path);
15338
- const headers = _objectSpread2({}, _this4.headers);
15547
+ const headers = _objectSpread22({}, _this4.headers);
15339
15548
  if (options === null || options === void 0 ? void 0 : options.upsert) headers["x-upsert"] = "true";
15340
- const data = await post$1(_this4.fetch, `${_this4.url}/object/upload/sign/${_path}`, {}, { headers });
15549
+ const data = await post(_this4.fetch, `${_this4.url}/object/upload/sign/${_path}`, {}, { headers });
15341
15550
  const url = new URL(_this4.url + data.url);
15342
15551
  const token = url.searchParams.get("token");
15343
15552
  if (!token) throw new StorageError("No token returned by API");
15344
15553
  return {
15345
- data: {
15346
- signedUrl: url.toString(),
15347
- path,
15348
- token
15349
- },
15350
- error: null
15554
+ signedUrl: url.toString(),
15555
+ path,
15556
+ token
15351
15557
  };
15352
- } catch (error) {
15353
- if (_this4.shouldThrowOnError) throw error;
15354
- if (isStorageError(error)) return {
15355
- data: null,
15356
- error
15357
- };
15358
- throw error;
15359
- }
15558
+ });
15360
15559
  }
15361
15560
  /**
15362
15561
  * Replaces an existing file at the specified path with a new one.
@@ -15434,24 +15633,14 @@ var StorageFileApi = class {
15434
15633
  */
15435
15634
  async move(fromPath, toPath, options) {
15436
15635
  var _this6 = this;
15437
- try {
15438
- return {
15439
- data: await post$1(_this6.fetch, `${_this6.url}/object/move`, {
15440
- bucketId: _this6.bucketId,
15441
- sourceKey: fromPath,
15442
- destinationKey: toPath,
15443
- destinationBucket: options === null || options === void 0 ? void 0 : options.destinationBucket
15444
- }, { headers: _this6.headers }),
15445
- error: null
15446
- };
15447
- } catch (error) {
15448
- if (_this6.shouldThrowOnError) throw error;
15449
- if (isStorageError(error)) return {
15450
- data: null,
15451
- error
15452
- };
15453
- throw error;
15454
- }
15636
+ return _this6.handleOperation(async () => {
15637
+ return await post(_this6.fetch, `${_this6.url}/object/move`, {
15638
+ bucketId: _this6.bucketId,
15639
+ sourceKey: fromPath,
15640
+ destinationKey: toPath,
15641
+ destinationBucket: options === null || options === void 0 ? void 0 : options.destinationBucket
15642
+ }, { headers: _this6.headers });
15643
+ });
15455
15644
  }
15456
15645
  /**
15457
15646
  * Copies an existing file to a new path in the same bucket.
@@ -15482,24 +15671,14 @@ var StorageFileApi = class {
15482
15671
  */
15483
15672
  async copy(fromPath, toPath, options) {
15484
15673
  var _this7 = this;
15485
- try {
15486
- return {
15487
- data: { path: (await post$1(_this7.fetch, `${_this7.url}/object/copy`, {
15488
- bucketId: _this7.bucketId,
15489
- sourceKey: fromPath,
15490
- destinationKey: toPath,
15491
- destinationBucket: options === null || options === void 0 ? void 0 : options.destinationBucket
15492
- }, { headers: _this7.headers })).Key },
15493
- error: null
15494
- };
15495
- } catch (error) {
15496
- if (_this7.shouldThrowOnError) throw error;
15497
- if (isStorageError(error)) return {
15498
- data: null,
15499
- error
15500
- };
15501
- throw error;
15502
- }
15674
+ return _this7.handleOperation(async () => {
15675
+ return { path: (await post(_this7.fetch, `${_this7.url}/object/copy`, {
15676
+ bucketId: _this7.bucketId,
15677
+ sourceKey: fromPath,
15678
+ destinationKey: toPath,
15679
+ destinationBucket: options === null || options === void 0 ? void 0 : options.destinationBucket
15680
+ }, { headers: _this7.headers })).Key };
15681
+ });
15503
15682
  }
15504
15683
  /**
15505
15684
  * Creates a signed URL. Use a signed URL to share a file for a fixed amount of time.
@@ -15554,23 +15733,12 @@ var StorageFileApi = class {
15554
15733
  */
15555
15734
  async createSignedUrl(path, expiresIn, options) {
15556
15735
  var _this8 = this;
15557
- try {
15736
+ return _this8.handleOperation(async () => {
15558
15737
  let _path = _this8._getFinalPath(path);
15559
- let data = await post$1(_this8.fetch, `${_this8.url}/object/sign/${_path}`, _objectSpread2({ expiresIn }, (options === null || options === void 0 ? void 0 : options.transform) ? { transform: options.transform } : {}), { headers: _this8.headers });
15738
+ let data = await post(_this8.fetch, `${_this8.url}/object/sign/${_path}`, _objectSpread22({ expiresIn }, (options === null || options === void 0 ? void 0 : options.transform) ? { transform: options.transform } : {}), { headers: _this8.headers });
15560
15739
  const downloadQueryParam = (options === null || options === void 0 ? void 0 : options.download) ? `&download=${options.download === true ? "" : options.download}` : "";
15561
- data = { signedUrl: encodeURI(`${_this8.url}${data.signedURL}${downloadQueryParam}`) };
15562
- return {
15563
- data,
15564
- error: null
15565
- };
15566
- } catch (error) {
15567
- if (_this8.shouldThrowOnError) throw error;
15568
- if (isStorageError(error)) return {
15569
- data: null,
15570
- error
15571
- };
15572
- throw error;
15573
- }
15740
+ return { signedUrl: encodeURI(`${_this8.url}${data.signedURL}${downloadQueryParam}`) };
15741
+ });
15574
15742
  }
15575
15743
  /**
15576
15744
  * Creates multiple signed URLs. Use a signed URL to share a file for a fixed amount of time.
@@ -15612,24 +15780,14 @@ var StorageFileApi = class {
15612
15780
  */
15613
15781
  async createSignedUrls(paths, expiresIn, options) {
15614
15782
  var _this9 = this;
15615
- try {
15616
- const data = await post$1(_this9.fetch, `${_this9.url}/object/sign/${_this9.bucketId}`, {
15783
+ return _this9.handleOperation(async () => {
15784
+ const data = await post(_this9.fetch, `${_this9.url}/object/sign/${_this9.bucketId}`, {
15617
15785
  expiresIn,
15618
15786
  paths
15619
15787
  }, { headers: _this9.headers });
15620
15788
  const downloadQueryParam = (options === null || options === void 0 ? void 0 : options.download) ? `&download=${options.download === true ? "" : options.download}` : "";
15621
- return {
15622
- data: data.map((datum) => _objectSpread2(_objectSpread2({}, datum), {}, { signedUrl: datum.signedURL ? encodeURI(`${_this9.url}${datum.signedURL}${downloadQueryParam}`) : null })),
15623
- error: null
15624
- };
15625
- } catch (error) {
15626
- if (_this9.shouldThrowOnError) throw error;
15627
- if (isStorageError(error)) return {
15628
- data: null,
15629
- error
15630
- };
15631
- throw error;
15632
- }
15789
+ return data.map((datum) => _objectSpread22(_objectSpread22({}, datum), {}, { signedUrl: datum.signedURL ? encodeURI(`${_this9.url}${datum.signedURL}${downloadQueryParam}`) : null }));
15790
+ });
15633
15791
  }
15634
15792
  /**
15635
15793
  * Downloads a file from a private bucket. For public buckets, make a request to the URL returned from `getPublicUrl` instead.
@@ -15637,6 +15795,7 @@ var StorageFileApi = class {
15637
15795
  * @category File Buckets
15638
15796
  * @param path The full path and file name of the file to be downloaded. For example `folder/image.png`.
15639
15797
  * @param options.transform Transform the asset before serving it to the client.
15798
+ * @param parameters Additional fetch parameters like signal for cancellation. Supports standard fetch options including cache control.
15640
15799
  * @returns BlobDownloadBuilder instance for downloading the file
15641
15800
  *
15642
15801
  * @example Download file
@@ -15668,8 +15827,27 @@ var StorageFileApi = class {
15668
15827
  * }
15669
15828
  * })
15670
15829
  * ```
15830
+ *
15831
+ * @example Download with cache control (useful in Edge Functions)
15832
+ * ```js
15833
+ * const { data, error } = await supabase
15834
+ * .storage
15835
+ * .from('avatars')
15836
+ * .download('folder/avatar1.png', {}, { cache: 'no-store' })
15837
+ * ```
15838
+ *
15839
+ * @example Download with abort signal
15840
+ * ```js
15841
+ * const controller = new AbortController()
15842
+ * setTimeout(() => controller.abort(), 5000)
15843
+ *
15844
+ * const { data, error } = await supabase
15845
+ * .storage
15846
+ * .from('avatars')
15847
+ * .download('folder/avatar1.png', {}, { signal: controller.signal })
15848
+ * ```
15671
15849
  */
15672
- download(path, options) {
15850
+ download(path, options, parameters) {
15673
15851
  const renderPath = typeof (options === null || options === void 0 ? void 0 : options.transform) !== "undefined" ? "render/image/authenticated" : "object";
15674
15852
  const transformationQuery = this.transformOptsToQueryString((options === null || options === void 0 ? void 0 : options.transform) || {});
15675
15853
  const queryString = transformationQuery ? `?${transformationQuery}` : "";
@@ -15677,7 +15855,7 @@ var StorageFileApi = class {
15677
15855
  const downloadFn = () => get(this.fetch, `${this.url}/${renderPath}/${_path}${queryString}`, {
15678
15856
  headers: this.headers,
15679
15857
  noResolveJson: true
15680
- });
15858
+ }, parameters);
15681
15859
  return new BlobDownloadBuilder(downloadFn, this.shouldThrowOnError);
15682
15860
  }
15683
15861
  /**
@@ -15698,19 +15876,9 @@ var StorageFileApi = class {
15698
15876
  async info(path) {
15699
15877
  var _this10 = this;
15700
15878
  const _path = _this10._getFinalPath(path);
15701
- try {
15702
- return {
15703
- data: recursiveToCamel(await get(_this10.fetch, `${_this10.url}/object/info/${_path}`, { headers: _this10.headers })),
15704
- error: null
15705
- };
15706
- } catch (error) {
15707
- if (_this10.shouldThrowOnError) throw error;
15708
- if (isStorageError(error)) return {
15709
- data: null,
15710
- error
15711
- };
15712
- throw error;
15713
- }
15879
+ return _this10.handleOperation(async () => {
15880
+ return recursiveToCamel(await get(_this10.fetch, `${_this10.url}/object/info/${_path}`, { headers: _this10.headers }));
15881
+ });
15714
15882
  }
15715
15883
  /**
15716
15884
  * Checks the existence of a file.
@@ -15835,19 +16003,9 @@ var StorageFileApi = class {
15835
16003
  */
15836
16004
  async remove(paths) {
15837
16005
  var _this12 = this;
15838
- try {
15839
- return {
15840
- data: await remove(_this12.fetch, `${_this12.url}/object/${_this12.bucketId}`, { prefixes: paths }, { headers: _this12.headers }),
15841
- error: null
15842
- };
15843
- } catch (error) {
15844
- if (_this12.shouldThrowOnError) throw error;
15845
- if (isStorageError(error)) return {
15846
- data: null,
15847
- error
15848
- };
15849
- throw error;
15850
- }
16006
+ return _this12.handleOperation(async () => {
16007
+ return await remove(_this12.fetch, `${_this12.url}/object/${_this12.bucketId}`, { prefixes: paths }, { headers: _this12.headers });
16008
+ });
15851
16009
  }
15852
16010
  /**
15853
16011
  * Get file metadata
@@ -15919,20 +16077,10 @@ var StorageFileApi = class {
15919
16077
  */
15920
16078
  async list(path, options, parameters) {
15921
16079
  var _this13 = this;
15922
- try {
15923
- const body = _objectSpread2(_objectSpread2(_objectSpread2({}, DEFAULT_SEARCH_OPTIONS), options), {}, { prefix: path || "" });
15924
- return {
15925
- data: await post$1(_this13.fetch, `${_this13.url}/object/list/${_this13.bucketId}`, body, { headers: _this13.headers }, parameters),
15926
- error: null
15927
- };
15928
- } catch (error) {
15929
- if (_this13.shouldThrowOnError) throw error;
15930
- if (isStorageError(error)) return {
15931
- data: null,
15932
- error
15933
- };
15934
- throw error;
15935
- }
16080
+ return _this13.handleOperation(async () => {
16081
+ const body = _objectSpread22(_objectSpread22(_objectSpread22({}, DEFAULT_SEARCH_OPTIONS), options), {}, { prefix: path || "" });
16082
+ return await post(_this13.fetch, `${_this13.url}/object/list/${_this13.bucketId}`, body, { headers: _this13.headers }, parameters);
16083
+ });
15936
16084
  }
15937
16085
  /**
15938
16086
  * @experimental this method signature might change in the future
@@ -15943,20 +16091,10 @@ var StorageFileApi = class {
15943
16091
  */
15944
16092
  async listV2(options, parameters) {
15945
16093
  var _this14 = this;
15946
- try {
15947
- const body = _objectSpread2({}, options);
15948
- return {
15949
- data: await post$1(_this14.fetch, `${_this14.url}/object/list-v2/${_this14.bucketId}`, body, { headers: _this14.headers }, parameters),
15950
- error: null
15951
- };
15952
- } catch (error) {
15953
- if (_this14.shouldThrowOnError) throw error;
15954
- if (isStorageError(error)) return {
15955
- data: null,
15956
- error
15957
- };
15958
- throw error;
15959
- }
16094
+ return _this14.handleOperation(async () => {
16095
+ const body = _objectSpread22({}, options);
16096
+ return await post(_this14.fetch, `${_this14.url}/object/list-v2/${_this14.bucketId}`, body, { headers: _this14.headers }, parameters);
16097
+ });
15960
16098
  }
15961
16099
  encodeMetadata(metadata) {
15962
16100
  return JSON.stringify(metadata);
@@ -15981,27 +16119,17 @@ var StorageFileApi = class {
15981
16119
  return params.join("&");
15982
16120
  }
15983
16121
  };
15984
- var version2 = "2.91.0";
15985
- var DEFAULT_HEADERS$1 = { "X-Client-Info": `storage-js/${version2}` };
15986
- var StorageBucketApi = class {
16122
+ var version2 = "2.95.1";
16123
+ var DEFAULT_HEADERS = { "X-Client-Info": `storage-js/${version2}` };
16124
+ var StorageBucketApi = class extends BaseApiClient {
15987
16125
  constructor(url, headers = {}, fetch$1, opts) {
15988
- this.shouldThrowOnError = false;
15989
16126
  const baseUrl = new URL(url);
15990
16127
  if (opts === null || opts === void 0 ? void 0 : opts.useNewHostname) {
15991
16128
  if (/supabase\.(co|in|red)$/.test(baseUrl.hostname) && !baseUrl.hostname.includes("storage.supabase.")) baseUrl.hostname = baseUrl.hostname.replace("supabase.", "storage.supabase.");
15992
16129
  }
15993
- this.url = baseUrl.href.replace(/\/$/, "");
15994
- this.headers = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS$1), headers);
15995
- this.fetch = resolveFetch$1(fetch$1);
15996
- }
15997
- /**
15998
- * Enable throwing errors instead of returning them.
15999
- *
16000
- * @category File Buckets
16001
- */
16002
- throwOnError() {
16003
- this.shouldThrowOnError = true;
16004
- return this;
16130
+ const finalUrl = baseUrl.href.replace(/\/$/, "");
16131
+ const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), headers);
16132
+ super(finalUrl, finalHeaders, fetch$1, "storage");
16005
16133
  }
16006
16134
  /**
16007
16135
  * Retrieves the details of all Storage buckets within an existing project.
@@ -16037,20 +16165,10 @@ var StorageBucketApi = class {
16037
16165
  */
16038
16166
  async listBuckets(options) {
16039
16167
  var _this = this;
16040
- try {
16168
+ return _this.handleOperation(async () => {
16041
16169
  const queryString = _this.listBucketOptionsToQueryString(options);
16042
- return {
16043
- data: await get(_this.fetch, `${_this.url}/bucket${queryString}`, { headers: _this.headers }),
16044
- error: null
16045
- };
16046
- } catch (error) {
16047
- if (_this.shouldThrowOnError) throw error;
16048
- if (isStorageError(error)) return {
16049
- data: null,
16050
- error
16051
- };
16052
- throw error;
16053
- }
16170
+ return await get(_this.fetch, `${_this.url}/bucket${queryString}`, { headers: _this.headers });
16171
+ });
16054
16172
  }
16055
16173
  /**
16056
16174
  * Retrieves the details of an existing Storage bucket.
@@ -16087,19 +16205,9 @@ var StorageBucketApi = class {
16087
16205
  */
16088
16206
  async getBucket(id) {
16089
16207
  var _this2 = this;
16090
- try {
16091
- return {
16092
- data: await get(_this2.fetch, `${_this2.url}/bucket/${id}`, { headers: _this2.headers }),
16093
- error: null
16094
- };
16095
- } catch (error) {
16096
- if (_this2.shouldThrowOnError) throw error;
16097
- if (isStorageError(error)) return {
16098
- data: null,
16099
- error
16100
- };
16101
- throw error;
16102
- }
16208
+ return _this2.handleOperation(async () => {
16209
+ return await get(_this2.fetch, `${_this2.url}/bucket/${id}`, { headers: _this2.headers });
16210
+ });
16103
16211
  }
16104
16212
  /**
16105
16213
  * Creates a new Storage bucket
@@ -16140,26 +16248,16 @@ var StorageBucketApi = class {
16140
16248
  */
16141
16249
  async createBucket(id, options = { public: false }) {
16142
16250
  var _this3 = this;
16143
- try {
16144
- return {
16145
- data: await post$1(_this3.fetch, `${_this3.url}/bucket`, {
16146
- id,
16147
- name: id,
16148
- type: options.type,
16149
- public: options.public,
16150
- file_size_limit: options.fileSizeLimit,
16151
- allowed_mime_types: options.allowedMimeTypes
16152
- }, { headers: _this3.headers }),
16153
- error: null
16154
- };
16155
- } catch (error) {
16156
- if (_this3.shouldThrowOnError) throw error;
16157
- if (isStorageError(error)) return {
16158
- data: null,
16159
- error
16160
- };
16161
- throw error;
16162
- }
16251
+ return _this3.handleOperation(async () => {
16252
+ return await post(_this3.fetch, `${_this3.url}/bucket`, {
16253
+ id,
16254
+ name: id,
16255
+ type: options.type,
16256
+ public: options.public,
16257
+ file_size_limit: options.fileSizeLimit,
16258
+ allowed_mime_types: options.allowedMimeTypes
16259
+ }, { headers: _this3.headers });
16260
+ });
16163
16261
  }
16164
16262
  /**
16165
16263
  * Updates a Storage bucket
@@ -16198,25 +16296,15 @@ var StorageBucketApi = class {
16198
16296
  */
16199
16297
  async updateBucket(id, options) {
16200
16298
  var _this4 = this;
16201
- try {
16202
- return {
16203
- data: await put(_this4.fetch, `${_this4.url}/bucket/${id}`, {
16204
- id,
16205
- name: id,
16206
- public: options.public,
16207
- file_size_limit: options.fileSizeLimit,
16208
- allowed_mime_types: options.allowedMimeTypes
16209
- }, { headers: _this4.headers }),
16210
- error: null
16211
- };
16212
- } catch (error) {
16213
- if (_this4.shouldThrowOnError) throw error;
16214
- if (isStorageError(error)) return {
16215
- data: null,
16216
- error
16217
- };
16218
- throw error;
16219
- }
16299
+ return _this4.handleOperation(async () => {
16300
+ return await put(_this4.fetch, `${_this4.url}/bucket/${id}`, {
16301
+ id,
16302
+ name: id,
16303
+ public: options.public,
16304
+ file_size_limit: options.fileSizeLimit,
16305
+ allowed_mime_types: options.allowedMimeTypes
16306
+ }, { headers: _this4.headers });
16307
+ });
16220
16308
  }
16221
16309
  /**
16222
16310
  * Removes all objects inside a single bucket.
@@ -16244,19 +16332,9 @@ var StorageBucketApi = class {
16244
16332
  */
16245
16333
  async emptyBucket(id) {
16246
16334
  var _this5 = this;
16247
- try {
16248
- return {
16249
- data: await post$1(_this5.fetch, `${_this5.url}/bucket/${id}/empty`, {}, { headers: _this5.headers }),
16250
- error: null
16251
- };
16252
- } catch (error) {
16253
- if (_this5.shouldThrowOnError) throw error;
16254
- if (isStorageError(error)) return {
16255
- data: null,
16256
- error
16257
- };
16258
- throw error;
16259
- }
16335
+ return _this5.handleOperation(async () => {
16336
+ return await post(_this5.fetch, `${_this5.url}/bucket/${id}/empty`, {}, { headers: _this5.headers });
16337
+ });
16260
16338
  }
16261
16339
  /**
16262
16340
  * Deletes an existing bucket. A bucket can't be deleted with existing objects inside it.
@@ -16285,19 +16363,9 @@ var StorageBucketApi = class {
16285
16363
  */
16286
16364
  async deleteBucket(id) {
16287
16365
  var _this6 = this;
16288
- try {
16289
- return {
16290
- data: await remove(_this6.fetch, `${_this6.url}/bucket/${id}`, {}, { headers: _this6.headers }),
16291
- error: null
16292
- };
16293
- } catch (error) {
16294
- if (_this6.shouldThrowOnError) throw error;
16295
- if (isStorageError(error)) return {
16296
- data: null,
16297
- error
16298
- };
16299
- throw error;
16300
- }
16366
+ return _this6.handleOperation(async () => {
16367
+ return await remove(_this6.fetch, `${_this6.url}/bucket/${id}`, {}, { headers: _this6.headers });
16368
+ });
16301
16369
  }
16302
16370
  listBucketOptionsToQueryString(options) {
16303
16371
  const params = {};
@@ -16311,7 +16379,7 @@ var StorageBucketApi = class {
16311
16379
  return Object.keys(params).length > 0 ? "?" + new URLSearchParams(params).toString() : "";
16312
16380
  }
16313
16381
  };
16314
- var StorageAnalyticsClient = class {
16382
+ var StorageAnalyticsClient = class extends BaseApiClient {
16315
16383
  /**
16316
16384
  * @alpha
16317
16385
  *
@@ -16330,25 +16398,9 @@ var StorageAnalyticsClient = class {
16330
16398
  * ```
16331
16399
  */
16332
16400
  constructor(url, headers = {}, fetch$1) {
16333
- this.shouldThrowOnError = false;
16334
- this.url = url.replace(/\/$/, "");
16335
- this.headers = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS$1), headers);
16336
- this.fetch = resolveFetch$1(fetch$1);
16337
- }
16338
- /**
16339
- * @alpha
16340
- *
16341
- * Enable throwing errors instead of returning them in the response
16342
- * When enabled, failed operations will throw instead of returning { data: null, error }
16343
- *
16344
- * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
16345
- *
16346
- * @category Analytics Buckets
16347
- * @returns This instance for method chaining
16348
- */
16349
- throwOnError() {
16350
- this.shouldThrowOnError = true;
16351
- return this;
16401
+ const finalUrl = url.replace(/\/$/, "");
16402
+ const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), headers);
16403
+ super(finalUrl, finalHeaders, fetch$1, "storage");
16352
16404
  }
16353
16405
  /**
16354
16406
  * @alpha
@@ -16386,19 +16438,9 @@ var StorageAnalyticsClient = class {
16386
16438
  */
16387
16439
  async createBucket(name) {
16388
16440
  var _this = this;
16389
- try {
16390
- return {
16391
- data: await post$1(_this.fetch, `${_this.url}/bucket`, { name }, { headers: _this.headers }),
16392
- error: null
16393
- };
16394
- } catch (error) {
16395
- if (_this.shouldThrowOnError) throw error;
16396
- if (isStorageError(error)) return {
16397
- data: null,
16398
- error
16399
- };
16400
- throw error;
16401
- }
16441
+ return _this.handleOperation(async () => {
16442
+ return await post(_this.fetch, `${_this.url}/bucket`, { name }, { headers: _this.headers });
16443
+ });
16402
16444
  }
16403
16445
  /**
16404
16446
  * @alpha
@@ -16448,7 +16490,7 @@ var StorageAnalyticsClient = class {
16448
16490
  */
16449
16491
  async listBuckets(options) {
16450
16492
  var _this2 = this;
16451
- try {
16493
+ return _this2.handleOperation(async () => {
16452
16494
  const queryParams = new URLSearchParams();
16453
16495
  if ((options === null || options === void 0 ? void 0 : options.limit) !== void 0) queryParams.set("limit", options.limit.toString());
16454
16496
  if ((options === null || options === void 0 ? void 0 : options.offset) !== void 0) queryParams.set("offset", options.offset.toString());
@@ -16457,18 +16499,8 @@ var StorageAnalyticsClient = class {
16457
16499
  if (options === null || options === void 0 ? void 0 : options.search) queryParams.set("search", options.search);
16458
16500
  const queryString = queryParams.toString();
16459
16501
  const url = queryString ? `${_this2.url}/bucket?${queryString}` : `${_this2.url}/bucket`;
16460
- return {
16461
- data: await get(_this2.fetch, url, { headers: _this2.headers }),
16462
- error: null
16463
- };
16464
- } catch (error) {
16465
- if (_this2.shouldThrowOnError) throw error;
16466
- if (isStorageError(error)) return {
16467
- data: null,
16468
- error
16469
- };
16470
- throw error;
16471
- }
16502
+ return await get(_this2.fetch, url, { headers: _this2.headers });
16503
+ });
16472
16504
  }
16473
16505
  /**
16474
16506
  * @alpha
@@ -16503,19 +16535,9 @@ var StorageAnalyticsClient = class {
16503
16535
  */
16504
16536
  async deleteBucket(bucketName) {
16505
16537
  var _this3 = this;
16506
- try {
16507
- return {
16508
- data: await remove(_this3.fetch, `${_this3.url}/bucket/${bucketName}`, {}, { headers: _this3.headers }),
16509
- error: null
16510
- };
16511
- } catch (error) {
16512
- if (_this3.shouldThrowOnError) throw error;
16513
- if (isStorageError(error)) return {
16514
- data: null,
16515
- error
16516
- };
16517
- throw error;
16518
- }
16538
+ return _this3.handleOperation(async () => {
16539
+ return await remove(_this3.fetch, `${_this3.url}/bucket/${bucketName}`, {}, { headers: _this3.headers });
16540
+ });
16519
16541
  }
16520
16542
  /**
16521
16543
  * @alpha
@@ -16652,392 +16674,154 @@ var StorageAnalyticsClient = class {
16652
16674
  },
16653
16675
  fetch: this.fetch
16654
16676
  });
16655
- const shouldThrowOnError = this.shouldThrowOnError;
16656
- return new Proxy(catalog, { get(target, prop) {
16657
- const value = target[prop];
16658
- if (typeof value !== "function") return value;
16659
- return async (...args) => {
16660
- try {
16661
- return {
16662
- data: await value.apply(target, args),
16663
- error: null
16664
- };
16665
- } catch (error) {
16666
- if (shouldThrowOnError) throw error;
16667
- return {
16668
- data: null,
16669
- error
16670
- };
16671
- }
16672
- };
16673
- } });
16674
- }
16675
- };
16676
- var DEFAULT_HEADERS = {
16677
- "X-Client-Info": `storage-js/${version2}`,
16678
- "Content-Type": "application/json"
16679
- };
16680
- var StorageVectorsError = class extends Error {
16681
- constructor(message) {
16682
- super(message);
16683
- this.__isStorageVectorsError = true;
16684
- this.name = "StorageVectorsError";
16685
- }
16686
- };
16687
- function isStorageVectorsError(error) {
16688
- return typeof error === "object" && error !== null && "__isStorageVectorsError" in error;
16689
- }
16690
- var StorageVectorsApiError = class extends StorageVectorsError {
16691
- constructor(message, status, statusCode) {
16692
- super(message);
16693
- this.name = "StorageVectorsApiError";
16694
- this.status = status;
16695
- this.statusCode = statusCode;
16696
- }
16697
- toJSON() {
16698
- return {
16699
- name: this.name,
16700
- message: this.message,
16701
- status: this.status,
16702
- statusCode: this.statusCode
16703
- };
16704
- }
16705
- };
16706
- var StorageVectorsUnknownError = class extends StorageVectorsError {
16707
- constructor(message, originalError) {
16708
- super(message);
16709
- this.name = "StorageVectorsUnknownError";
16710
- this.originalError = originalError;
16711
- }
16712
- };
16713
- var resolveFetch2 = (customFetch) => {
16714
- if (customFetch) return (...args) => customFetch(...args);
16715
- return (...args) => fetch(...args);
16716
- };
16717
- var isPlainObject = (value) => {
16718
- if (typeof value !== "object" || value === null) return false;
16719
- const prototype = Object.getPrototypeOf(value);
16720
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
16721
- };
16722
- var _getErrorMessage = (err) => err.msg || err.message || err.error_description || err.error || JSON.stringify(err);
16723
- var handleError = async (error, reject, options) => {
16724
- if (error && typeof error === "object" && "status" in error && "ok" in error && typeof error.status === "number" && !(options === null || options === void 0 ? void 0 : options.noResolveJson)) {
16725
- const status = error.status || 500;
16726
- const responseError = error;
16727
- if (typeof responseError.json === "function") responseError.json().then((err) => {
16728
- const statusCode = (err === null || err === void 0 ? void 0 : err.statusCode) || (err === null || err === void 0 ? void 0 : err.code) || status + "";
16729
- reject(new StorageVectorsApiError(_getErrorMessage(err), status, statusCode));
16730
- }).catch(() => {
16731
- const statusCode = status + "";
16732
- reject(new StorageVectorsApiError(responseError.statusText || `HTTP ${status} error`, status, statusCode));
16733
- });
16734
- else {
16735
- const statusCode = status + "";
16736
- reject(new StorageVectorsApiError(responseError.statusText || `HTTP ${status} error`, status, statusCode));
16737
- }
16738
- } else reject(new StorageVectorsUnknownError(_getErrorMessage(error), error));
16739
- };
16740
- var _getRequestParams = (method, options, parameters, body) => {
16741
- const params = {
16742
- method,
16743
- headers: (options === null || options === void 0 ? void 0 : options.headers) || {}
16744
- };
16745
- if (method === "GET" || !body) return params;
16746
- if (isPlainObject(body)) {
16747
- params.headers = _objectSpread2({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers);
16748
- params.body = JSON.stringify(body);
16749
- } else params.body = body;
16750
- return _objectSpread2(_objectSpread2({}, params), parameters);
16677
+ const shouldThrowOnError = this.shouldThrowOnError;
16678
+ return new Proxy(catalog, { get(target, prop) {
16679
+ const value = target[prop];
16680
+ if (typeof value !== "function") return value;
16681
+ return async (...args) => {
16682
+ try {
16683
+ return {
16684
+ data: await value.apply(target, args),
16685
+ error: null
16686
+ };
16687
+ } catch (error) {
16688
+ if (shouldThrowOnError) throw error;
16689
+ return {
16690
+ data: null,
16691
+ error
16692
+ };
16693
+ }
16694
+ };
16695
+ } });
16696
+ }
16751
16697
  };
16752
- async function _handleRequest(fetcher, method, url, options, parameters, body) {
16753
- return new Promise((resolve, reject) => {
16754
- fetcher(url, _getRequestParams(method, options, parameters, body)).then((result) => {
16755
- if (!result.ok) throw result;
16756
- if (options === null || options === void 0 ? void 0 : options.noResolveJson) return result;
16757
- const contentType = result.headers.get("content-type");
16758
- if (!contentType || !contentType.includes("application/json")) return {};
16759
- return result.json();
16760
- }).then((data) => resolve(data)).catch((error) => handleError(error, reject, options));
16761
- });
16762
- }
16763
- async function post(fetcher, url, body, options, parameters) {
16764
- return _handleRequest(fetcher, "POST", url, options, parameters, body);
16765
- }
16766
- var VectorIndexApi = class {
16698
+ var VectorIndexApi = class extends BaseApiClient {
16767
16699
  /** Creates a new VectorIndexApi instance */
16768
16700
  constructor(url, headers = {}, fetch$1) {
16769
- this.shouldThrowOnError = false;
16770
- this.url = url.replace(/\/$/, "");
16771
- this.headers = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS), headers);
16772
- this.fetch = resolveFetch2(fetch$1);
16773
- }
16774
- /** Enable throwing errors instead of returning them in the response */
16775
- throwOnError() {
16776
- this.shouldThrowOnError = true;
16777
- return this;
16701
+ const finalUrl = url.replace(/\/$/, "");
16702
+ const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers);
16703
+ super(finalUrl, finalHeaders, fetch$1, "vectors");
16778
16704
  }
16779
16705
  /** Creates a new vector index within a bucket */
16780
16706
  async createIndex(options) {
16781
16707
  var _this = this;
16782
- try {
16783
- return {
16784
- data: await post(_this.fetch, `${_this.url}/CreateIndex`, options, { headers: _this.headers }) || {},
16785
- error: null
16786
- };
16787
- } catch (error) {
16788
- if (_this.shouldThrowOnError) throw error;
16789
- if (isStorageVectorsError(error)) return {
16790
- data: null,
16791
- error
16792
- };
16793
- throw error;
16794
- }
16708
+ return _this.handleOperation(async () => {
16709
+ return await vectorsApi.post(_this.fetch, `${_this.url}/CreateIndex`, options, { headers: _this.headers }) || {};
16710
+ });
16795
16711
  }
16796
16712
  /** Retrieves metadata for a specific vector index */
16797
16713
  async getIndex(vectorBucketName, indexName) {
16798
16714
  var _this2 = this;
16799
- try {
16800
- return {
16801
- data: await post(_this2.fetch, `${_this2.url}/GetIndex`, {
16802
- vectorBucketName,
16803
- indexName
16804
- }, { headers: _this2.headers }),
16805
- error: null
16806
- };
16807
- } catch (error) {
16808
- if (_this2.shouldThrowOnError) throw error;
16809
- if (isStorageVectorsError(error)) return {
16810
- data: null,
16811
- error
16812
- };
16813
- throw error;
16814
- }
16715
+ return _this2.handleOperation(async () => {
16716
+ return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetIndex`, {
16717
+ vectorBucketName,
16718
+ indexName
16719
+ }, { headers: _this2.headers });
16720
+ });
16815
16721
  }
16816
16722
  /** Lists vector indexes within a bucket with optional filtering and pagination */
16817
16723
  async listIndexes(options) {
16818
16724
  var _this3 = this;
16819
- try {
16820
- return {
16821
- data: await post(_this3.fetch, `${_this3.url}/ListIndexes`, options, { headers: _this3.headers }),
16822
- error: null
16823
- };
16824
- } catch (error) {
16825
- if (_this3.shouldThrowOnError) throw error;
16826
- if (isStorageVectorsError(error)) return {
16827
- data: null,
16828
- error
16829
- };
16830
- throw error;
16831
- }
16725
+ return _this3.handleOperation(async () => {
16726
+ return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListIndexes`, options, { headers: _this3.headers });
16727
+ });
16832
16728
  }
16833
16729
  /** Deletes a vector index and all its data */
16834
16730
  async deleteIndex(vectorBucketName, indexName) {
16835
16731
  var _this4 = this;
16836
- try {
16837
- return {
16838
- data: await post(_this4.fetch, `${_this4.url}/DeleteIndex`, {
16839
- vectorBucketName,
16840
- indexName
16841
- }, { headers: _this4.headers }) || {},
16842
- error: null
16843
- };
16844
- } catch (error) {
16845
- if (_this4.shouldThrowOnError) throw error;
16846
- if (isStorageVectorsError(error)) return {
16847
- data: null,
16848
- error
16849
- };
16850
- throw error;
16851
- }
16732
+ return _this4.handleOperation(async () => {
16733
+ return await vectorsApi.post(_this4.fetch, `${_this4.url}/DeleteIndex`, {
16734
+ vectorBucketName,
16735
+ indexName
16736
+ }, { headers: _this4.headers }) || {};
16737
+ });
16852
16738
  }
16853
16739
  };
16854
- var VectorDataApi = class {
16740
+ var VectorDataApi = class extends BaseApiClient {
16855
16741
  /** Creates a new VectorDataApi instance */
16856
16742
  constructor(url, headers = {}, fetch$1) {
16857
- this.shouldThrowOnError = false;
16858
- this.url = url.replace(/\/$/, "");
16859
- this.headers = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS), headers);
16860
- this.fetch = resolveFetch2(fetch$1);
16861
- }
16862
- /** Enable throwing errors instead of returning them in the response */
16863
- throwOnError() {
16864
- this.shouldThrowOnError = true;
16865
- return this;
16743
+ const finalUrl = url.replace(/\/$/, "");
16744
+ const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers);
16745
+ super(finalUrl, finalHeaders, fetch$1, "vectors");
16866
16746
  }
16867
16747
  /** Inserts or updates vectors in batch (1-500 per request) */
16868
16748
  async putVectors(options) {
16869
16749
  var _this = this;
16870
- try {
16871
- if (options.vectors.length < 1 || options.vectors.length > 500) throw new Error("Vector batch size must be between 1 and 500 items");
16872
- return {
16873
- data: await post(_this.fetch, `${_this.url}/PutVectors`, options, { headers: _this.headers }) || {},
16874
- error: null
16875
- };
16876
- } catch (error) {
16877
- if (_this.shouldThrowOnError) throw error;
16878
- if (isStorageVectorsError(error)) return {
16879
- data: null,
16880
- error
16881
- };
16882
- throw error;
16883
- }
16750
+ if (options.vectors.length < 1 || options.vectors.length > 500) throw new Error("Vector batch size must be between 1 and 500 items");
16751
+ return _this.handleOperation(async () => {
16752
+ return await vectorsApi.post(_this.fetch, `${_this.url}/PutVectors`, options, { headers: _this.headers }) || {};
16753
+ });
16884
16754
  }
16885
16755
  /** Retrieves vectors by their keys in batch */
16886
16756
  async getVectors(options) {
16887
16757
  var _this2 = this;
16888
- try {
16889
- return {
16890
- data: await post(_this2.fetch, `${_this2.url}/GetVectors`, options, { headers: _this2.headers }),
16891
- error: null
16892
- };
16893
- } catch (error) {
16894
- if (_this2.shouldThrowOnError) throw error;
16895
- if (isStorageVectorsError(error)) return {
16896
- data: null,
16897
- error
16898
- };
16899
- throw error;
16900
- }
16758
+ return _this2.handleOperation(async () => {
16759
+ return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetVectors`, options, { headers: _this2.headers });
16760
+ });
16901
16761
  }
16902
16762
  /** Lists vectors in an index with pagination */
16903
16763
  async listVectors(options) {
16904
16764
  var _this3 = this;
16905
- try {
16906
- if (options.segmentCount !== void 0) {
16907
- if (options.segmentCount < 1 || options.segmentCount > 16) throw new Error("segmentCount must be between 1 and 16");
16908
- if (options.segmentIndex !== void 0) {
16909
- if (options.segmentIndex < 0 || options.segmentIndex >= options.segmentCount) throw new Error(`segmentIndex must be between 0 and ${options.segmentCount - 1}`);
16910
- }
16765
+ if (options.segmentCount !== void 0) {
16766
+ if (options.segmentCount < 1 || options.segmentCount > 16) throw new Error("segmentCount must be between 1 and 16");
16767
+ if (options.segmentIndex !== void 0) {
16768
+ if (options.segmentIndex < 0 || options.segmentIndex >= options.segmentCount) throw new Error(`segmentIndex must be between 0 and ${options.segmentCount - 1}`);
16911
16769
  }
16912
- return {
16913
- data: await post(_this3.fetch, `${_this3.url}/ListVectors`, options, { headers: _this3.headers }),
16914
- error: null
16915
- };
16916
- } catch (error) {
16917
- if (_this3.shouldThrowOnError) throw error;
16918
- if (isStorageVectorsError(error)) return {
16919
- data: null,
16920
- error
16921
- };
16922
- throw error;
16923
16770
  }
16771
+ return _this3.handleOperation(async () => {
16772
+ return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListVectors`, options, { headers: _this3.headers });
16773
+ });
16924
16774
  }
16925
16775
  /** Queries for similar vectors using approximate nearest neighbor search */
16926
16776
  async queryVectors(options) {
16927
16777
  var _this4 = this;
16928
- try {
16929
- return {
16930
- data: await post(_this4.fetch, `${_this4.url}/QueryVectors`, options, { headers: _this4.headers }),
16931
- error: null
16932
- };
16933
- } catch (error) {
16934
- if (_this4.shouldThrowOnError) throw error;
16935
- if (isStorageVectorsError(error)) return {
16936
- data: null,
16937
- error
16938
- };
16939
- throw error;
16940
- }
16778
+ return _this4.handleOperation(async () => {
16779
+ return await vectorsApi.post(_this4.fetch, `${_this4.url}/QueryVectors`, options, { headers: _this4.headers });
16780
+ });
16941
16781
  }
16942
16782
  /** Deletes vectors by their keys in batch (1-500 per request) */
16943
16783
  async deleteVectors(options) {
16944
16784
  var _this5 = this;
16945
- try {
16946
- if (options.keys.length < 1 || options.keys.length > 500) throw new Error("Keys batch size must be between 1 and 500 items");
16947
- return {
16948
- data: await post(_this5.fetch, `${_this5.url}/DeleteVectors`, options, { headers: _this5.headers }) || {},
16949
- error: null
16950
- };
16951
- } catch (error) {
16952
- if (_this5.shouldThrowOnError) throw error;
16953
- if (isStorageVectorsError(error)) return {
16954
- data: null,
16955
- error
16956
- };
16957
- throw error;
16958
- }
16785
+ if (options.keys.length < 1 || options.keys.length > 500) throw new Error("Keys batch size must be between 1 and 500 items");
16786
+ return _this5.handleOperation(async () => {
16787
+ return await vectorsApi.post(_this5.fetch, `${_this5.url}/DeleteVectors`, options, { headers: _this5.headers }) || {};
16788
+ });
16959
16789
  }
16960
16790
  };
16961
- var VectorBucketApi = class {
16791
+ var VectorBucketApi = class extends BaseApiClient {
16962
16792
  /** Creates a new VectorBucketApi instance */
16963
16793
  constructor(url, headers = {}, fetch$1) {
16964
- this.shouldThrowOnError = false;
16965
- this.url = url.replace(/\/$/, "");
16966
- this.headers = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS), headers);
16967
- this.fetch = resolveFetch2(fetch$1);
16968
- }
16969
- /** Enable throwing errors instead of returning them in the response */
16970
- throwOnError() {
16971
- this.shouldThrowOnError = true;
16972
- return this;
16794
+ const finalUrl = url.replace(/\/$/, "");
16795
+ const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers);
16796
+ super(finalUrl, finalHeaders, fetch$1, "vectors");
16973
16797
  }
16974
16798
  /** Creates a new vector bucket */
16975
16799
  async createBucket(vectorBucketName) {
16976
16800
  var _this = this;
16977
- try {
16978
- return {
16979
- data: await post(_this.fetch, `${_this.url}/CreateVectorBucket`, { vectorBucketName }, { headers: _this.headers }) || {},
16980
- error: null
16981
- };
16982
- } catch (error) {
16983
- if (_this.shouldThrowOnError) throw error;
16984
- if (isStorageVectorsError(error)) return {
16985
- data: null,
16986
- error
16987
- };
16988
- throw error;
16989
- }
16801
+ return _this.handleOperation(async () => {
16802
+ return await vectorsApi.post(_this.fetch, `${_this.url}/CreateVectorBucket`, { vectorBucketName }, { headers: _this.headers }) || {};
16803
+ });
16990
16804
  }
16991
16805
  /** Retrieves metadata for a specific vector bucket */
16992
16806
  async getBucket(vectorBucketName) {
16993
16807
  var _this2 = this;
16994
- try {
16995
- return {
16996
- data: await post(_this2.fetch, `${_this2.url}/GetVectorBucket`, { vectorBucketName }, { headers: _this2.headers }),
16997
- error: null
16998
- };
16999
- } catch (error) {
17000
- if (_this2.shouldThrowOnError) throw error;
17001
- if (isStorageVectorsError(error)) return {
17002
- data: null,
17003
- error
17004
- };
17005
- throw error;
17006
- }
16808
+ return _this2.handleOperation(async () => {
16809
+ return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetVectorBucket`, { vectorBucketName }, { headers: _this2.headers });
16810
+ });
17007
16811
  }
17008
16812
  /** Lists vector buckets with optional filtering and pagination */
17009
16813
  async listBuckets(options = {}) {
17010
16814
  var _this3 = this;
17011
- try {
17012
- return {
17013
- data: await post(_this3.fetch, `${_this3.url}/ListVectorBuckets`, options, { headers: _this3.headers }),
17014
- error: null
17015
- };
17016
- } catch (error) {
17017
- if (_this3.shouldThrowOnError) throw error;
17018
- if (isStorageVectorsError(error)) return {
17019
- data: null,
17020
- error
17021
- };
17022
- throw error;
17023
- }
16815
+ return _this3.handleOperation(async () => {
16816
+ return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListVectorBuckets`, options, { headers: _this3.headers });
16817
+ });
17024
16818
  }
17025
16819
  /** Deletes a vector bucket (must be empty first) */
17026
16820
  async deleteBucket(vectorBucketName) {
17027
16821
  var _this4 = this;
17028
- try {
17029
- return {
17030
- data: await post(_this4.fetch, `${_this4.url}/DeleteVectorBucket`, { vectorBucketName }, { headers: _this4.headers }) || {},
17031
- error: null
17032
- };
17033
- } catch (error) {
17034
- if (_this4.shouldThrowOnError) throw error;
17035
- if (isStorageVectorsError(error)) return {
17036
- data: null,
17037
- error
17038
- };
17039
- throw error;
17040
- }
16822
+ return _this4.handleOperation(async () => {
16823
+ return await vectorsApi.post(_this4.fetch, `${_this4.url}/DeleteVectorBucket`, { vectorBucketName }, { headers: _this4.headers }) || {};
16824
+ });
17041
16825
  }
17042
16826
  };
17043
16827
  var StorageVectorsClient = class extends VectorBucketApi {
@@ -17234,7 +17018,7 @@ var VectorBucketScope = class extends VectorIndexApi {
17234
17018
  */
17235
17019
  async createIndex(options) {
17236
17020
  var _superprop_getCreateIndex = () => super.createIndex, _this5 = this;
17237
- return _superprop_getCreateIndex().call(_this5, _objectSpread2(_objectSpread2({}, options), {}, { vectorBucketName: _this5.vectorBucketName }));
17021
+ return _superprop_getCreateIndex().call(_this5, _objectSpread22(_objectSpread22({}, options), {}, { vectorBucketName: _this5.vectorBucketName }));
17238
17022
  }
17239
17023
  /**
17240
17024
  *
@@ -17257,7 +17041,7 @@ var VectorBucketScope = class extends VectorIndexApi {
17257
17041
  */
17258
17042
  async listIndexes(options = {}) {
17259
17043
  var _superprop_getListIndexes = () => super.listIndexes, _this6 = this;
17260
- return _superprop_getListIndexes().call(_this6, _objectSpread2(_objectSpread2({}, options), {}, { vectorBucketName: _this6.vectorBucketName }));
17044
+ return _superprop_getListIndexes().call(_this6, _objectSpread22(_objectSpread22({}, options), {}, { vectorBucketName: _this6.vectorBucketName }));
17261
17045
  }
17262
17046
  /**
17263
17047
  *
@@ -17390,7 +17174,7 @@ var VectorIndexScope = class extends VectorDataApi {
17390
17174
  */
17391
17175
  async putVectors(options) {
17392
17176
  var _superprop_getPutVectors = () => super.putVectors, _this9 = this;
17393
- return _superprop_getPutVectors().call(_this9, _objectSpread2(_objectSpread2({}, options), {}, {
17177
+ return _superprop_getPutVectors().call(_this9, _objectSpread22(_objectSpread22({}, options), {}, {
17394
17178
  vectorBucketName: _this9.vectorBucketName,
17395
17179
  indexName: _this9.indexName
17396
17180
  }));
@@ -17419,7 +17203,7 @@ var VectorIndexScope = class extends VectorDataApi {
17419
17203
  */
17420
17204
  async getVectors(options) {
17421
17205
  var _superprop_getGetVectors = () => super.getVectors, _this10 = this;
17422
- return _superprop_getGetVectors().call(_this10, _objectSpread2(_objectSpread2({}, options), {}, {
17206
+ return _superprop_getGetVectors().call(_this10, _objectSpread22(_objectSpread22({}, options), {}, {
17423
17207
  vectorBucketName: _this10.vectorBucketName,
17424
17208
  indexName: _this10.indexName
17425
17209
  }));
@@ -17448,7 +17232,7 @@ var VectorIndexScope = class extends VectorDataApi {
17448
17232
  */
17449
17233
  async listVectors(options = {}) {
17450
17234
  var _superprop_getListVectors = () => super.listVectors, _this11 = this;
17451
- return _superprop_getListVectors().call(_this11, _objectSpread2(_objectSpread2({}, options), {}, {
17235
+ return _superprop_getListVectors().call(_this11, _objectSpread22(_objectSpread22({}, options), {}, {
17452
17236
  vectorBucketName: _this11.vectorBucketName,
17453
17237
  indexName: _this11.indexName
17454
17238
  }));
@@ -17480,7 +17264,7 @@ var VectorIndexScope = class extends VectorDataApi {
17480
17264
  */
17481
17265
  async queryVectors(options) {
17482
17266
  var _superprop_getQueryVectors = () => super.queryVectors, _this12 = this;
17483
- return _superprop_getQueryVectors().call(_this12, _objectSpread2(_objectSpread2({}, options), {}, {
17267
+ return _superprop_getQueryVectors().call(_this12, _objectSpread22(_objectSpread22({}, options), {}, {
17484
17268
  vectorBucketName: _this12.vectorBucketName,
17485
17269
  indexName: _this12.indexName
17486
17270
  }));
@@ -17508,7 +17292,7 @@ var VectorIndexScope = class extends VectorDataApi {
17508
17292
  */
17509
17293
  async deleteVectors(options) {
17510
17294
  var _superprop_getDeleteVectors = () => super.deleteVectors, _this13 = this;
17511
- return _superprop_getDeleteVectors().call(_this13, _objectSpread2(_objectSpread2({}, options), {}, {
17295
+ return _superprop_getDeleteVectors().call(_this13, _objectSpread22(_objectSpread22({}, options), {}, {
17512
17296
  vectorBucketName: _this13.vectorBucketName,
17513
17297
  indexName: _this13.indexName
17514
17298
  }));
@@ -17579,10 +17363,10 @@ var StorageClient = class extends StorageBucketApi {
17579
17363
  }
17580
17364
  };
17581
17365
 
17582
- // node_modules/@supabase/auth-js/dist/module/lib/version.js
17583
- var version3 = "2.91.0";
17366
+ // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/version.js
17367
+ var version3 = "2.95.1";
17584
17368
 
17585
- // node_modules/@supabase/auth-js/dist/module/lib/constants.js
17369
+ // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/constants.js
17586
17370
  var AUTO_REFRESH_TICK_DURATION_MS = 30 * 1e3;
17587
17371
  var AUTO_REFRESH_TICK_THRESHOLD = 3;
17588
17372
  var EXPIRY_MARGIN_MS = AUTO_REFRESH_TICK_THRESHOLD * AUTO_REFRESH_TICK_DURATION_MS;
@@ -17599,7 +17383,7 @@ var API_VERSIONS = {
17599
17383
  var BASE64URL_REGEX = /^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i;
17600
17384
  var JWKS_TTL = 10 * 60 * 1e3;
17601
17385
 
17602
- // node_modules/@supabase/auth-js/dist/module/lib/errors.js
17386
+ // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/errors.js
17603
17387
  var AuthError = class extends Error {
17604
17388
  constructor(message, status, code) {
17605
17389
  super(message);
@@ -17713,7 +17497,7 @@ var AuthInvalidJwtError = class extends CustomAuthError {
17713
17497
  }
17714
17498
  };
17715
17499
 
17716
- // node_modules/@supabase/auth-js/dist/module/lib/base64url.js
17500
+ // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/base64url.js
17717
17501
  var TO_BASE64URL = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split("");
17718
17502
  var IGNORE_BASE64URL = " \n\r=".split("");
17719
17503
  var FROM_BASE64URL = (() => {
@@ -17875,7 +17659,7 @@ function bytesToBase64URL(bytes) {
17875
17659
  return result.join("");
17876
17660
  }
17877
17661
 
17878
- // node_modules/@supabase/auth-js/dist/module/lib/helpers.js
17662
+ // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/helpers.js
17879
17663
  function expiresAt(expiresIn) {
17880
17664
  const timeNow = Math.round(Date.now() / 1e3);
17881
17665
  return timeNow + expiresIn;
@@ -18157,7 +17941,7 @@ function deepClone(obj) {
18157
17941
  return JSON.parse(JSON.stringify(obj));
18158
17942
  }
18159
17943
 
18160
- // node_modules/@supabase/auth-js/dist/module/lib/fetch.js
17944
+ // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/fetch.js
18161
17945
  var _getErrorMessage2 = (err) => err.msg || err.message || err.error_description || err.error || JSON.stringify(err);
18162
17946
  var NETWORK_ERROR_CODES = [502, 503, 504];
18163
17947
  async function handleError2(error) {
@@ -18294,10 +18078,10 @@ function hasSession(data) {
18294
18078
  return data.access_token && data.refresh_token && data.expires_in;
18295
18079
  }
18296
18080
 
18297
- // node_modules/@supabase/auth-js/dist/module/lib/types.js
18081
+ // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/types.js
18298
18082
  var SIGN_OUT_SCOPES = ["global", "local", "others"];
18299
18083
 
18300
- // node_modules/@supabase/auth-js/dist/module/GoTrueAdminApi.js
18084
+ // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/GoTrueAdminApi.js
18301
18085
  var GoTrueAdminApi = class {
18302
18086
  /**
18303
18087
  * Creates an admin API client that can be used to manage users and OAuth clients.
@@ -18714,7 +18498,7 @@ var GoTrueAdminApi = class {
18714
18498
  }
18715
18499
  };
18716
18500
 
18717
- // node_modules/@supabase/auth-js/dist/module/lib/local-storage.js
18501
+ // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/local-storage.js
18718
18502
  function memoryLocalStorageAdapter(store = {}) {
18719
18503
  return {
18720
18504
  getItem: (key) => {
@@ -18729,7 +18513,7 @@ function memoryLocalStorageAdapter(store = {}) {
18729
18513
  };
18730
18514
  }
18731
18515
 
18732
- // node_modules/@supabase/auth-js/dist/module/lib/locks.js
18516
+ // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/locks.js
18733
18517
  var internals = {
18734
18518
  /**
18735
18519
  * @experimental
@@ -18797,7 +18581,7 @@ async function navigatorLock(name, acquireTimeout, fn) {
18797
18581
  }));
18798
18582
  }
18799
18583
 
18800
- // node_modules/@supabase/auth-js/dist/module/lib/polyfills.js
18584
+ // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/polyfills.js
18801
18585
  function polyfillGlobalThis() {
18802
18586
  if (typeof globalThis === "object")
18803
18587
  return;
@@ -18817,7 +18601,7 @@ function polyfillGlobalThis() {
18817
18601
  }
18818
18602
  }
18819
18603
 
18820
- // node_modules/@supabase/auth-js/dist/module/lib/web3/ethereum.js
18604
+ // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/web3/ethereum.js
18821
18605
  function getAddress(address) {
18822
18606
  if (!/^0x[a-fA-F0-9]{40}$/.test(address)) {
18823
18607
  throw new Error(`@supabase/auth-js: Address "${address}" is invalid.`);
@@ -18885,7 +18669,7 @@ Request ID: ${requestId}`;
18885
18669
  ${suffix}`;
18886
18670
  }
18887
18671
 
18888
- // node_modules/@supabase/auth-js/dist/module/lib/webauthn.errors.js
18672
+ // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/webauthn.errors.js
18889
18673
  var WebAuthnError = class extends Error {
18890
18674
  constructor({ message, code, cause, name }) {
18891
18675
  var _a78;
@@ -19053,7 +18837,7 @@ function identifyAuthenticationError({ error, options }) {
19053
18837
  });
19054
18838
  }
19055
18839
 
19056
- // node_modules/@supabase/auth-js/dist/module/lib/webauthn.js
18840
+ // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/webauthn.js
19057
18841
  var WebAuthnAbortService = class {
19058
18842
  /**
19059
18843
  * Create an abort signal for a new WebAuthn operation.
@@ -19348,6 +19132,7 @@ var WebAuthnApi = class {
19348
19132
  * @see {@link https://w3c.github.io/webauthn/#sctn-verifying-assertion W3C WebAuthn Spec - Verifying Assertion}
19349
19133
  */
19350
19134
  async _challenge({ factorId, webauthn, friendlyName, signal }, overrides) {
19135
+ var _a78;
19351
19136
  try {
19352
19137
  const { data: challengeResponse, error: challengeError } = await this.client.mfa.challenge({
19353
19138
  factorId,
@@ -19360,7 +19145,15 @@ var WebAuthnApi = class {
19360
19145
  if (challengeResponse.webauthn.type === "create") {
19361
19146
  const { user } = challengeResponse.webauthn.credential_options.publicKey;
19362
19147
  if (!user.name) {
19363
- user.name = `${user.id}:${friendlyName}`;
19148
+ const nameToUse = friendlyName;
19149
+ if (!nameToUse) {
19150
+ const currentUser = await this.client.getUser();
19151
+ const userData = currentUser.data.user;
19152
+ const fallbackName = ((_a78 = userData === null || userData === void 0 ? void 0 : userData.user_metadata) === null || _a78 === void 0 ? void 0 : _a78.name) || (userData === null || userData === void 0 ? void 0 : userData.email) || (userData === null || userData === void 0 ? void 0 : userData.id) || "User";
19153
+ user.name = `${user.id}:${fallbackName}`;
19154
+ } else {
19155
+ user.name = `${user.id}:${nameToUse}`;
19156
+ }
19364
19157
  }
19365
19158
  if (!user.displayName) {
19366
19159
  user.displayName = user.name;
@@ -19567,7 +19360,7 @@ var WebAuthnApi = class {
19567
19360
  }
19568
19361
  };
19569
19362
 
19570
- // node_modules/@supabase/auth-js/dist/module/GoTrueClient.js
19363
+ // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/GoTrueClient.js
19571
19364
  polyfillGlobalThis();
19572
19365
  var DEFAULT_OPTIONS = {
19573
19366
  url: GOTRUE_URL,
@@ -19721,10 +19514,16 @@ var GoTrueClient = class _GoTrueClient {
19721
19514
  }
19722
19515
  (_c = this.broadcastChannel) === null || _c === void 0 ? void 0 : _c.addEventListener("message", async (event) => {
19723
19516
  this._debug("received broadcast notification from other tab or client", event);
19724
- await this._notifyAllSubscribers(event.data.event, event.data.session, false);
19517
+ try {
19518
+ await this._notifyAllSubscribers(event.data.event, event.data.session, false);
19519
+ } catch (error) {
19520
+ this._debug("#broadcastChannel", "error", error);
19521
+ }
19725
19522
  });
19726
19523
  }
19727
- this.initialize();
19524
+ this.initialize().catch((error) => {
19525
+ this._debug("#initialize()", "error", error);
19526
+ });
19728
19527
  }
19729
19528
  /**
19730
19529
  * Returns whether error throwing mode is enabled for this client.
@@ -20247,9 +20046,7 @@ var GoTrueClient = class _GoTrueClient {
20247
20046
  }
20248
20047
  if (data.session) {
20249
20048
  await this._saveSession(data.session);
20250
- setTimeout(async () => {
20251
- await this._notifyAllSubscribers("SIGNED_IN", data.session);
20252
- }, 0);
20049
+ await this._notifyAllSubscribers("SIGNED_IN", data.session);
20253
20050
  }
20254
20051
  return this._returnResult({ data: Object.assign(Object.assign({}, data), { redirectType: redirectType !== null && redirectType !== void 0 ? redirectType : null }), error });
20255
20052
  } catch (error) {
@@ -20796,7 +20593,7 @@ var GoTrueClient = class _GoTrueClient {
20796
20593
  } else {
20797
20594
  const { data, error } = await this._getUser(currentSession.access_token);
20798
20595
  if (error) {
20799
- throw error;
20596
+ return this._returnResult({ data: { user: null, session: null }, error });
20800
20597
  }
20801
20598
  session = {
20802
20599
  access_token: currentSession.access_token,
@@ -20978,14 +20775,14 @@ var GoTrueClient = class _GoTrueClient {
20978
20775
  return await this._useSession(async (result) => {
20979
20776
  var _a78;
20980
20777
  const { data, error: sessionError } = result;
20981
- if (sessionError) {
20778
+ if (sessionError && !isAuthSessionMissingError(sessionError)) {
20982
20779
  return this._returnResult({ error: sessionError });
20983
20780
  }
20984
20781
  const accessToken = (_a78 = data.session) === null || _a78 === void 0 ? void 0 : _a78.access_token;
20985
20782
  if (accessToken) {
20986
20783
  const { error } = await this.admin.signOut(accessToken, scope);
20987
20784
  if (error) {
20988
- if (!(isAuthApiError(error) && (error.status === 404 || error.status === 401 || error.status === 403))) {
20785
+ if (!(isAuthApiError(error) && (error.status === 404 || error.status === 401 || error.status === 403) || isAuthSessionMissingError(error))) {
20989
20786
  return this._returnResult({ error });
20990
20787
  }
20991
20788
  }
@@ -21572,7 +21369,13 @@ var GoTrueClient = class _GoTrueClient {
21572
21369
  return false;
21573
21370
  }
21574
21371
  try {
21575
- this.visibilityChangedCallback = async () => await this._onVisibilityChanged(false);
21372
+ this.visibilityChangedCallback = async () => {
21373
+ try {
21374
+ await this._onVisibilityChanged(false);
21375
+ } catch (error) {
21376
+ this._debug("#visibilityChangedCallback", "error", error);
21377
+ }
21378
+ };
21576
21379
  window === null || window === void 0 ? void 0 : window.addEventListener("visibilitychange", this.visibilityChangedCallback);
21577
21380
  await this._onVisibilityChanged(true);
21578
21381
  } catch (error) {
@@ -21805,8 +21608,33 @@ var GoTrueClient = class _GoTrueClient {
21805
21608
  /**
21806
21609
  * {@see GoTrueMFAApi#getAuthenticatorAssuranceLevel}
21807
21610
  */
21808
- async _getAuthenticatorAssuranceLevel() {
21809
- var _a78, _b7;
21611
+ async _getAuthenticatorAssuranceLevel(jwt) {
21612
+ var _a78, _b7, _c, _d;
21613
+ if (jwt) {
21614
+ try {
21615
+ const { payload: payload2 } = decodeJWT(jwt);
21616
+ let currentLevel2 = null;
21617
+ if (payload2.aal) {
21618
+ currentLevel2 = payload2.aal;
21619
+ }
21620
+ let nextLevel2 = currentLevel2;
21621
+ const { data: { user }, error: userError } = await this.getUser(jwt);
21622
+ if (userError) {
21623
+ return this._returnResult({ data: null, error: userError });
21624
+ }
21625
+ const verifiedFactors2 = (_b7 = (_a78 = user === null || user === void 0 ? void 0 : user.factors) === null || _a78 === void 0 ? void 0 : _a78.filter((factor) => factor.status === "verified")) !== null && _b7 !== void 0 ? _b7 : [];
21626
+ if (verifiedFactors2.length > 0) {
21627
+ nextLevel2 = "aal2";
21628
+ }
21629
+ const currentAuthenticationMethods2 = payload2.amr || [];
21630
+ return { data: { currentLevel: currentLevel2, nextLevel: nextLevel2, currentAuthenticationMethods: currentAuthenticationMethods2 }, error: null };
21631
+ } catch (error) {
21632
+ if (isAuthError(error)) {
21633
+ return this._returnResult({ data: null, error });
21634
+ }
21635
+ throw error;
21636
+ }
21637
+ }
21810
21638
  const { data: { session }, error: sessionError } = await this.getSession();
21811
21639
  if (sessionError) {
21812
21640
  return this._returnResult({ data: null, error: sessionError });
@@ -21823,7 +21651,7 @@ var GoTrueClient = class _GoTrueClient {
21823
21651
  currentLevel = payload.aal;
21824
21652
  }
21825
21653
  let nextLevel = currentLevel;
21826
- const verifiedFactors = (_b7 = (_a78 = session.user.factors) === null || _a78 === void 0 ? void 0 : _a78.filter((factor) => factor.status === "verified")) !== null && _b7 !== void 0 ? _b7 : [];
21654
+ const verifiedFactors = (_d = (_c = session.user.factors) === null || _c === void 0 ? void 0 : _c.filter((factor) => factor.status === "verified")) !== null && _d !== void 0 ? _d : [];
21827
21655
  if (verifiedFactors.length > 0) {
21828
21656
  nextLevel = "aal2";
21829
21657
  }
@@ -21835,7 +21663,7 @@ var GoTrueClient = class _GoTrueClient {
21835
21663
  * Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
21836
21664
  *
21837
21665
  * Returns authorization details including client info, scopes, and user information.
21838
- * If the API returns a redirect_uri, it means consent was already given - the caller
21666
+ * If the response includes only a redirect_url field, it means consent was already given - the caller
21839
21667
  * should handle the redirect manually if needed.
21840
21668
  */
21841
21669
  async _getAuthorizationDetails(authorizationId) {
@@ -22084,12 +21912,12 @@ var GoTrueClient = class _GoTrueClient {
22084
21912
  GoTrueClient.nextInstanceID = {};
22085
21913
  var GoTrueClient_default = GoTrueClient;
22086
21914
 
22087
- // node_modules/@supabase/auth-js/dist/module/AuthClient.js
21915
+ // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/AuthClient.js
22088
21916
  var AuthClient = GoTrueClient_default;
22089
21917
  var AuthClient_default = AuthClient;
22090
21918
 
22091
- // node_modules/@supabase/supabase-js/dist/index.mjs
22092
- var version4 = "2.91.0";
21919
+ // node_modules/.pnpm/@supabase+supabase-js@2.95.1/node_modules/@supabase/supabase-js/dist/index.mjs
21920
+ var version4 = "2.95.1";
22093
21921
  var JS_ENV = "";
22094
21922
  if (typeof Deno !== "undefined") JS_ENV = "deno";
22095
21923
  else if (typeof document !== "undefined") JS_ENV = "web";
@@ -22105,37 +21933,37 @@ var DEFAULT_AUTH_OPTIONS = {
22105
21933
  flowType: "implicit"
22106
21934
  };
22107
21935
  var DEFAULT_REALTIME_OPTIONS = {};
22108
- function _typeof2(o) {
21936
+ function _typeof3(o) {
22109
21937
  "@babel/helpers - typeof";
22110
- return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
21938
+ return _typeof3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
22111
21939
  return typeof o$1;
22112
21940
  } : function(o$1) {
22113
21941
  return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
22114
- }, _typeof2(o);
21942
+ }, _typeof3(o);
22115
21943
  }
22116
- function toPrimitive2(t, r) {
22117
- if ("object" != _typeof2(t) || !t) return t;
21944
+ function toPrimitive3(t, r) {
21945
+ if ("object" != _typeof3(t) || !t) return t;
22118
21946
  var e = t[Symbol.toPrimitive];
22119
21947
  if (void 0 !== e) {
22120
21948
  var i = e.call(t, r || "default");
22121
- if ("object" != _typeof2(i)) return i;
21949
+ if ("object" != _typeof3(i)) return i;
22122
21950
  throw new TypeError("@@toPrimitive must return a primitive value.");
22123
21951
  }
22124
21952
  return ("string" === r ? String : Number)(t);
22125
21953
  }
22126
- function toPropertyKey2(t) {
22127
- var i = toPrimitive2(t, "string");
22128
- return "symbol" == _typeof2(i) ? i : i + "";
21954
+ function toPropertyKey3(t) {
21955
+ var i = toPrimitive3(t, "string");
21956
+ return "symbol" == _typeof3(i) ? i : i + "";
22129
21957
  }
22130
- function _defineProperty2(e, r, t) {
22131
- return (r = toPropertyKey2(r)) in e ? Object.defineProperty(e, r, {
21958
+ function _defineProperty3(e, r, t) {
21959
+ return (r = toPropertyKey3(r)) in e ? Object.defineProperty(e, r, {
22132
21960
  value: t,
22133
21961
  enumerable: true,
22134
21962
  configurable: true,
22135
21963
  writable: true
22136
21964
  }) : e[r] = t, e;
22137
21965
  }
22138
- function ownKeys2(e, r) {
21966
+ function ownKeys3(e, r) {
22139
21967
  var t = Object.keys(e);
22140
21968
  if (Object.getOwnPropertySymbols) {
22141
21969
  var o = Object.getOwnPropertySymbols(e);
@@ -22145,12 +21973,12 @@ function ownKeys2(e, r) {
22145
21973
  }
22146
21974
  return t;
22147
21975
  }
22148
- function _objectSpread22(e) {
21976
+ function _objectSpread23(e) {
22149
21977
  for (var r = 1; r < arguments.length; r++) {
22150
21978
  var t = null != arguments[r] ? arguments[r] : {};
22151
- r % 2 ? ownKeys2(Object(t), true).forEach(function(r$1) {
22152
- _defineProperty2(e, r$1, t[r$1]);
22153
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys2(Object(t)).forEach(function(r$1) {
21979
+ r % 2 ? ownKeys3(Object(t), true).forEach(function(r$1) {
21980
+ _defineProperty3(e, r$1, t[r$1]);
21981
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys3(Object(t)).forEach(function(r$1) {
22154
21982
  Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
22155
21983
  });
22156
21984
  }
@@ -22172,7 +22000,7 @@ var fetchWithAuth = (supabaseKey, getAccessToken, customFetch) => {
22172
22000
  let headers = new HeadersConstructor(init === null || init === void 0 ? void 0 : init.headers);
22173
22001
  if (!headers.has("apikey")) headers.set("apikey", supabaseKey);
22174
22002
  if (!headers.has("Authorization")) headers.set("Authorization", `Bearer ${accessToken}`);
22175
- return fetch$1(input, _objectSpread22(_objectSpread22({}, init), {}, { headers }));
22003
+ return fetch$1(input, _objectSpread23(_objectSpread23({}, init), {}, { headers }));
22176
22004
  };
22177
22005
  };
22178
22006
  function ensureTrailingSlash(url) {
@@ -22183,11 +22011,11 @@ function applySettingDefaults(options, defaults) {
22183
22011
  const { db: dbOptions, auth: authOptions, realtime: realtimeOptions, global: globalOptions } = options;
22184
22012
  const { db: DEFAULT_DB_OPTIONS$1, auth: DEFAULT_AUTH_OPTIONS$1, realtime: DEFAULT_REALTIME_OPTIONS$1, global: DEFAULT_GLOBAL_OPTIONS$1 } = defaults;
22185
22013
  const result = {
22186
- db: _objectSpread22(_objectSpread22({}, DEFAULT_DB_OPTIONS$1), dbOptions),
22187
- auth: _objectSpread22(_objectSpread22({}, DEFAULT_AUTH_OPTIONS$1), authOptions),
22188
- realtime: _objectSpread22(_objectSpread22({}, DEFAULT_REALTIME_OPTIONS$1), realtimeOptions),
22014
+ db: _objectSpread23(_objectSpread23({}, DEFAULT_DB_OPTIONS$1), dbOptions),
22015
+ auth: _objectSpread23(_objectSpread23({}, DEFAULT_AUTH_OPTIONS$1), authOptions),
22016
+ realtime: _objectSpread23(_objectSpread23({}, DEFAULT_REALTIME_OPTIONS$1), realtimeOptions),
22189
22017
  storage: {},
22190
- global: _objectSpread22(_objectSpread22(_objectSpread22({}, DEFAULT_GLOBAL_OPTIONS$1), globalOptions), {}, { headers: _objectSpread22(_objectSpread22({}, (_DEFAULT_GLOBAL_OPTIO = DEFAULT_GLOBAL_OPTIONS$1 === null || DEFAULT_GLOBAL_OPTIONS$1 === void 0 ? void 0 : DEFAULT_GLOBAL_OPTIONS$1.headers) !== null && _DEFAULT_GLOBAL_OPTIO !== void 0 ? _DEFAULT_GLOBAL_OPTIO : {}), (_globalOptions$header = globalOptions === null || globalOptions === void 0 ? void 0 : globalOptions.headers) !== null && _globalOptions$header !== void 0 ? _globalOptions$header : {}) }),
22018
+ global: _objectSpread23(_objectSpread23(_objectSpread23({}, DEFAULT_GLOBAL_OPTIONS$1), globalOptions), {}, { headers: _objectSpread23(_objectSpread23({}, (_DEFAULT_GLOBAL_OPTIO = DEFAULT_GLOBAL_OPTIONS$1 === null || DEFAULT_GLOBAL_OPTIONS$1 === void 0 ? void 0 : DEFAULT_GLOBAL_OPTIONS$1.headers) !== null && _DEFAULT_GLOBAL_OPTIO !== void 0 ? _DEFAULT_GLOBAL_OPTIO : {}), (_globalOptions$header = globalOptions === null || globalOptions === void 0 ? void 0 : globalOptions.headers) !== null && _globalOptions$header !== void 0 ? _globalOptions$header : {}) }),
22191
22019
  accessToken: async () => ""
22192
22020
  };
22193
22021
  if (options.accessToken) result.accessToken = options.accessToken;
@@ -22245,7 +22073,7 @@ var SupabaseClient = class {
22245
22073
  const DEFAULTS = {
22246
22074
  db: DEFAULT_DB_OPTIONS,
22247
22075
  realtime: DEFAULT_REALTIME_OPTIONS,
22248
- auth: _objectSpread22(_objectSpread22({}, DEFAULT_AUTH_OPTIONS), {}, { storageKey: defaultStorageKey }),
22076
+ auth: _objectSpread23(_objectSpread23({}, DEFAULT_AUTH_OPTIONS), {}, { storageKey: defaultStorageKey }),
22249
22077
  global: DEFAULT_GLOBAL_OPTIONS
22250
22078
  };
22251
22079
  const settings = applySettingDefaults(options !== null && options !== void 0 ? options : {}, DEFAULTS);
@@ -22261,7 +22089,7 @@ var SupabaseClient = class {
22261
22089
  } });
22262
22090
  }
22263
22091
  this.fetch = fetchWithAuth(supabaseKey, this._getAccessToken.bind(this), settings.global.fetch);
22264
- this.realtime = this._initRealtimeClient(_objectSpread22({
22092
+ this.realtime = this._initRealtimeClient(_objectSpread23({
22265
22093
  headers: this.headers,
22266
22094
  accessToken: this._getAccessToken.bind(this)
22267
22095
  }, settings.realtime));
@@ -22269,7 +22097,9 @@ var SupabaseClient = class {
22269
22097
  this.rest = new PostgrestClient(new URL("rest/v1", baseUrl).href, {
22270
22098
  headers: this.headers,
22271
22099
  schema: settings.db.schema,
22272
- fetch: this.fetch
22100
+ fetch: this.fetch,
22101
+ timeout: settings.db.timeout,
22102
+ urlLengthLimit: settings.db.urlLengthLimit
22273
22103
  });
22274
22104
  this.storage = new StorageClient(this.storageUrl.href, this.headers, this.fetch, options === null || options === void 0 ? void 0 : options.storage);
22275
22105
  if (!settings.accessToken) this._listenForAuthEvents();
@@ -22376,7 +22206,7 @@ var SupabaseClient = class {
22376
22206
  };
22377
22207
  return new SupabaseAuthClient({
22378
22208
  url: this.authUrl.href,
22379
- headers: _objectSpread22(_objectSpread22({}, authHeaders), headers),
22209
+ headers: _objectSpread23(_objectSpread23({}, authHeaders), headers),
22380
22210
  storageKey,
22381
22211
  autoRefreshToken,
22382
22212
  persistSession,
@@ -22392,7 +22222,7 @@ var SupabaseClient = class {
22392
22222
  });
22393
22223
  }
22394
22224
  _initRealtimeClient(options) {
22395
- return new RealtimeClient(this.realtimeUrl.href, _objectSpread22(_objectSpread22({}, options), {}, { params: _objectSpread22(_objectSpread22({}, { apikey: this.supabaseKey }), options === null || options === void 0 ? void 0 : options.params) }));
22225
+ return new RealtimeClient(this.realtimeUrl.href, _objectSpread23(_objectSpread23({}, options), {}, { params: _objectSpread23(_objectSpread23({}, { apikey: this.supabaseKey }), options === null || options === void 0 ? void 0 : options.params) }));
22396
22226
  }
22397
22227
  _listenForAuthEvents() {
22398
22228
  return this.auth.onAuthStateChange((event, session) => {
@@ -22705,7 +22535,7 @@ var decodeJwt = (token) => {
22705
22535
  };
22706
22536
 
22707
22537
  // src/components/cupcode/MainNavbar.tsx
22708
- import { Fragment as Fragment4, jsx as jsx45, jsxs as jsxs28 } from "react/jsx-runtime";
22538
+ import { Fragment as Fragment5, jsx as jsx45, jsxs as jsxs28 } from "react/jsx-runtime";
22709
22539
  var parsePositiveInteger = (rawValue, fallback) => {
22710
22540
  const parsed = Number(rawValue);
22711
22541
  if (!Number.isFinite(parsed) || parsed <= 0) return fallback;
@@ -24829,7 +24659,7 @@ var MainNavbar = ({
24829
24659
  },
24830
24660
  [authEmail, currentUserId, resolvedSenderId]
24831
24661
  );
24832
- return /* @__PURE__ */ jsx45(Fragment4, { children: /* @__PURE__ */ jsx45(
24662
+ return /* @__PURE__ */ jsx45(Fragment5, { children: /* @__PURE__ */ jsx45(
24833
24663
  NavbarCupcode,
24834
24664
  {
24835
24665
  logo: /* @__PURE__ */ jsxs28("div", { className: "flex items-center gap-[15px]", children: [
@@ -25566,7 +25396,7 @@ function Timeline({ items, variant = "vertical", className }) {
25566
25396
  }
25567
25397
 
25568
25398
  // src/components/cupcode/ToastCupcode.tsx
25569
- import { X as X5, CheckCircle, AlertCircle, Info as Info2, AlertTriangle as AlertTriangle2 } from "lucide-react";
25399
+ import { X as X6, CheckCircle, AlertCircle, Info as Info2, AlertTriangle as AlertTriangle2 } from "lucide-react";
25570
25400
  import { jsx as jsx56, jsxs as jsxs36 } from "react/jsx-runtime";
25571
25401
  var variantStyles2 = {
25572
25402
  success: {
@@ -25625,7 +25455,7 @@ var ToastCupcode = ({
25625
25455
  {
25626
25456
  onClick: onClose,
25627
25457
  className: "shrink-0 rounded-md p-1 hover:bg-cupcode-ink/10 transition-colors",
25628
- children: /* @__PURE__ */ jsx56(X5, { className: "h-4 w-4 text-cupcode-ink/50" })
25458
+ children: /* @__PURE__ */ jsx56(X6, { className: "h-4 w-4 text-cupcode-ink/50" })
25629
25459
  }
25630
25460
  )
25631
25461
  ] })
@@ -26048,7 +25878,7 @@ CarouselNext.displayName = "CarouselNext";
26048
25878
  // src/components/ui/chart.tsx
26049
25879
  import * as React41 from "react";
26050
25880
  import * as RechartsPrimitive from "recharts";
26051
- import { Fragment as Fragment5, jsx as jsx64, jsxs as jsxs40 } from "react/jsx-runtime";
25881
+ import { Fragment as Fragment6, jsx as jsx64, jsxs as jsxs40 } from "react/jsx-runtime";
26052
25882
  var THEMES = { light: "", dark: ".dark" };
26053
25883
  var ChartContext = React41.createContext(null);
26054
25884
  function useChart() {
@@ -26163,7 +25993,7 @@ var ChartTooltipContent = React41.forwardRef(
26163
25993
  "flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",
26164
25994
  indicator === "dot" && "items-center"
26165
25995
  ),
26166
- children: formatter && (item == null ? void 0 : item.value) !== void 0 && item.name ? formatter(item.value, item.name, item, index, item.payload) : /* @__PURE__ */ jsxs40(Fragment5, { children: [
25996
+ children: formatter && (item == null ? void 0 : item.value) !== void 0 && item.name ? formatter(item.value, item.name, item, index, item.payload) : /* @__PURE__ */ jsxs40(Fragment6, { children: [
26167
25997
  (itemConfig == null ? void 0 : itemConfig.icon) ? /* @__PURE__ */ jsx64(itemConfig.icon, {}) : !hideIndicator && /* @__PURE__ */ jsx64(
26168
25998
  "div",
26169
25999
  {
@@ -27003,7 +26833,7 @@ Separator5.displayName = SeparatorPrimitive.Root.displayName;
27003
26833
  // src/components/ui/sheet.tsx
27004
26834
  import * as SheetPrimitive from "@radix-ui/react-dialog";
27005
26835
  import { cva as cva6 } from "class-variance-authority";
27006
- import { X as X6 } from "lucide-react";
26836
+ import { X as X7 } from "lucide-react";
27007
26837
  import * as React55 from "react";
27008
26838
  import { jsx as jsx79, jsxs as jsxs47 } from "react/jsx-runtime";
27009
26839
  var Sheet = SheetPrimitive.Root;
@@ -27059,7 +26889,7 @@ var SheetContent = React55.forwardRef(
27059
26889
  closeButtonClassName
27060
26890
  ),
27061
26891
  children: [
27062
- /* @__PURE__ */ jsx79(X6, { className: "h-4 w-4" }),
26892
+ /* @__PURE__ */ jsx79(X7, { className: "h-4 w-4" }),
27063
26893
  /* @__PURE__ */ jsx79("span", { className: "sr-only", children: closeButtonLabel })
27064
26894
  ]
27065
26895
  }
@@ -27666,7 +27496,7 @@ TableCaption.displayName = "TableCaption";
27666
27496
  import * as React60 from "react";
27667
27497
  import * as ToastPrimitives from "@radix-ui/react-toast";
27668
27498
  import { cva as cva8 } from "class-variance-authority";
27669
- import { X as X7 } from "lucide-react";
27499
+ import { X as X8 } from "lucide-react";
27670
27500
  import { jsx as jsx83 } from "react/jsx-runtime";
27671
27501
  var ToastProvider = ToastPrimitives.Provider;
27672
27502
  var ToastViewport = React60.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx83(
@@ -27725,7 +27555,7 @@ var ToastClose = React60.forwardRef(({ className, onClick, ...props }, ref) => /
27725
27555
  },
27726
27556
  "toast-close": "",
27727
27557
  ...props,
27728
- children: /* @__PURE__ */ jsx83(X7, { className: "h-4 w-4" })
27558
+ children: /* @__PURE__ */ jsx83(X8, { className: "h-4 w-4" })
27729
27559
  }
27730
27560
  ));
27731
27561
  ToastClose.displayName = ToastPrimitives.Close.displayName;
@@ -27842,6 +27672,11 @@ var useActiveSection = (sectionIds, offset = 180) => {
27842
27672
  return activeId;
27843
27673
  };
27844
27674
 
27675
+ // src/utils/slug.ts
27676
+ function slugify(value) {
27677
+ return value.toString().normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().trim().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)+/g, "");
27678
+ }
27679
+
27845
27680
  // src/lib/auth.tsx
27846
27681
  import { createContext as createContext6, useCallback as useCallback9, useContext as useContext7, useEffect as useEffect24, useMemo as useMemo12, useRef as useRef14, useState as useState19 } from "react";
27847
27682
  import { jsx as jsx87 } from "react/jsx-runtime";
@@ -28901,7 +28736,7 @@ export {
28901
28736
  ModalHeader,
28902
28737
  ModalTitle,
28903
28738
  ModalTrigger,
28904
- NavbarCupcode,
28739
+ NavbarCupcode_default as NavbarCupcode,
28905
28740
  NavigationMenu,
28906
28741
  NavigationMenuContent,
28907
28742
  NavigationMenuIndicator,
@@ -29030,7 +28865,7 @@ export {
29030
28865
  TooltipTrigger,
29031
28866
  USER_PRESENCE_LAST_ACTIVE_COLUMN_ENV_KEY,
29032
28867
  USER_PRESENCE_SOURCE_COLUMN_ENV_KEY,
29033
- UserMenuCupcode,
28868
+ UserMenuCupcode_default as UserMenuCupcode,
29034
28869
  badgeVariants,
29035
28870
  buildAuthorizeUrl,
29036
28871
  buildLogoutUrl,
@@ -29060,6 +28895,7 @@ export {
29060
28895
  resolveTelescupImageURL,
29061
28896
  responsiveSizeClasses,
29062
28897
  setCupcodeRuntimeEnv,
28898
+ slugify,
29063
28899
  toast2 as sonnerToast,
29064
28900
  toast,
29065
28901
  toggleVariants,