1import{r as g,u as Ri,j as p,R as Bs,a as ji,b as Pi,L as pe,t as Nt}from"./index-D0uGcouH.js";const Fs=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim();const Ni=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Ii=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,r,n)=>n?n.toUpperCase():r.toLowerCase());const An=t=>{const e=Ii(t);return e.charAt(0).toUpperCase()+e.slice(1)};var $i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Li=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};const Di=g.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:o,iconNode:i,...a},c)=>g.createElement("svg",{ref:c,...$i,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:Fs("lucide",s),...!o&&!Li(a)&&{"aria-hidden":"true"},...a},[...i.map(([l,u])=>g.createElement(l,u)),...Array.isArray(o)?o:[o]]));const ee=(t,e)=>{const r=g.forwardRef(({className:n,...s},o)=>g.createElement(Di,{ref:o,iconNode:e,className:Fs(`lucide-${Ni(An(t))}`,`lucide-${t}`,n),...s}));return r.displayName=An(t),r};const Ui=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],zi=ee("arrow-right",Ui);const Mi=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Bi=ee("circle-alert",Mi);const Fi=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Wi=ee("circle-check",Fi);const qi=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Hi=ee("external-link",qi);const Zi=[["path",{d:"M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z",key:"1jg4f8"}]],Vi=ee("facebook",Zi);const Ji=[["rect",{width:"20",height:"20",x:"2",y:"2",rx:"5",ry:"5",key:"2e1cvw"}],["path",{d:"M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z",key:"9exkf1"}],["line",{x1:"17.5",x2:"17.51",y1:"6.5",y2:"6.5",key:"r4j83e"}]],Ki=ee("instagram",Ji);const Gi=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],Yi=ee("mail",Gi);const Xi=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],Qi=ee("menu",Xi);const ea=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],ta=ee("moon",ea);const ra=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],On=ee("phone",ra);const na=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],sa=ee("refresh-cw",na);const oa=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],ia=ee("sun",oa);const aa=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ws=ee("x",aa);const ca=[["path",{d:"M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17",key:"1q2vi4"}],["path",{d:"m10 15 5-3-5-3z",key:"1jp15x"}]],la=ee("youtube",ca);function ua(){const{theme:t,toggle:e}=Ri(),r=t==="dark";return p.jsxs("button",{onClick:e,"aria-label":r?"Switch to light theme":"Switch to dark theme",className:"relative inline-flex h-9 w-9 items-center justify-center rounded-full border border-border bg-background/40 text-foreground backdrop-blur transition-all hover:border-gold hover:text-gold",children:[p.jsx(ia,{className:`h-4 w-4 transition-all ${r?"scale-0 -rotate-90 opacity-0":"scale-100 rotate-0 opacity-100"}`}),p.jsx(ta,{className:`absolute h-4 w-4 transition-all ${r?"scale-100 rotate-0 opacity-100":"scale-0 rotate-90 opacity-0"}`})]})}function xe(t,e,{checkForDefaultPrevented:r=!0}={}){return function(s){if(t?.(s),r===!1||!s.defaultPrevented)return e?.(s)}}function Cn(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function sn(...t){return e=>{let r=!1;const n=t.map(s=>{const o=Cn(s,e);return!r&&typeof o=="function"&&(r=!0),o});if(r)return()=>{for(let s=0;s<n.length;s++){const o=n[s];typeof o=="function"?o():Cn(t[s],null)}}}}function ze(...t){return g.useCallback(sn(...t),t)}function da(t,e){const r=g.createContext(e),n=o=>{const{children:i,...a}=o,c=g.useMemo(()=>a,Object.values(a));return p.jsx(r.Provider,{value:c,children:i})};n.displayName=t+"Provider";function s(o){const i=g.useContext(r);if(i)return i;if(e!==void 0)return e;throw new Error(`\`${o}\` must be used within \`${t}\``)}return[n,s]}function ha(t,e=[]){let r=[];function n(o,i){const a=g.createContext(i),c=r.length;r=[...r,i];const l=d=>{const{scope:h,children:f,...v}=d,m=h?.[t]?.[c]||a,b=g.useMemo(()=>v,Object.values(v));return p.jsx(m.Provider,{value:b,children:f})};l.displayName=o+"Provider";function u(d,h){const f=h?.[t]?.[c]||a,v=g.useContext(f);if(v)return v;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${o}\``)}return[l,u]}const s=()=>{const o=r.map(i=>g.createContext(i));return function(a){const c=a?.[t]||o;return g.useMemo(()=>({[`__scope${t}`]:{...a,[t]:c}}),[a,c])}};return s.scopeName=t,[n,fa(s,...e)]}function fa(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const n=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const i=n.reduce((a,{useScope:c,scopeName:l})=>{const d=c(o)[`__scope${l}`];return{...a,...d}},{});return g.useMemo(()=>({[`__scope${e.scopeName}`]:i}),[i])}};return r.scopeName=e.scopeName,r}var vt=globalThis?.document?g.useLayoutEffect:()=>{},pa=Bs[" useId ".trim().toString()]||(()=>{}),ga=0;function Tr(t){const[e,r]=g.useState(pa());return vt(()=>{r(n=>n??String(ga++))},[t]),t||(e?`radix-${e}
1`:"")}var ma=Bs[" useInsertionEffect ".trim().toString()]||vt;function va({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){const[s,o,i]=ba({defaultProp:e,onChange:r}),a=t!==void 0,c=a?t:s;{const u=g.useRef(t!==void 0);g.useEffect(()=>{const d=u.current;d!==a&&console.warn(`${n} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,n])}const l=g.useCallback(u=>{if(a){const d=ya(u)?u(t):u;d!==t&&i.current?.(d)}else o(u)},[a,t,o,i]);return[c,l]}function ba({defaultProp:t,onChange:e}){const[r,n]=g.useState(t),s=g.useRef(r),o=g.useRef(e);return ma(()=>{o.current=e},[e]),g.useEffect(()=>{s.current!==r&&(o.current?.(r),s.current=r)},[r,s]),[r,n,o]}function ya(t){return typeof t=="function"}function wa(t){const e=_a(t),r=g.forwardRef((n,s)=>{const{children:o,...i}=n,a=g.Children.toArray(o),c=a.find(Sa);if(c){const l=c.props.children,u=a.map(d=>d===c?g.Children.count(l)>1?g.Children.only(null):g.isValidElement(l)?l.props.children:null:d);return p.jsx(e,{...i,ref:s,children:g.isValidElement(l)?g.cloneElement(l,void 0,u):null})}return p.jsx(e,{...i,ref:s,children:o})});return r.displayName=`${t}.Slot`,r}function _a(t){const e=g.forwardRef((r,n)=>{const{children:s,...o}=r;if(g.isValidElement(s)){const i=xa(s),a=Ea(o,s.props);return s.type!==g.Fragment&&(a.ref=n?sn(n,i):i),g.cloneElement(s,a)}return g.Children.count(s)>1?g.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var ka=Symbol("radix.slottable");function Sa(t){return g.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===ka}function Ea(t,e){const r={...e};for(const n in e){const s=t[n],o=e[n];/^on[A-Z]/.test(n)?s&&o?r[n]=(...a)=>{const c=o(...a);return s(...a),c}:s&&(r[n]=s):n==="style"?r[n]={...s,...o}:n==="className"&&(r[n]=[s,o].filter(Boolean).join(" "))}return{...t,...r}}function xa(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var Ta=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ve=Ta.reduce((t,e)=>{const r=wa(`Primitive.${e}`),n=g.forwardRef((s,o)=>{const{asChild:i,...a}=s,c=i?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(c,{...a,ref:o})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function Aa(t,e){t&&ji.flushSync(()=>t.dispatchEvent(e))}function bt(t){const e=g.useRef(t);return g.useEffect(()=>{e.current=t}),g.useMemo(()=>(...r)=>e.current?.(...r),[])}function Oa(t,e=globalThis?.document){const r=bt(t);g.useEffect(()=>{const n=s=>{s.key==="Escape"&&r(s)};return e.addEventListener("keydown",n,{capture:!0}),()=>e.removeEventListener("keydown",n,{capture:!0})},[r,e])}var Ca="DismissableLayer",Mr="dismissableLayer.update",Ra="dismissableLayer.pointerDownOutside",ja="dismissableLayer.focusOutside",Rn,qs=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Hs=g.forwardRef((t,e)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:i,onDismiss:a,...c}=t,l=g.useContext(qs),[u,d]=g.useState(null),h=u?.ownerDocument??globalThis?.document,[,f]=g.useState({}),v=ze(e,C=>d(C)),m=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=m.indexOf(b),k=u?m.indexOf(u):-1,w=l.layersWithOutsidePointerEventsDisabled.size>0,T=k>=_,I=Ia(C=>{const A=C.target,L=[...l.branches].some(ye=>ye.contains(A));!T||L||(s?.(C),i?.(C),C.defaultPrevented||a?.())},h),P=$a(C=>{const A=C.target;[...l.branches].some(ye=>ye.contains(A))||(o?.(C),i?.(C),C.defaultPrevented||a?.())},h);return Oa(C=>{k===l.layers.size-1&&(n?.(C),!C.defaultPrevented&&a&&(C.preventDefault(),a()))},h),g.useEffect(()=>{if(u)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Rn=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),jn(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Rn)}},[u,h,r,l]),g.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),jn())},[u,l]),g.useEffect(()=>{const C=()=>f({});return document.addEventListener(Mr,C),()=>document.removeEventListener(Mr,C)},[]),p.jsx(ve.div,{...c,ref:v,style:{pointerEvents:w?T?"auto":"none":void 0,...t.style},onFocusCapture:xe(t.onFocusCapture,P.onFocusCapture),onBlurCapture:xe(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:xe(t.onPointerDownCapture,I.onPointerDownCapture)})});Hs.displayName=Ca;var Pa="DismissableLayerBranch",Na=g.forwardRef((t,e)=>{const r=g.useContext(qs),n=g.useRef(null),s=ze(e,n);return g.useEffect(()=>{const o=n.current;if(o)return r.branches.add(o),()=>{r.branches.delete(o)}},[r.branches]),p.jsx(ve.div,{...t,ref:s})});Na.displayName=Pa;function Ia(t,e=globalThis?.document){const r=bt(t),n=g.useRef(!1),s=g.useRef(()=>{});return g.useEffect(()=>{const o=a=>{if(a.target&&!n.current){let c=function(){Zs(Ra,r,l,{discrete:!0})};const l={originalEvent:a};
vendor: 6,200 bytes, line 1
1a.pointerType==="touch"?(e.removeEventListener("click",s.current),s.current=c,e.addEventListener("click",s.current,{once:!0})):c()}else e.removeEventListener("click",s.current);n.current=!1},i=window.setTimeout(()=>{e.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(i),e.removeEventListener("pointerdown",o),e.removeEventListener("click",s.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function $a(t,e=globalThis?.document){const r=bt(t),n=g.useRef(!1);return g.useEffect(()=>{const s=o=>{o.target&&!n.current&&Zs(ja,r,{originalEvent:o},{discrete:!1})};return e.addEventListener("focusin",s),()=>e.removeEventListener("focusin",s)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function jn(){const t=new CustomEvent(Mr);document.dispatchEvent(t)}function Zs(t,e,r,{discrete:n}){const s=r.originalEvent.target,o=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&s.addEventListener(t,e,{once:!0}),n?Aa(s,o):s.dispatchEvent(o)}var Ar="focusScope.autoFocusOnMount",Or="focusScope.autoFocusOnUnmount",Pn={bubbles:!1,cancelable:!0},La="FocusScope",Vs=g.forwardRef((t,e)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...i}=t,[a,c]=g.useState(null),l=bt(s),u=bt(o),d=g.useRef(null),h=ze(e,m=>c(m)),f=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(n){let m=function(w){if(f.paused||!a)return;const T=w.target;a.contains(T)?d.current=T:ke(d.current,{select:!0})},b=function(w){if(f.paused||!a)return;const T=w.relatedTarget;T!==null&&(a.contains(T)||ke(d.current,{select:!0}))},_=function(w){if(document.activeElement===document.body)for(const I of w)I.removedNodes.length>0&&ke(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",b);const k=new MutationObserver(_);return a&&k.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",b),k.disconnect()}}},[n,a,f.paused]),g.useEffect(()=>{if(a){In.add(f);const m=document.activeElement;if(!a.contains(m)){const _=new CustomEvent(Ar,Pn);a.addEventListener(Ar,l),a.dispatchEvent(_),_.defaultPrevented||(Da(Fa(Js(a)),{select:!0}),document.activeElement===m&&ke(a))}return()=>{a.removeEventListener(Ar,l),setTimeout(()=>{const _=new CustomEvent(Or,Pn);a.addEventListener(Or,u),a.dispatchEvent(_),_.defaultPrevented||ke(m??document.body,{select:!0}),a.removeEventListener(Or,u),In.remove(f)},0)}}},[a,l,u,f]);const v=g.useCallback(m=>{if(!r&&!n||f.paused)return;const b=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,_=document.activeElement;if(b&&_){const k=m.currentTarget,[w,T]=Ua(k);w&&T?!m.shiftKey&&_===T?(m.preventDefault(),r&&ke(w,{select:!0})):m.shiftKey&&_===w&&(m.preventDefault(),r&&ke(T,{select:!0})):_===k&&m.preventDefault()}},[r,n,f.paused]);return p.jsx(ve.div,{tabIndex:-1,...i,ref:h,onKeyDown:v})});Vs.displayName=La;function Da(t,{select:e=!1}={}){const r=document.activeElement;for(const n of t)if(ke(n,{select:e}),document.activeElement!==r)return}function Ua(t){const e=Js(t),r=Nn(e,t),n=Nn(e.reverse(),t);return[r,n]}function Js(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function Nn(t,e){for(const r of t)if(!za(r,{upTo:e}))return r}function za(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function Ma(t){return t instanceof HTMLInputElement&&"select"in t}function ke(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&Ma(t)&&e&&t.select()}}var In=Ba();function Ba(){let t=[];return{add(e){const r=t[0];e!==r&&r?.pause(),t=$n(t,e),t.unshift(e)},remove(e){t=$n(t,e),t[0]?.resume()}}}function $n(t,e){const r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function Fa(t){return t.filter(e=>e.tagName!=="A")}var Wa="Portal",Ks=g.forwardRef((t,e)=>{const{container:r,...n}=t,[s,o]=g.useState(!1);vt(()=>o(!0),[]);const i=r||s&&globalThis?.document?.body;return i?Pi.createPortal(p.jsx(ve.div,{...n,ref:e}),i):null});Ks.displayName=Wa;function qa(t,e){return g.useReducer((r,n)=>e[r][n]??r,t)}var hr=t=>{const{present:e,children:r}=t,n=Ha(e),s=typeof r=="function"?r({present:n.isPresent}):g.Children.only(r),o=ze(n.ref,Za(s));return typeof r=="function"||n.isPresent?g.cloneElement(s,{ref:o}):null};hr.displayName="Presence";function Ha(t){const[e,r]=g.useState(),n=g.useRef(null),s=g.useRef(t),o=g.useRef("none"),i=t?"mounted":"unmounted",[a,c]=qa(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const l=It(n.current);o.current=a==="mounted"?l:"none"},[a]),vt(()=>{const l=n.current,u=s.current;if(u!==t){const h=o.current,f=It(l);t?c("MOUNT"):f==="none"||l?.display==="none"?c("UNMOUNT"):c(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,c]),vt(()=>{if(e){let l;const u=e.ownerDocument.defaultView??window,d=f=>{const m=It(n.current).includes(CSS.escape(f.animationName));if(f.target===e&&m&&(c("ANIMATION_END"),!s.current)){const b=e.style.animationFillMode;e.style.animationFillMode="forwards",l=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=b)})}},h=f=>{f.target===e&&(o.current=It(n.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(l),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:g.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function It(t){return t?.animationName||"none"}function Za(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.
vendor: 23,462 bytes, lines 1-45
1isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var Cr=0;function Va(){g.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??Ln()),document.body.insertAdjacentElement("beforeend",t[1]??Ln()),Cr++,()=>{Cr===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Cr--}},[])}function Ln(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var de=function(){return de=Object.assign||function(e){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},de.apply(this,arguments)};function it(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]]);return r}function Ja(t,e,r,n){function s(o){return o instanceof r?o:new r(function(i){i(o)})}return new(r||(r=Promise))(function(o,i){function a(u){try{l(n.next(u))}catch(d){i(d)}}function c(u){try{l(n.throw(u))}catch(d){i(d)}}function l(u){u.done?o(u.value):s(u.value).then(a,c)}l((n=n.apply(t,e||[])).next())})}function Ka(t,e,r){if(r||arguments.length===2)for(var n=0,s=e.length,o;n<s;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return t.concat(o||Array.prototype.slice.call(e))}var Xt="right-scroll-bar-position",Qt="width-before-scroll-bar",Ga="with-scroll-bars-hidden",Ya="--removed-body-scroll-bar-size";function Rr(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function Xa(t,e){var r=g.useState(function(){return{value:t,callback:e,facade:{get current(){return r.value},set current(n){var s=r.value;s!==n&&(r.value=n,r.callback(n,s))}}}})[0];return r.callback=e,r.facade}var Qa=typeof window<"u"?g.useLayoutEffect:g.useEffect,Dn=new WeakMap;function ec(t,e){var r=Xa(null,function(n){return t.forEach(function(s){return Rr(s,n)})});return Qa(function(){var n=Dn.get(r);if(n){var s=new Set(n),o=new Set(t),i=r.current;s.forEach(function(a){o.has(a)||Rr(a,null)}),o.forEach(function(a){s.has(a)||Rr(a,i)})}Dn.set(r,t)},[t]),r}function tc(t){return t}function rc(t,e){e===void 0&&(e=tc);var r=[],n=!1,s={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:t},useMedium:function(o){var i=e(o,n);return r.push(i),function(){r=r.filter(function(a){return a!==i})}},assignSyncMedium:function(o){for(n=!0;r.length;){var i=r;r=[],i.forEach(o)}r={push:function(a){return o(a)},filter:function(){return r}}},assignMedium:function(o){n=!0;var i=[];if(r.length){var a=r;r=[],a.forEach(o),i=r}var c=function(){var u=i;i=[],u.forEach(o)},l=function(){return Promise.resolve().then(c)};l(),r={push:function(u){i.push(u),l()},filter:function(u){return i=i.filter(u),r}}}};return s}function nc(t){t===void 0&&(t={});var e=rc(null);return e.options=de({async:!0,ssr:!1},t),e}var Gs=function(t){var e=t.sideCar,r=it(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=e.read();if(!n)throw new Error("Sidecar medium not found");return g.createElement(n,de({},r))};Gs.isSideCarExport=!0;function sc(t,e){return t.useMedium(e),Gs}var Ys=nc(),jr=function(){},fr=g.forwardRef(function(t,e){var r=g.useRef(null),n=g.useState({onScrollCapture:jr,onWheelCapture:jr,onTouchMoveCapture:jr}),s=n[0],o=n[1],i=t.forwardProps,a=t.children,c=t.className,l=t.removeScrollBar,u=t.enabled,d=t.shards,h=t.sideCar,f=t.noRelative,v=t.noIsolation,m=t.inert,b=t.allowPinchZoom,_=t.as,k=_===void 0?"div":_,w=t.gapMode,T=it(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),I=h,P=ec([r,e]),C=de(de({},T),s);return g.createElement(g.Fragment,null,u&&g.createElement(I,{sideCar:Ys,removeScrollBar:l,shards:d,noRelative:f,noIsolation:v,inert:m,setCallbacks:o,allowPinchZoom:!!b,lockRef:r,gapMode:w}),i?g.cloneElement(g.Children.only(a),de(de({},C),{ref:P})):g.createElement(k,de({},C,{className:c,ref:P}),a))});fr.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};fr.classNames={fullWidth:Qt,zeroRight:Xt};var oc=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function ic(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=oc();return e&&t.setAttribute("nonce",e),t}function ac(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function cc(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var lc=function(){var t=0,e=null;return{add:function(r){t==0&&(e=ic())&&(ac(e,r),cc(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},uc=function(){var t=lc();return function(e,r){g.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}},Xs=function(){var t=uc(),e=function(r){var n=r.styles,s=r.dynamic;return t(n,s),null};return e},dc={left:0,top:0,right:0,gap:0},Pr=function(t){return parseInt(t||"",10)||0},hc=function(t){var e=window.getComputedStyle(document.body),r=e[t==="padding"?"paddingLeft":"marginLeft"],n=e[t==="padding"?"paddingTop":"marginTop"],s=e[t==="padding"?"paddingRight":"marginRight"];return[Pr(r),Pr(n),Pr(s)]},fc=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return dc;var e=hc(t),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,n-r+e[2]-e[0])}},pc=Xs(),nt="data-scroll-locked",gc=function(t,e,r,n){var s=t.left,o=t.top,i=t.right,a=t.gap;return r===void 0&&(r="margin"),` 2 .`.concat(Ga,` { 3 overflow: hidden `).concat(n,`; 4 padding-right: `).concat(a,"px ").concat(n,`; 5 } 6 body[`).concat(nt,`] { 7 overflow: hidden `).concat(n,`; 8 overscroll-behavior: contain; 9 `).concat([e&&"position: relative ".concat(n,";"),r==="margin"&&` 10 padding-left: `.concat(s,`px; 11 padding-top: `).concat(o,`px; 12 padding-right: `).concat(i,`px; 13 margin-left:0; 14 margin-top:0; 15 margin-right: `).concat(a,"px ").concat(n,`; 16 `),r==="padding"&&"padding-right: ".concat(a,"px ").concat(n,";")].filter(Boolean).join(""),` 17 } 18 19 .`).concat(Xt,` { 20 right: `).concat(a,"px ").concat(n,`; 21 } 22 23 .`).concat(Qt,` { 24 margin-right: `).concat(a,"px ").concat(n,`; 25 } 26 27 .`).concat(Xt," .").concat(Xt,` { 28 right: 0 `).concat(n,`; 29 } 30 31 .`).concat(Qt," .").concat(Qt,` { 32 margin-right: 0 `).concat(n,`; 33 } 34 35 body[`).concat(nt,`] { 36 `).concat(Ya,": ").concat(a,`px; 37 } 38`)},Un=function(){var t=parseInt(document.body.getAttribute(nt)||"0",10);return isFinite(t)?t:0},mc=function(){g.useEffect(function(){return document.body.setAttribute(nt,(Un()+1).toString()),function(){var t=Un()-1;t<=0?document.body.removeAttribute(nt):document.body.setAttribute(nt,t.toString())}},[])},vc=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,s=n===void 0?"margin":n;mc();var o=g.useMemo(function(){return fc(s)},[s]);return g.createElement(pc,{styles:gc(o,!e,s,r?"":"!important")})},Br=!1;if(typeof window<"u")try{var $t=Object.defineProperty({},"passive",{get:function(){return Br=!0,!0}});window.addEventListener("test",$t,$t),window.removeEventListener("test",$t,$t)}catch{Br=!1}var Fe=Br?{passive:!1}:!1,bc=function(t){return t.tagName==="TEXTAREA"},Qs=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!bc(t)&&r[e]==="visible")},yc=function(t){return Qs(t,"overflowY")},wc=function(t){return Qs(t,"overflowX")},zn=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var s=eo(t,n);if(s){var o=to(t,n),i=o[1],a=o[2];if(i>a)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},_c=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},kc=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},eo=function(t,e){return t==="v"?yc(e):wc(e)},to=function(t,e){return t==="v"?_c(e):kc(e)},Sc=function(t,e){return t==="h"&&e==="rtl"?-1:1},Ec=function(t,e,r,n,s){var o=Sc(t,window.getComputedStyle(e).direction),i=o*n,a=r.target,c=e.contains(a),l=!1,u=i>0,d=0,h=0;do{if(!a)break;var f=to(t,a),v=f[0],m=f[1],b=f[2],_=m-b-o*v;(v||_)&&eo(t,a)&&(d+=_,h+=v);var k=a.parentNode;a=k&&k.nodeType===Node.DOCUMENT_FRAGMENT_NODE?k.host:k}while(!c&&a!==document.body||c&&(e.contains(a)||e===a));return(u&&Math.abs(d)<1||!u&&Math.abs(h)<1)&&(l=!0),l},Lt=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Mn=function(t){return[t.deltaX,t.deltaY]},Bn=function(t){return t&&"current"in t?t.current:t},xc=function(t,e){return t[0]===e[0]&&t[1]===e[1]},Tc=function(t){return` 39 .block-interactivity-`.concat(t,` {pointer-events: none;} 40 .allow-interactivity-`).concat(t,` {pointer-events: all;} 41`)},Ac=0,We=[];function Oc(t){var e=g.useRef([]),r=g.useRef([0,0]),n=g.useRef(),s=g.useState(Ac++)[0],o=g.useState(Xs)[0],i=g.useRef(t);g.useEffect(function(){i.current=t},[t]),g.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var m=Ka([t.lockRef.current],(t.shards||[]).map(Bn),!0).filter(Boolean);return m.forEach(function(b){return b.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),m.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var a=g.useCallback(function(m,b){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!i.current.allowPinchZoom;var _=Lt(m),k=r.current,w="deltaX"in m?m.deltaX:k[0]-_[0],T="deltaY"in m?m.deltaY:k[1]-_[1],I,P=m.target,C=Math.abs(w)>Math.abs(T)?"h":"v";if("touches"in m&&C==="h"&&P.type==="range")return!1;var A=window.getSelection(),L=A&&A.anchorNode,ye=L?L===P||L.contains(P):!1;if(ye)return!1;var Ae=zn(C,P);if(!Ae)return!0;if(Ae?I=C:(I=C==="v"?"h":"v",Ae=zn(C,P)),!Ae)return!1;if(!n.current&&"changedTouches"in m&&(w||T)&&(n.current=I),!I)return!0;var Oe=n.current||I;return Ec(Oe,b,m,Oe==="h"?w:T)},[]),c=g.useCallback(function(m){var b=m;if(!(!We.length||We[We.length-1]!==o)){var _="deltaY"in b?Mn(b):Lt(b),k=e.current.filter(function(I){return I.name===b.type&&(I.target===b.target||b.target===I.shadowParent)&&xc(I.delta,_)})[0];if(k&&k.should){b.cancelable&&b.preventDefault();return}if(!k){var w=(i.current.shards||[]).map(Bn).filter(Boolean).filter(function(I){return I.contains(b.target)}),T=w.length>0?a(b,w[0]):!i.current.noIsolation;T&&b.cancelable&&b.preventDefault()}}},[]),l=g.useCallback(function(m,b,_,k){var w={name:m,delta:b,target:_,should:k,shadowParent:Cc(_)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(T){return T!==w})},1)},[]),u=g.useCallback(function(m){r.current=Lt(m),n.current=void 0},[]),d=g.useCallback(function(m){l(m.type,Mn(m),m.target,a(m,t.lockRef.current))},[]),h=g.useCallback(function(m){l(m.type,Lt(m),m.target,a(m,t.lockRef.current))},[]);g.useEffect(function(){return We.push(o),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:h}),document.addEventListener("wheel",c,Fe),document.addEventListener("touchmove",c,Fe),document.addEventListener("touchstart",u,Fe),function(){We=We.filter(function(m){return m!==o}),document.removeEventListener("wheel",c,Fe),document.removeEventListener("touchmove",c,Fe),document.removeEventListener("touchstart",u,Fe)}},[]);var f=t.removeScrollBar,v=t.inert;return g.createElement(g.Fragment,null,v?g.createElement(o,{styles:Tc(s)}):null,f?g.createElement(vc,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function Cc(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const Rc=sc(Ys,Oc);var ro=g.forwardRef(function(t,e){return g.createElement(fr,de({},t,{ref:e,sideCar:Rc}))});ro.classNames=fr.classNames;var jc=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},qe=new WeakMap,Dt=new WeakMap,Ut={},Nr=0,no=function(t){return t&&(t.host||no(t.parentNode))},Pc=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=no(r);return n&&t.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",t,". Doing nothing"),null)}).filter(function(r){return!!r})},Nc=function(t,e,r,n){var s=Pc(e,Array.isArray(t)?t:[t]);Ut[r]||(Ut[r]=new WeakMap);var o=Ut[r],i=[],a=new Set,c=new Set(s),l=function(d){!d||a.has(d)||(a.add(d),l(d.parentNode))};s.forEach(l);var u=function(d){!d||c.has(d)||Array.prototype.forEach.call(d.children,function(h){if(a.has(h))u(h);else try{var f=h.getAttribute(n),v=f!==null&&f!=="false",m=(qe.get(h)||0)+1,b=(o.get(h)||0)+1;qe.set(h,m),o.set(h,b),i.push(h),m===1&&v&&Dt.set(h,!0),b===1&&h.setAttribute(r,"true"),v||h.setAttribute(n,"true")}catch(_){console.error("aria-hidden: cannot operate on ",h,_)}})};return u(e),a.clear(),Nr++,function(){i.forEach(function(d){var h=qe.get(d)-1,f=o.get(d)-1;qe.set(d,h),o.set(d,f),h||(Dt.has(d)||d.removeAttribute(n),Dt.delete(d)),f||d.removeAttribute(r)}),Nr--,Nr||(qe=new WeakMap,qe=new WeakMap,Dt=new WeakMap,Ut={})}},Ic=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),s=jc(t);return s?(n.push.apply(n,Array.from(s.querySelectorAll("[aria-live], script"))),Nc(n,s,r,"aria-hidden")):function(){return null}};function $c(t){const e=Lc(t),r=g.forwardRef((n,s)=>{const{children:o,...i}=n,a=g.Children.toArray(o),c=a.find(Uc);if(c){const l=c.props.children,u=a.map(d=>d===c?g.Children.count(l)>1?g.Children.only(null):g.isValidElement(l)?l.props.children:null:d);return p.jsx(e,{...i,ref:s,children:g.isValidElement(l)?g.cloneElement(l,void 0,u):null})}return p.jsx(e,{...i,ref:s,children:o})});return r.displayName=`${t}.Slot`,r}function Lc(t){const e=g.forwardRef((r,n)=>{const{children:s,...o}=r;if(g.isValidElement(s)){const i=Mc(s),a=zc(o,s.props);return s.type!==g.Fragment&&(a.ref=n?sn(n,i):i),g.cloneElement(s,a)}return g.Children.count(s)>1?g.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Dc=Symbol("radix.slottable");function Uc(t){return g.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Dc}function zc(t,e){const r={...e};for(const n in e){const s=t[n],o=e[n];/^on[A-Z]/.test(n)?s&&o?r[n]=(...a)=>{const c=o(...a);return s(...a),c}:s&&(r[n]=s):n==="style"?r[n]={...s,...o}:n==="className"&&(r[n]=[s,o].filter(Boolean).join(" "))}return{...t,...r}}function Mc(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var pr="Dialog",[so]=ha(pr),[Bc,ae]=so(pr),oo=t=>{const{__scopeDialog:e,children:r,open:n,defaultOpen:s,onOpenChange:o,modal:i=!0}=t,a=g.useRef(null),c=g.useRef(null),[l,u]=va({prop:n,defaultProp:s??!1,onChange:o,caller:pr});return p.jsx(Bc,{scope:e,triggerRef:a,contentRef:c,contentId:Tr(),titleId:Tr(),descriptionId:Tr(),open:l,onOpenChange:u,onOpenToggle:g.useCallback(()=>u(d=>!d),[u]),modal:i,children:r})};oo.displayName=pr;var io="DialogTrigger",Fc=g.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=ae(io,r),o=ze(e,s.triggerRef);return p.jsx(ve.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":cn(s.open),...n,ref:o,onClick:xe(t.onClick,s.onOpenToggle)})});Fc.displayName=io;var on="DialogPortal",[Wc,ao]=so(on,{forceMount:void 0}),co=t=>{const{__scopeDialog:e,forceMount:r,children:n,container:s}=t,o=ae(on,e);return p.jsx(Wc,{scope:e,forceMount:r,children:g.Children.map(n,i=>p.jsx(hr,{present:r||o.open,children:p.jsx(Ks,{asChild:!0,container:s,children:i})}))})};co.displayName=on;var tr="DialogOverlay",lo=g.forwardRef((t,e)=>{const r=ao(tr,t.__scopeDialog),{forceMount:n=r.forceMount,...s}=t,o=ae(tr,t.__scopeDialog);return o.modal?p.jsx(hr,{present:n||o.open,children:p.jsx(Hc,{...s,ref:e})}):null});lo.displayName=tr;var qc=$c("DialogOverlay.RemoveScroll"),Hc=g.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=ae(tr,r);return p.jsx(ro,{as:qc,allowPinchZoom:!0,shards:[s.contentRef],children:p.jsx(ve.div,{"data-state":cn(s.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),Le="DialogContent",uo=g.forwardRef((t,e)=>{const r=ao(Le,t.__scopeDialog),{forceMount:n=r.forceMount,...s}=t,o=ae(Le,t.__scopeDialog);return p.jsx(hr,{present:n||o.open,children:o.modal?p.jsx(Zc,{...s,ref:e}):p.jsx(Vc,{...s,ref:e})})});uo.displayName=Le;var Zc=g.forwardRef((t,e)=>{const r=ae(Le,t.__scopeDialog),n=g.useRef(null),s=ze(e,r.contentRef,n);return g.useEffect(()=>{const o=n.current;if(o)return Ic(o)},[]),p.jsx(ho,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:xe(t.onCloseAutoFocus,o=>{o.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:xe(t.onPointerDownOutside,o=>{const i=o.detail.originalEvent,a=i.button===0&&i.ctrlKey===!0;(i.button===2||a)&&o.preventDefault()}),onFocusOutside:xe(t.onFocusOutside,o=>o.preventDefault())})}),Vc=g.forwardRef((t,e)=>{const r=ae(Le,t.__scopeDialog),n=g.useRef(!1),s=g.useRef(!1);return p.jsx(ho,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{t.onCloseAutoFocus?.(o),o.defaultPrevented||(n.current||r.triggerRef.current?.focus(),o.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:o=>{t.onInteractOutside?.(o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=o.target;r.triggerRef.current?.contains(i)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),ho=g.forwardRef((t,e)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:o,...i}=t,a=ae(Le,r),c=g.useRef(null),l=ze(e,c);return Va(),p.jsxs(p.Fragment,{children:[p.jsx(Vs,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:o,children:p.jsx(Hs,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":cn(a.open),...i,ref:l,onDismiss:()=>a.onOpenChange(!1)})}),p.jsxs(p.Fragment,{children:[p.jsx(Jc,{titleId:a.titleId}),p.jsx(Gc,{contentRef:c,descriptionId:a.descriptionId})]})]})}),an="DialogTitle",fo=g.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=ae(an,r);return p.jsx(ve.h2,{id:s.titleId,...n,ref:e})});fo.displayName=an;var po="DialogDescription",go=g.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=ae(po,r);return p.jsx(ve.p,{id:s.descriptionId,...n,ref:e})});go.displayName=po;var mo="DialogClose",vo=g.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=ae(mo,r);return p.jsx(ve.button,{type:"button",...n,ref:e,onClick:xe(t.onClick,()=>s.onOpenChange(!1))})});vo.displayName=mo;function cn(t){return t?"open":"closed"}var bo="DialogTitleWarning",[Xm,yo]=da(bo,{contentName:Le,titleName:an,docsSlug:"dialog"}),Jc=({titleId:t})=>{const e=yo(bo),r=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users. 42 43If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component. 44 45For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return g.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},Kc="DialogDescriptionWarning",Gc=({contentRef:t,descriptionId:e})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${yo(Kc).contentName}}.`;return g.useEffect(()=>{const s=t.current?.getAttribute("aria-describedby");e&&s&&(document.getElementById(e)||console.warn(n))},[n,t,e]),null},Yc=oo,Xc=co,wo=lo,_o=uo,ko=fo,So=go,Qc=vo;function Eo(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(r=Eo(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function el(){for(var t,e,r=0,n="",s=arguments.length;r<s;r++)(t=arguments[r])&&(e=Eo(t))&&(n&&(n+=" "),n+=e);return n}const tl=(t,e)=>{const r=new Array(t.length+e.length);for(let n=0;n<t.length;n++)r[n]=t[n];for(let n=0;n<e.length;n++)r[t.length+n]=e[n];return r},rl=(t,e)=>({classGroupId:t,validator:e}),xo=(t=new Map,e=null,r)=>({nextPart:t,validators:e,classGroupId:r}),rr="-",Fn=[],nl="arbitrary..",sl=t=>{const e=il(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return ol(i);const a=i.split(rr),c=a[0]===""&&a.length>1?1:0;return To(a,c,e)},getConflictingClassGroupIds:(i,a)=>{if(a){const c=n[i],l=r[i];return c?l?tl(l,c):c:l||Fn}return r[i]||Fn}}},To=(t,e,r)=>{if(t.length-e===0)return r.classGroupId;const s=t[e],o=r.nextPart.get(s);if(o){const l=To(t,e+1,o);if(l)return l}const i=r.validators;if(i===null)return;const a=e===0?t.join(rr):t.slice(e).join(rr),c=i.length;for(let l=0;l<c;l++){const u=i[l];if(u.validator(a))return u.classGroupId}},ol=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),r=e.indexOf(":"),n=e.slice(0,r);return n?nl+n:void 0})(),il=t=>{const{theme:e,classGroups:r}=t;return al(r,e)},al=(t,e)=>{const r=xo();for(const n in t){const s=t[n];ln(s,r,n,e)}return r},ln=(t,e,r,n)=>{const s=t.length;for(let o=0;o<s;o++){const i=t[o];cl(i,e,r,n)}},cl=(t,e,r,n)=>{if(typeof t=="string"){ll(t,e,r);return}if(typeof t=="function"){ul(t,e,r,n);return}dl(t,e,r,n)},ll=(t,e,r)=>{const n=t===""?e:Ao(e,t);n.classGroupId=r},ul=(t,e,r,n)=>{if(hl(t)){ln(t(n),e,r,n);return}e.validators===null&&(e.validators=[]),e.validators.push(rl(r,t))},dl=(t,e,r,n)=>{const s=Object.entries(t),o=s.length;for(let i=0;i<o;i++){const[a,c]=s[i];ln(c,Ao(e,a),r,n)}},Ao=(t,e)=>{let r=t;const n=e.split(rr),s=n.length;for(let o=0;o<s;o++){const i=n[o];let a=r.nextPart.get(i);a||(a=xo(),r.nextPart.set(i,a)),r=a}return r},hl=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,fl=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=Object.create(null),n=Object.create(null);const s=(o,i)=>{r[o]=i,e++,e>t&&(e=0,n=r,r=Object.create(null))};return{get(o){let i=r[o];if(i!==void 0)return i;if((i=n[o])!==void 0)return s(o,i),i},set(o,i){o in r?r[o]=i:s(o,i)}}},Fr="!",Wn=":",pl=[],qn=(t,e,r,n,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:r,maybePostfixModifierPosition:n,isExternal:s}),gl=t=>{const{prefix:e,experimentalParseClassName:r}=t;let n=s=>{const o=[];let i=0,a=0,c=0,l;const u=s.length;for(let m=0;m<u;m++){const b=s[m];if(i===0&&a===0){if(b===Wn){o.push(s.slice(c,m)),c=m+1;continue}if(b==="/"){l=m;continue}}b==="["?i++:b==="]"?i--:b==="("?a++:b===")"&&a--}const d=o.length===0?s:s.slice(c);let h=d,f=!1;d.endsWith(Fr)?(h=d.slice(0,-1),f=!0):d.startsWith(Fr)&&(h=d.slice(1),f=!0);const v=l&&l>c?l-c:void 0;return qn(o,f,h,v)};if(e){const s=e+Wn,o=n;n=i=>i.startsWith(s)?o(i.slice(s.length)):qn(pl,!1,i,void 0,!0)}if(r){const s=n;n=o=>r({className:o,parseClassName:s})}return n},ml=t=>{const e=new Map;
vendor: 1,081 bytes, line 45
45return t.orderSensitiveModifiers.forEach((r,n)=>{e.set(r,1e6+n)}),r=>{const n=[];let s=[];for(let o=0;o<r.length;o++){const i=r[o],a=i[0]==="[",c=e.has(i);a||c?(s.length>0&&(s.sort(),n.push(...s),s=[]),n.push(i)):s.push(i)}return s.length>0&&(s.sort(),n.push(...s)),n}},vl=t=>({cache:fl(t.cacheSize),parseClassName:gl(t),sortModifiers:ml(t),...sl(t)}),bl=/\s+/,yl=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s,sortModifiers:o}=e,i=[],a=t.trim().split(bl);let c="";for(let l=a.length-1;l>=0;l-=1){const u=a[l],{isExternal:d,modifiers:h,hasImportantModifier:f,baseClassName:v,maybePostfixModifierPosition:m}=r(u);if(d){c=u+(c.length>0?" "+c:c);continue}let b=!!m,_=n(b?v.substring(0,m):v);if(!_){if(!b){c=u+(c.length>0?" "+c:c);continue}if(_=n(v),!_){c=u+(c.length>0?" "+c:c);continue}b=!1}const k=h.length===0?"":h.length===1?h[0]:o(h).join(":"),w=f?k+Fr:k,T=w+_;if(i.indexOf(T)>-1)continue;i.push(T);const I=s(_,b);for(let P=0;P<I.length;++P){const C=I[P];i.push(w+C)}c=u+(c.length>0?" "+c:c)}return c},wl=(...t)=>{let e=0,r,n,s="";for(;e<t.length;
vendor: 4,317 bytes, line 45
45)(r=t[e++])&&(n=Oo(r))&&(s&&(s+=" "),s+=n);return s},Oo=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n<t.length;n++)t[n]&&(e=Oo(t[n]))&&(r&&(r+=" "),r+=e);return r},_l=(t,...e)=>{let r,n,s,o;const i=c=>{const l=e.reduce((u,d)=>d(u),t());return r=vl(l),n=r.cache.get,s=r.cache.set,o=a,a(c)},a=c=>{const l=n(c);if(l)return l;const u=yl(c,r);return s(c,u),u};return o=i,(...c)=>o(wl(...c))},kl=[],W=t=>{const e=r=>r[t]||kl;return e.isThemeGetter=!0,e},Co=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ro=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Sl=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,El=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,xl=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Tl=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Al=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ol=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,we=t=>Sl.test(t),$=t=>!!t&&!Number.isNaN(Number(t)),_e=t=>!!t&&Number.isInteger(Number(t)),Ir=t=>t.endsWith("%")&&$(t.slice(0,-1)),fe=t=>El.test(t),jo=()=>!0,Cl=t=>xl.test(t)&&!Tl.test(t),un=()=>!1,Rl=t=>Al.test(t),jl=t=>Ol.test(t),Pl=t=>!S(t)&&!x(t),Nl=t=>Te(t,Io,un),S=t=>Co.test(t),Re=t=>Te(t,$o,Cl),Hn=t=>Te(t,Bl,$),Il=t=>Te(t,Do,jo),$l=t=>Te(t,Lo,un),Zn=t=>Te(t,Po,un),Ll=t=>Te(t,No,jl),zt=t=>Te(t,Uo,Rl),x=t=>Ro.test(t),lt=t=>Me(t,$o),Dl=t=>Me(t,Lo),Vn=t=>Me(t,Po),Ul=t=>Me(t,Io),zl=t=>Me(t,No),Mt=t=>Me(t,Uo,!0),Ml=t=>Me(t,Do,!0),Te=(t,e,r)=>{const n=Co.exec(t);return n?n[1]?e(n[1]):r(n[2]):!1},Me=(t,e,r=!1)=>{const n=Ro.exec(t);return n?n[1]?e(n[1]):r:!1},Po=t=>t==="position"||t==="percentage",No=t=>t==="image"||t==="url",Io=t=>t==="length"||t==="size"||t==="bg-size",$o=t=>t==="length",Bl=t=>t==="number",Lo=t=>t==="family-name",Do=t=>t==="number"||t==="weight",Uo=t=>t==="shadow",Fl=()=>{const t=W("color"),e=W("font"),r=W("text"),n=W("font-weight"),s=W("tracking"),o=W("leading"),i=W("breakpoint"),a=W("container"),c=W("spacing"),l=W("radius"),u=W("shadow"),d=W("inset-shadow"),h=W("text-shadow"),f=W("drop-shadow"),v=W("blur"),m=W("perspective"),b=W("aspect"),_=W("ease"),k=W("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],I=()=>[...T(),x,S],P=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto","contain","none"],A=()=>[x,S,c],L=()=>[we,"full","auto",...A()],ye=()=>[_e,"none","subgrid",x,S],Ae=()=>["auto",{span:["full",_e,x,S]},_e,x,S],Oe=()=>[_e,"auto",x,S],_n=()=>["auto","min","max","fr",x,S],_r=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Be=()=>["start","end","center","stretch","center-safe","end-safe"],se=()=>["auto",...A()],Ce=()=>[we,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],kr=()=>[we,"screen","full","dvw","lvw","svw","min","max","fit",...A()],Sr=()=>[we,"screen","full","lh","dvh","lvh","svh","min","max","fit",...A()],R=()=>[t,x,S],kn=()=>[...T(),Vn,Zn,{position:[x,S]}],Sn=()=>["no-repeat",{repeat:["","x","y","space","round"]}],En=()=>["auto","cover","contain",Ul,Nl,{size:[x,S]}],Er=()=>[Ir,lt,Re],V=()=>["","none","full",l,x,S],J=()=>["",$,lt,Re],Ct=()=>["solid","dashed","dotted","double"],xn=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],q=()=>[$,Ir,Vn,Zn],Tn=()=>["","none",v,x,S],Rt=()=>["none",$,x,S],jt=()=>["none",$,x,S],xr=()=>[$,x,S],Pt=()=>[we,"full",...A()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[fe],breakpoint:[fe],color:[jo],container:[fe],"drop-shadow":[fe],ease:["in","out","in-out"],font:[Pl],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[fe],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[fe],shadow:[fe],spacing:["px",$],text:[fe],"text-shadow":[fe],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",we,S,x,b]}
vendor: 6,042 bytes, line 45
45],container:["container"],columns:[{columns:[$,S,x,a]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:I()}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{"inset-s":L(),start:L()}],end:[{"inset-e":L(),end:L()}],"inset-bs":[{"inset-bs":L()}],"inset-be":[{"inset-be":L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[_e,"auto",x,S]}],basis:[{basis:[we,"full","auto",a,...A()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[$,we,"auto","initial","none",S]}],grow:[{grow:["",$,x,S]}],shrink:[{shrink:["",$,x,S]}],order:[{order:[_e,"first","last","none",x,S]}],"grid-cols":[{"grid-cols":ye()}],"col-start-end":[{col:Ae()}],"col-start":[{"col-start":Oe()}],"col-end":[{"col-end":Oe()}],"grid-rows":[{"grid-rows":ye()}],"row-start-end":[{row:Ae()}],"row-start":[{"row-start":Oe()}],"row-end":[{"row-end":Oe()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":_n()}],"auto-rows":[{"auto-rows":_n()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"justify-content":[{justify:[..._r(),"normal"]}],"justify-items":[{"justify-items":[...Be(),"normal"]}],"justify-self":[{"justify-self":["auto",...Be()]}],"align-content":[{content:["normal",..._r()]}],"align-items":[{items:[...Be(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Be(),{baseline:["","last"]}]}],"place-content":[{"place-content":_r()}],"place-items":[{"place-items":[...Be(),"baseline"]}],"place-self":[{"place-self":["auto",...Be()]}],p:[{p:A()}],px:[{px:A()}],py:[{py:A()}],ps:[{ps:A()}],pe:[{pe:A()}],pbs:[{pbs:A()}],pbe:[{pbe:A()}],pt:[{pt:A()}],pr:[{pr:A()}],pb:[{pb:A()}],pl:[{pl:A()}],m:[{m:se()}],mx:[{mx:se()}],my:[{my:se()}],ms:[{ms:se()}],me:[{me:se()}],mbs:[{mbs:se()}],mbe:[{mbe:se()}],mt:[{mt:se()}],mr:[{mr:se()}],mb:[{mb:se()}],ml:[{ml:se()}],"space-x":[{"space-x":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"space-y-reverse":["space-y-reverse"],size:[{size:Ce()}],"inline-size":[{inline:["auto",...kr()]}],"min-inline-size":[{"min-inline":["auto",...kr()]}],"max-inline-size":[{"max-inline":["none",...kr()]}],"block-size":[{block:["auto",...Sr()]}],"min-block-size":[{"min-block":["auto",...Sr()]}],"max-block-size":[{"max-block":["none",...Sr()]}],w:[{w:[a,"screen",...Ce()]}],"min-w":[{"min-w":[a,"screen","none",...Ce()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[i]},...Ce()]}],h:[{h:["screen","lh",...Ce()]}],"min-h":[{"min-h":["screen","lh","none",...Ce()]}],"max-h":[{"max-h":["screen","lh",...Ce()]}],"font-size":[{text:["base",r,lt,Re]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Ml,Il]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ir,S]}],"font-family":[{font:[Dl,$l,e]}],"font-features":[{"font-features":[S]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,x,S]}],"line-clamp":[{"line-clamp":[$,"none",x,Hn]}],leading:[{leading:[o,...A()]}],"list-image":[{"list-image":["none",x,S]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",x,S]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:R()}],"text-color":[{text:R()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Ct(),"wavy"]}],"text-decoration-thickness":[{decoration:[$,"from-font","auto",x,Re]}],"text-decoration-color":[{decoration:R()}],"underline-offset":[{"underline-offset":[$,"auto",x,S]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",x,S]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",x,S]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:kn()}],"bg-repeat":[{bg:Sn()}],"bg-size":[{bg:En()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},_e,x,S],radial:["",x,S],conic:[_e,x,S]},zl,Ll]}
45],"bg-color":[{bg:R()}],"gradient-from-pos":[{from:Er()}],"gradient-via-pos":[{via:Er()}],"gradient-to-pos":[{to:Er()}],"gradient-from":[{from:R()}],"gradient-via":[{via:R()}],"gradient-to":[{to:R()}],rounded:[{rounded:V()}],"rounded-s":[{"rounded-s":V()}],"rounded-e":[{"rounded-e":V()}],"rounded-t":[{"rounded-t":V()}],"rounded-r":[{"rounded-r":V()}],"rounded-b":[{"rounded-b":V()}],"rounded-l":[{"rounded-l":V()}],"rounded-ss":[{"rounded-ss":V()}],"rounded-se":[{"rounded-se":V()}],"rounded-ee":[{"rounded-ee":V()}],"rounded-es":[{"rounded-es":V()}],"rounded-tl":[{"rounded-tl":V()}],"rounded-tr":[{"rounded-tr":V()}],"rounded-br":[{"rounded-br":V()}],"rounded-bl":[{"rounded-bl":V()}],"border-w":[{border:J()}],"border-w-x":[{"border-x":J()}],"border-w-y":[{"border-y":J()}],"border-w-s":[{"border-s":J()}],"border-w-e":[{"border-e":J()}],"border-w-bs":[{"border-bs":J()}],"border-w-be":[{"border-be":J()}],"border-w-t":[{"border-t":J()}],"border-w-r":[{"border-r":J()}],"border-w-b":[{"border-b":J()}],"border-w-l":[{"border-l":J()}],"divide-x":[{"divide-x":J()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":J()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Ct(),"hidden","none"]}],"divide-style":[{divide:[...Ct(),"hidden","none"]}],"border-color":[{border:R()}],"border-color-x":[{"border-x":R()}],"border-color-y":[{"border-y":R()}],"border-color-s":[{"border-s":R()}],"border-color-e":[{"border-e":R()}],"border-color-bs":[{"border-bs":R()}],"border-color-be":[{"border-be":R()}],"border-color-t":[{"border-t":R()}],"border-color-r":[{"border-r":R()}],"border-color-b":[{"border-b":R()}],"border-color-l":[{"border-l":R()}
vendor: 5,659 bytes, line 45
45],"divide-color":[{divide:R()}],"outline-style":[{outline:[...Ct(),"none","hidden"]}],"outline-offset":[{"outline-offset":[$,x,S]}],"outline-w":[{outline:["",$,lt,Re]}],"outline-color":[{outline:R()}],shadow:[{shadow:["","none",u,Mt,zt]}],"shadow-color":[{shadow:R()}],"inset-shadow":[{"inset-shadow":["none",d,Mt,zt]}],"inset-shadow-color":[{"inset-shadow":R()}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:R()}],"ring-offset-w":[{"ring-offset":[$,Re]}],"ring-offset-color":[{"ring-offset":R()}],"inset-ring-w":[{"inset-ring":J()}],"inset-ring-color":[{"inset-ring":R()}],"text-shadow":[{"text-shadow":["none",h,Mt,zt]}],"text-shadow-color":[{"text-shadow":R()}],opacity:[{opacity:[$,x,S]}],"mix-blend":[{"mix-blend":[...xn(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":xn()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[$]}],"mask-image-linear-from-pos":[{"mask-linear-from":q()}],"mask-image-linear-to-pos":[{"mask-linear-to":q()}],"mask-image-linear-from-color":[{"mask-linear-from":R()}],"mask-image-linear-to-color":[{"mask-linear-to":R()}],"mask-image-t-from-pos":[{"mask-t-from":q()}],"mask-image-t-to-pos":[{"mask-t-to":q()}],"mask-image-t-from-color":[{"mask-t-from":R()}],"mask-image-t-to-color":[{"mask-t-to":R()}],"mask-image-r-from-pos":[{"mask-r-from":q()}],"mask-image-r-to-pos":[{"mask-r-to":q()}],"mask-image-r-from-color":[{"mask-r-from":R()}],"mask-image-r-to-color":[{"mask-r-to":R()}],"mask-image-b-from-pos":[{"mask-b-from":q()}],"mask-image-b-to-pos":[{"mask-b-to":q()}],"mask-image-b-from-color":[{"mask-b-from":R()}],"mask-image-b-to-color":[{"mask-b-to":R()}],"mask-image-l-from-pos":[{"mask-l-from":q()}],"mask-image-l-to-pos":[{"mask-l-to":q()}],"mask-image-l-from-color":[{"mask-l-from":R()}],"mask-image-l-to-color":[{"mask-l-to":R()}],"mask-image-x-from-pos":[{"mask-x-from":q()}],"mask-image-x-to-pos":[{"mask-x-to":q()}],"mask-image-x-from-color":[{"mask-x-from":R()}],"mask-image-x-to-color":[{"mask-x-to":R()}],"mask-image-y-from-pos":[{"mask-y-from":q()}],"mask-image-y-to-pos":[{"mask-y-to":q()}],"mask-image-y-from-color":[{"mask-y-from":R()}],"mask-image-y-to-color":[{"mask-y-to":R()}],"mask-image-radial":[{"mask-radial":[x,S]}],"mask-image-radial-from-pos":[{"mask-radial-from":q()}],"mask-image-radial-to-pos":[{"mask-radial-to":q()}],"mask-image-radial-from-color":[{"mask-radial-from":R()}],"mask-image-radial-to-color":[{"mask-radial-to":R()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[$]}],"mask-image-conic-from-pos":[{"mask-conic-from":q()}],"mask-image-conic-to-pos":[{"mask-conic-to":q()}],"mask-image-conic-from-color":[{"mask-conic-from":R()}],"mask-image-conic-to-color":[{"mask-conic-to":R()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:kn()}],"mask-repeat":[{mask:Sn()}],"mask-size":[{mask:En()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",x,S]}],filter:[{filter:["","none",x,S]}],blur:[{blur:Tn()}],brightness:[{brightness:[$,x,S]}],contrast:[{contrast:[$,x,S]}],"drop-shadow":[{"drop-shadow":["","none",f,Mt,zt]}],"drop-shadow-color":[{"drop-shadow":R()}],grayscale:[{grayscale:["",$,x,S]}],"hue-rotate":[{"hue-rotate":[$,x,S]}],invert:[{invert:["",$,x,S]}],saturate:[{saturate:[$,x,S]}],sepia:[{sepia:["",$,x,S]}],"backdrop-filter":[{"backdrop-filter":["","none",x,S]}],"backdrop-blur":[{"backdrop-blur":Tn()}],"backdrop-brightness":[{"backdrop-brightness":[$,x,S]}],"backdrop-contrast":[{"backdrop-contrast":[$,x,S]}],"backdrop-grayscale":[{"backdrop-grayscale":["",$,x,S]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[$,x,S]}],"backdrop-invert":[{"backdrop-invert":["",$,x,S]}],"backdrop-opacity":[{"backdrop-opacity":[$,x,S]}],"backdrop-saturate":[{"backdrop-saturate":[$,x,S]}],"backdrop-sepia":[{"backdrop-sepia":["",$,x,S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":A()}],"border-spacing-x":[{"border-spacing-x":A()}],"border-spacing-y":[{"border-spacing-y":A()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",x,S]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[$,"initial",x,S]}],ease:[{ease:["linear","initial",_,x,S]}],delay:[{delay:[$,x,S]}],animate:[{animate:["none",k,x,S]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,x,S]}],"perspective-origin":[{"perspective-origin":I()}],rotate:[{rotate:Rt()}],"rotate-x":[{"rotate-x":Rt()}],"rotate-y":[{"rotate-y":Rt()}],"rotate-z":[{"rotate-z":Rt()}],scale:[{scale:jt()}],"scale-x":[{"scale-x":jt()}],"scale-y":[{"scale-y":jt()}],"scale-z":[{"scale-z":jt()}],"scale-3d":["scale-3d"],skew:[{skew:xr()}],"skew-x":[{"skew-x":xr()}],"skew-y":[{"skew-y":xr()}],transform:[{transform:[x,S,"","none","gpu","cpu"]}],"transform-origin":[{origin:I()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Pt()}],"translate-x":[{"translate-x":Pt()}],"translate-y":[{"translate-y":Pt()}],"translate-z":[{"translate-z":Pt()}],"translate-none":["translate-none"],accent:[{accent:R()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:R()}
vendor: 5,667 bytes, line 45
45],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",x,S]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mbs":[{"scroll-mbs":A()}],"scroll-mbe":[{"scroll-mbe":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pbs":[{"scroll-pbs":A()}],"scroll-pbe":[{"scroll-pbe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",x,S]}],fill:[{fill:["none",...R()]}],"stroke-w":[{stroke:[$,lt,Re,Hn]}],stroke:[{stroke:["none",...R()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Wl=_l(Fl);function At(...t){return Wl(el(t))}const ql=Yc,Hl=Xc,zo=g.forwardRef(({className:t,...e},r)=>p.jsx(wo,{ref:r,className:At("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));zo.displayName=wo.displayName;const Mo=g.forwardRef(({className:t,children:e,...r},n)=>p.jsxs(Hl,{children:[p.jsx(zo,{}),p.jsxs(_o,{ref:n,className:At("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rou
45nded-lg",t),...r,children:[e,p.jsxs(Qc,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[p.jsx(Ws,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Mo.displayName=_o.displayName;const Bo=({className:t,...e})=>p.jsx("div",{className:At("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Bo.displayName="DialogHeader";const Fo=g.forwardRef(({className:t,...e},r)=>p.jsx(ko,{ref:r,className:At("text-lg font-semibold leading-none tracking-tight",t),...e}));Fo.displayName=ko.displayName;const Wo=g.forwardRef(({className:t,...e},r)=>p.jsx(So,{ref:r,className:At("text-sm text-muted-foreground",t),...e}));Wo.displayName=So.displayName;const Jn="/assets/aj-portrait-BL9IcrDo.jpg",Zl="/assets/aj-in-action-Bu5MEmW4.jpg";function Vl({open:t,onOpenChange:e}){return p.jsx(ql,{open:t,onOpenChange:e,children:p.jsx(Mo,{className:"max-h-[90vh] w-[95vw] max-w-4xl overflow-y-auto border-border bg-background p-0 sm:rounded-2xl",children:p.jsxs("div",{className:"grid gap-0 md:grid-cols-[1fr_1.1fr]",children:[p.jsx("div",{className:"relative hidden md:block bg-black",children:p.jsx("img",{src:Jn,alt:"AJ Vazquez, founder of Cadenza Events",className:"h-full w-full object-cover object-[50%_18%]"})}),p.jsxs("div",{className:"flex flex-col gap-6 p-6 sm:p-10",children:[p.jsxs(Bo,{className:"space-y-3 text-left",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("span",{className:"gold-divider"}),p.jsx("span",{className:"text-[11px] uppercase tracking-[0.32em] text-gold",children:"Our Team"})]}),p.jsxs(Fo,{className:"font-display text-3xl leading-tight text-foreground sm:text-4xl",children:["Meet ",p.jsx("span",{className:"text-gold",children:"AJ Vazquez"})]}),p.jsx(Wo,{className:"text-[11px] uppercase tracking-[0.24em] text-muted-foreground sm:text-xs",children:"DJ · Founder · Creative Behind Cadenza Events"})]}),p.jsx("div",{className:"md:hidden",children:p.jsx("img",{src:Jn,alt:"AJ Vazquez, founder of Cadenza Events",className:"aspect-[4/5] w-full rounded-xl object-cover object-[50%_18%]"})}),p.jsxs("div",{className:"space-y-4 text-sm leading-relaxed text-muted-foreground sm:text-base",children:[p.jsxs("p",{children:["I started ",p.jsx("span",{className:"text-foreground",children:"Cadenza Events"})," because I've always believed people deserve more than a cookie cutter event experience. The music matters. The atmosphere matters. The way people feel when they walk into the room matters."]}),p.jsx("p",{children:"Over the years, I've had the honor of being part of more than 2,000 weddings and events across South Florida. Every crowd, every family and every celebration has taught me something different about how important these moments really are."}),p.jsx("p",{children:"That experience eventually led to recognitions like Best of Zola, the WeddingPro Couples' Choice Award and being named Best Event & Wedding DJ in South Florida, but what means the most to me has always been the trust people place in us to be part of such an important day in their lives."}),p.jsx("p",{children:"No two events are ever the same, and honestly, that's what I love most about this work. I love getting to know my clients, understanding what matters to them and helping create an atmosphere that feels natural, personal and genuinely fun for everyone in the room."}),p.jsxs("p",{children:["That's the heart behind ",p.jsx("span",{className:"text-foreground",children:"Cadenza Events"}),"."]})]}),p.jsx("div",{className:"overflow-hidden rounded-xl border border-border",children:p.jsx("img",{src:Zl,alt:"AJ Vazquez performing at a Cadenza event",className:"aspect-[16/10] w-full object-cover"})})]})]})})})}const qo="/assets/cadenza-logo-DHste1Cp.png",Ho="/assets/cadenza-logo-gold-DcXkX72m.png",Kn=[{label:"Services",to:"/services"},{label:"Experiences",to:"/",hash:"experiences"},{label:"Our Team",action:"team"},{label:"Contact",to:"/",hash:"contact"}];function Qm(){const[t,e]=g.useState(!1),[r,n]=g.useState(!1),[s,o]=g.useState(!1);return g.useEffect(()=>{const i=()=>e(window.scrollY>8);return i(),window.addEventListener("scroll",i,{passive:!0}),()=>window.removeEventListener("scroll",i)},[]),p.jsxs("header",{className:`fixed inset-x-0 top-0 z-50 transition-all duration-500 ${t?"border-b border-border bg-background/80 backdrop-blur-xl":"bg-transparent"}`,children:[p.jsxs("div",{className:"mx-auto flex max-w-7xl items-center justify-between px-6 py-4 lg:px-10",children:[p.jsxs(pe,{to:"/",className:"group flex items-center",children:[p.jsx("img",{src:qo,alt:"Cadenza Events",className:"hidden h-16 w-auto opacity-90 transition-opacity group-hover:opacity-100 dark:block md:h-20"}),p.jsx("img",{src:Ho,alt:"Cadenza Events",className:"block h-16 w-auto opacity-90 transition-opacity group-hover:opacity-100 dark:hidden md:h-20"})]}),p.jsx("nav",{className:"hidden items-center gap-10 md:flex",children:Kn.map(i=>"action"in i?p.jsx("button",{type:"button",onClick:()=>o(!0),className:"text-sm tracking-wide text-muted-foreground transition-colors hover:text-foreground",children:i.label},i.label):"hash"in i?p.jsx(pe,{to:i.to,hash:i.hash,className:"text-sm tracking-wide text-muted-foreground transition-colors hover:text-foreground",children:i.label},i.label):p.jsx(pe,{to:i.to,activeProps:{className:"text-foreground"},className:"text-sm tracking-wide text-muted-foreground transition-colors hover:text-foreground",children:i.label},i.label))}),p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(ua,{}),p.jsx(pe,{to:"/",hash:"contact",className:"hidden rounded-full border border-gold px-5 py-2 text-xs uppercase tracking-[0.2em] text-gold transition-all hover:bg-gold hover:text-gold-foreground md:inline-block",children:"Contact Us"}),p.jsx("button",{className:"md:hidden","aria-label":"Open menu",onClick:()=>n(i=>!i),children:r?p.jsx(Ws,{className:"h-5 w-5"}):p.jsx(Qi,{className:"h-5 w-5"})})]})]}),r&&p.jsx("div",{className:"border-t border-border bg-background/95 backdrop-blur-xl md:hidden",children:p.jsxs("nav",{className:"flex flex-col gap-1 px-6 py-4",children:[Kn.map(i=>"action"in i?p.jsx("button",{type:"button",onClick:()=>{n(!1),o(!0)},className:"rounded-md px-3 py-3 text-left text-sm text-foreground
45/80 hover:bg-muted hover:text-foreground",children:i.label},i.label):"hash"in i?p.jsx(pe,{to:i.to,hash:i.hash,onClick:()=>n(!1),className:"rounded-md px-3 py-3 text-sm text-foreground/80 hover:bg-muted hover:text-foreground",children:i.label},i.label):p.jsx(pe,{to:i.to,onClick:()=>n(!1),className:"rounded-md px-3 py-3 text-sm text-foreground/80 hover:bg-muted hover:text-foreground",children:i.label},i.label)),p.jsx(pe,{to:"/",hash:"contact",onClick:()=>n(!1),className:"mt-2 rounded-full border border-gold px-5 py-3 text-center text-xs uppercase tracking-[0.2em] text-gold",children:"Contact Us"})]})}),p.jsx(Vl,{open:s,onOpenChange:o})]})}function y(t,e,r){function n(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,c);const l=i.prototype,u=Object.keys(l);for(let d=0;d<u.length;d++){const h=u[d];h in a||(a[h]=l[h].bind(a))}}const s=r?.Parent??Object;class o extends s{}Object.defineProperty(o,"name",{value:t});function i(a){var c;const l=r?.Parent?new o:this;n(l,a),(c=l._zod).deferred??(c.deferred=[]);for(const u of l._zod.deferred)u();return l}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(i,"name",{value:t}),i}class st extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Zo extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const Jl={};function De(t){return Jl}function Wr(t,e){return typeof e=="bigint"?e.toString():e}function dn(t){return t==null}function hn(t){const e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}const Gn=Symbol("evaluating");function D(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==Gn)return n===void 0&&(n=Gn,n=r()),n},set(s){Object.defineProperty(t,e,{value:s})},configurable:!0})}function Kl(...t){const e={};for(const r of t){const n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function Gl(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Vo="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function Yn(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function qr(t){if(Yn(t)===!1)return!1;const e=t.constructor;if(e===void 0||typeof e!="function")return!0;const r=e.prototype;return!(Yn(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Jo(t){return qr(t)?{...t}:Array.isArray(t)?[...t]:t}function fn(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Yl(t,e,r){const n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function N(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function tt(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function Xl(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function Bt(t){return typeof t=="string"?t:t?.message}function Ue(t,e,r){const n={...t,path:t.path??[]};if(!t.message){const s=Bt(t.inst?._zod.def?.error?.(t))??Bt(e?.error?.(t))??Bt(r.customError?.(t))??Bt(r.localeError?.(t))??"Invalid input";n.message=s}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function pn(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function yt(...t){const[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}const Ko=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,Wr,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Go=y("$ZodError",Ko),Yo=y("$ZodError",Ko,{Parent:Error});function Ql(t,e=r=>r.message){const r={},n=[];for(const s of t.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:r}}function eu(t,e=r=>r.message){const r={_errors:[]},n=s=>{for(const o of s.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(i=>n({issues:i}));else if(o.code==="invalid_key")n({issues:o.issues});else if(o.code==="invalid_element")n({issues:o.issues});else if(o.path.length===0)r._errors.push(e(o));else{let i=r,a=0;for(;a<o.path.length;){const c=o.path[a];a===o.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(e(o))):i[c]=i[c]||{_errors:[]},i=i[c],a++}}};return n(t),r}const gn=t=>(e,r,n,s)=>{const o=n?Object.assign(n,{async:!1}):{async:!1},i=e._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new st;if(i.issues.length){const a=new(s?.Err??t)(i.issues.map(c=>Ue(c,o,De())));throw Vo(a,s?.callee),a}return i.value},mn=t=>async(e,r,n,s)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let i=e._zod.run({value:r,issues:[]},o);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new(s?.Err??t)(i.issues.map(c=>Ue(c,o,De())));throw Vo(a,s?.callee),a}return i.value},gr=t=>(e,r,n)=>{const s=n?{...n,async:!1}:{async:!1},o=e._zod.run({value:r,issues:[]},s);if(o instanceof Promise)throw new st;return o.issues.length?{success:!1,error:new(t??Go)(o.issues.map(i=>Ue(i,s,De())))}:{success:!0,data:o.value}},tu=gr(Yo),mr=t=>async(e,r,n)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let o=e._zod.run({value:r,issues:[]},s);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new t(o.issues.map(i=>Ue(i,s,De())))}:{success:!0,data:o.value}},ru=mr(Yo),nu=t=>(e,r,n)=>{const s=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return gn(t)(e,r,s)},su=t=>(e,r,n)=>gn(t)(e,r,n),ou=t=>async(e,r,n)=>{const s=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return mn(t)(e,r,s)},iu=t=>async(e,r,n)=>mn(t)(e,r,n),au=t=>(e,r,n)=>{const s=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return gr(t)(e,r,s)},cu=t=>(e,r,n)=>gr(t)(e,r,n),lu=t=>async(e,r,n)=>{const s=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return mr(t)(e,r,s)},uu=t=>async(e,r,n)=>mr(t)(e,r,n),du=/^[cC][^\s-]{8,}
vendor: 4,141 bytes, line 45
45$/,hu=/^[0-9a-z]+$/,fu=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,pu=/^[0-9a-vA-V]{20}$/,gu=/^[A-Za-z0-9]{27}$/,mu=/^[a-zA-Z0-9_-]{21}$/,vu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,bu=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Xn=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,yu=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,wu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function _u(){return new RegExp(wu,"u")}const ku=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Su=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Eu=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,xu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Tu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Xo=/^[A-Za-z0-9_-]*$/,Au=/^\+[1-9]\d{6,14}$/,Qo="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Ou=new RegExp(`^${Qo}$`);function ei(t){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Cu(t){return new RegExp(`^${ei(t)}$`)}function Ru(t){const e=ei({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${e}(?:${r.join("|")})`;return new RegExp(`^${Qo}T(?:${n})$`)}const ju=t=>{const e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},Pu=/^[^A-Z]*$/,Nu=/^[^a-z]*$/,he=y("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),Iu=y("$ZodCheckMaxLength",(t,e)=>{var r;he.init(t,e),(r=t._zod.def).when??(r.when=n=>{const s=n.value;return!dn(s)&&s.length!==void 0}),t._zod.onattach.push(n=>{const s=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<s&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{const s=n.value;if(s.length<=e.maximum)return;const i=pn(s);n.issues.push({origin:i,code:"too_big",maximum:e.maximum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),$u=y("$ZodCheckMinLength",(t,e)=>{var r;he.init(t,e),(r=t._zod.def).when??(r.when=n=>{const s=n.value;return!dn(s)&&s.length!==void 0}),t._zod.onattach.push(n=>{const s=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>s&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{const s=n.value;if(s.length>=e.minimum)return;const i=pn(s);n.issues.push({origin:i,code:"too_small",minimum:e.minimum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),Lu=y("$ZodCheckLengthEquals",(t,e)=>{var r;he.init(t,e),(r=t._zod.def).when??(r.when=n=>{const s=n.value;return!dn(s)&&s.length!==void 0}),t._zod.onattach.push(n=>{const s=n._zod.bag;s.minimum=e.length,s.maximum=e.length,s.length=e.length}),t._zod.check=n=>{const s=n.value,o=s.length;if(o===e.length)return;const i=pn(s),a=o>e.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),vr=y("$ZodCheckStringFormat",(t,e)=>{var r,n;he.init(t,e),t._zod.onattach.push(s=>
vendor: 16,143 bytes, line 45
45{const o=s._zod.bag;o.format=e.format,e.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=s=>{e.pattern.lastIndex=0,!e.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:e.format,input:s.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),Du=y("$ZodCheckRegex",(t,e)=>{vr.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),Uu=y("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Pu),vr.init(t,e)}),zu=y("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Nu),vr.init(t,e)}),Mu=y("$ZodCheckIncludes",(t,e)=>{he.init(t,e);const r=fn(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(s=>{const o=s._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),t._zod.check=s=>{s.value.includes(e.includes,e.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:s.value,inst:t,continue:!e.abort})}}),Bu=y("$ZodCheckStartsWith",(t,e)=>{he.init(t,e);const r=new RegExp(`^${fn(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),Fu=y("$ZodCheckEndsWith",(t,e)=>{he.init(t,e);const r=new RegExp(`.*${fn(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}}),Wu=y("$ZodCheckOverwrite",(t,e)=>{he.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}}),qu={major:4,minor:3,patch:6},Y=y("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=qu;const n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(const s of n)for(const o of s._zod.onattach)o(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{const s=(i,a,c)=>{let l=tt(i),u;for(const d of a){if(d._zod.def.when){if(!d._zod.def.when(i))continue}else if(l)continue;const h=i.issues.length,f=d._zod.check(i);if(f instanceof Promise&&c?.async===!1)throw new st;if(u||f instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await f,i.issues.length!==h&&(l||(l=tt(i,h)))});else{if(i.issues.length===h)continue;l||(l=tt(i,h))}}return u?u.then(()=>i):i},o=(i,a,c)=>{if(tt(i))return i.aborted=!0,i;const l=s(a,n,c);if(l instanceof Promise){if(c.async===!1)throw new st;return l.then(u=>t._zod.parse(u,c))}return t._zod.parse(l,c)};t._zod.run=(i,a)=>{if(a.skipChecks)return t._zod.parse(i,a);if(a.direction==="backward"){const l=t._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return l instanceof Promise?l.then(u=>o(u,i,a)):o(l,i,a)}const c=t._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new st;return c.then(l=>s(l,n,a))}return s(c,n,a)}}D(t,"~standard",()=>({validate:s=>{try{const o=tu(t,s);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return ru(t,s).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),vn=y("$ZodString",(t,e)=>{Y.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??ju(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),z=y("$ZodStringFormat",(t,e)=>{vr.init(t,e),vn.init(t,e)}),Hu=y("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=bu),z.init(t,e)}),Zu=y("$ZodUUID",(t,e)=>{if(e.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Xn(n))}else e.pattern??(e.pattern=Xn());z.init(t,e)}),Vu=y("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=yu),z.init(t,e)}),Ju=y("$ZodURL",(t,e)=>{z.init(t,e),t._zod.check=r=>{try{const n=r.value.trim(),s=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(s.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=s.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),Ku=y("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=_u()),z.init(t,e)}),Gu=y("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=mu),z.init(t,e)}),Yu=y("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=du),z.init(t,e)}),Xu=y("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=hu),z.init(t,e)}),Qu=y("$ZodULID",(t,e)=>{e.pattern??(e.pattern=fu),z.init(t,e)}),ed=y("$ZodXID",(t,e)=>{e.pattern??(e.pattern=pu),z.init(t,e)}),td=y("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=gu),z.init(t,e)}),rd=y("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=Ru(e)),z.init(t,e)}),nd=y("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=Ou),z.init(t,e)}),sd=y("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Cu(e)),z.init(t,e)}),od=y("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=vu),z.init(t,e)}),id=y("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=ku),z.init(t,e),t._zod.bag.format="ipv4"}),ad=y("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Su),z.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),cd=y("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=Eu),z.init(t,e)}),ld=y("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=xu),z.init(t,e),t._zod.check=r=>{const n=r.value.split("/");try{if(n.length!==2)throw new Error;const[s,o]=n;if(!o)throw new Error;const i=Number(o);if(`${i}`!==o)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${s}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function ti(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const ud=y("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Tu),z.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{ti(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function dd(t){if(!Xo.test(t))return!1;const e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return ti(r)}const hd=y("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Xo),z.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{dd(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),fd=y("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Au),z.init(t,e)});function pd(t,e=null){try{const r=t.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const s=JSON.parse(atob(n));return!("typ"in s&&s?.typ!=="JWT"||!s.alg||e&&(!("alg"in s)||s.alg!==e))}catch{return!1}}const gd=y("$ZodJWT",(t,e)=>{z.init(t,e),t._zod.check=r=>{pd(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}});function Qn(t,e,r){t.issues.length&&e.issues.push(...Xl(r,t.issues)),e.value[r]=t.value}const md=y("$ZodArray",(t,e)=>{Y.init(t,e),t._zod.parse=(r,n)=>{const s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:t}),r;r.value=Array(s.length);const o=[];for(let i=0;i<s.length;i++){const a=s[i],c=e.element._zod.run({value:a,issues:[]},n);c instanceof Promise?o.push(c.then(l=>Qn(l,r,i))):Qn(c,r,i)}return o.length?Promise.all(o).then(()=>r):r}});function es(t,e,r,n){for(const o of t)if(o.issues.length===0)return e.value=o.value,e;const s=t.filter(o=>!tt(o));return s.length===1?(e.value=s[0].value,s[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(o=>o.issues.map(i=>Ue(i,n,De())))}),e)}const vd=y("$ZodUnion",(t,e)=>{Y.init(t,e),D(t._zod,"optin",()=>e.options.some(s=>s._zod.optin==="optional")?"optional":void 0),D(t._zod,"optout",()=>e.options.some(s=>s._zod.optout==="optional")?"optional":void 0),D(t._zod,"values",()=>{if(e.options.every(s=>s._zod.values))return new Set(e.options.flatMap(s=>Array.from(s._zod.values)))}),D(t._zod,"pattern",()=>{if(e.options.every(s=>s._zod.pattern)){const s=e.options.map(o=>o._zod.pattern);return new RegExp(`^(${s.map(o=>hn(o.source)).join("|")})$`)}});const r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(s,o)=>{if(r)return n(s,o);let i=!1;const a=[];for(const c of e.options){const l=c._zod.run({value:s.value,issues:[]},o);if(l instanceof Promise)a.push(l),i=!0;else{if(l.issues.length===0)return l;a.push(l)}}return i?Promise.all(a).then(c=>es(c,s,t,o)):es(a,s,t,o)}}),bd=y("$ZodIntersection",(t,e)=>{Y.init(t,e),t._zod.parse=(r,n)=>{const s=r.value,o=e.left._zod.run({value:s,issues:[]},n),i=e.right._zod.run({value:s,issues:[]},n);return o instanceof Promise||i instanceof Promise?Promise.all([o,i]).then(([c,l])=>ts(r,c,l)):ts(r,o,i)}});function Hr(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(qr(t)&&qr(e)){const r=Object.keys(e),n=Object.keys(t).filter(o=>r.indexOf(o)!==-1),s={...t,...e};for(const o of n){const i=Hr(t[o],e[o]);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};s[o]=i.data}return{valid:!0,data:s}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<t.length;n++){const s=t[n],o=e[n],i=Hr(s,o);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function ts(t,e,r){const n=new Map;let s;for(const a of e.issues)if(a.code==="unrecognized_keys"){s??(s=a);for(const c of a.keys)n.has(c)||n.set(c,{}),n.get(c).l=!0}else t.issues.push(a);for(const a of r.issues)if(a.code==="unrecognized_keys")for(const c of a.keys)n.has(c)||n.set(c,{}),n.get(c).r=!0;else t.issues.push(a);const o=[...n].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(o.length&&s&&t.issues.push({...s,keys:o}),tt(t))return t;const i=Hr(e.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return t.value=i.data,t}const yd=y("$ZodTransform",(t,e)=>{Y.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Zo(t.constructor.name);const s=e.transform(r.value,r);if(n.async)return(s instanceof Promise?s:Promise.resolve(s)).then(i=>(r.value=i,r));if(s instanceof Promise)throw new st;return r.value=s,r}});function rs(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}const ri=y("$ZodOptional",(t,e)=>{Y.init(t,e),t._zod.optin="optional",t._zod.optout="optional",D(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),D(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${hn(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(e.innerType._zod.optin==="optional"){const s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>rs(o,r.value)):rs(s,r.value)}return r.value===void 0?r:e.innerType._zod.run(r,n)}}),wd=y("$ZodExactOptional",(t,e)=>{ri.init(t,e),D(t._zod,"values",()=>e.innerType._zod.values),D(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(r,n)=>e.innerType._zod.run(r,n)}),_d=y("$ZodNullable",(t,e)=>{Y.init(t,e),D(t._zod,"optin",()=>e.innerType._zod.optin),D(t._zod,"optout",()=>e.innerType._zod.optout),D(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${hn(r.source)}|null)$`):void 0}),D(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),kd=y("$ZodDefault",(t,e)=>{Y.init(t,e),t._zod.optin="optional",D(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;const s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>ns(o,e)):ns(s,e)}});function ns(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const Sd=y("$ZodPrefault",(t,e)=>{Y.init(t,e),t._zod.optin="optional",D(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),Ed=y("$ZodNonOptional",(t,e)=>{Y.init(t,e),D(t._zod,"values",()=>{const r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{const s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>ss(o,t)):ss(s,t)}});function ss(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}const xd=y("$ZodCatch",(t,e)=>{Y.init(t,e),D(t._zod,"optin",()=>e.innerType._zod.optin),D(t._zod,"optout",()=>e.innerType._zod.optout),D(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);const s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(i=>Ue(i,n,De()))},input:r.value}),r.issues=[]),r)):(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(o=>Ue(o,n,De()))},input:r.value}),r.issues=[]),r)}}),Td=y("$ZodPipe",(t,e)=>{Y.init(t,e),D(t._zod,"values",()=>e.in._zod.values),D(t._zod,"optin",()=>e.in._zod.optin),D(t._zod,"optout",()=>e.out._zod.optout),D(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){const o=e.out._zod.run(r,n);return o instanceof Promise?o.then(i=>Ft(i,e.in,n)):Ft(o,e.in,n)}const s=e.in._zod.run(r,n);return s instanceof Promise?s.then(o=>Ft(o,e.out,n)):Ft(s,e.out,n)}});function Ft(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}const Ad=y("$ZodReadonly",(t,e)=>{Y.init(t,e),D(t._zod,"propValues",()=>e.innerType._zod.propValues),D(t._zod,"values",()=>e.innerType._zod.values),D(t._zod,"optin",()=>e.innerType?._zod?.optin),D(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);const s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(os):os(s)}});function os(t){return t.value=Object.freeze(t.value),t}const Od=y("$ZodCustom",(t,e)=>{he.init(t,e),Y.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{const n=r.value,s=e.fn(n);if(s instanceof Promise)return s.then(o=>is(o,r,n,t));is(s,r,n,t)}});function is(t,e,r,n){if(!t){const s={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(s.params=n._zod.def.params),e.issues.push(yt(s))}}var as;class Cd{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){const n=r[0];return this._map.set(e,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){const r=e._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const s={...n,...this._map.get(e)};return Object.keys(s).length?s:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Rd(){return new Cd}(as=globalThis).__zod_globalRegistry??(as.__zod_globalRegistry=Rd());const dt=globalThis.__zod_globalRegistry;
vendor: 4,266 bytes, line 45
45function jd(t,e){return new t({type:"string",...N(e)})}function Pd(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...N(e)})}function cs(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...N(e)})}function Nd(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...N(e)})}function Id(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...N(e)})}function $d(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...N(e)})}function Ld(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...N(e)})}function Dd(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...N(e)})}function Ud(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...N(e)})}function zd(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...N(e)})}function Md(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...N(e)})}function Bd(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...N(e)})}function Fd(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...N(e)})}function Wd(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...N(e)})}function qd(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...N(e)})}function Hd(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...N(e)})}function Zd(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...N(e)})}function Vd(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...N(e)})}function Jd(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...N(e)})}function Kd(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...N(e)})}function Gd(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...N(e)})}function Yd(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...N(e)})}function Xd(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...N(e)})}function Qd(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...N(e)})}function eh(t,e){return new t({type:"string",format:"date",check:"string_format",...N(e)})}function th(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...N(e)})}function rh(t,e){return new t({type:"string",format:"duration",check:"string_format",...N(e)})}function ni(t,e){return new Iu({check:"max_length",...N(e),maximum:t})}function nr(t,e){return new $u({check:"min_length",...N(e),minimum:t})}function si(t,e){return new Lu({check:"length_equals",...N(e),length:t})}function nh(t,e){return new Du({check:"string_format",format:"regex",...N(e),pattern:t})}function sh(t){return new Uu({check:"string_format",format:"lowercase",...N(t)})}function oh(t){return new zu({check:"string_format",format:"uppercase",...N(t)})}function ih(t,e){return new Mu({check:"string_format",format:"includes",...N(e),includes:t})}function ah(t,e){return new Bu({check:"string_format",format:"starts_with",...N(e),prefix:t})}function ch(t,e){return new Fu({check:"string_format",format:"ends_with",...N(e),suffix:t})}function at(t){return new Wu({check:"overwrite",tx:t})}function lh(t){return at(e=>e.normalize(t))}function uh(){return at(t=>t.trim())}function dh(){return at(t=>t.toLowerCase())}function hh(){return at(t=>t.toUpperCase())}function fh(){return at(t=>Gl(t))}function ph(t,e,r){return new t({type:"array",element:e,...N(r)})}function gh(t,e,r){return new t({type:"custom",check:"custom",fn:e,...N(r)})}function mh(t){const e=vh(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(yt(n,r.value,e._zod.def));else{const s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),s.continue??(s.continue=!e._zod.def.abort),r.issues.push(yt(s))}},t(r.value,r)));return e}function vh(t,e){const r=new he({check:"custom",...N(e)});return r._zod.check=t,r}
vendor: 4,317 bytes, lines 45-47
45function oi(t){let e=t?.target??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??dt,target:e,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0}}function G(t,e,r={path:[],schemaPath:[]}){var n;const s=t._zod.def,o=e.seen.get(t);if(o)return o.count++,r.schemaPath.includes(t)&&(o.cycle=r.path),o.schema;const i={schema:{},count:1,cycle:void 0,path:r.path};e.seen.set(t,i);const a=t._zod.toJSONSchema?.();if(a)i.schema=a;else{const u={...r,schemaPath:[...r.schemaPath,t],path:r.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,i.schema,u);else{const h=i.schema,f=e.processors[s.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);f(t,e,h,u)}const d=t._zod.parent;d&&(i.ref||(i.ref=d),G(d,e,u),e.seen.get(d).isParent=!0)}const c=e.metadataRegistry.get(t);return c&&Object.assign(i.schema,c),e.io==="input"&&K(t)&&(delete i.schema.examples,delete i.schema.default),e.io==="input"&&i.schema._prefault&&((n=i.schema).default??(n.default=i.schema._prefault)),delete i.schema._prefault,e.seen.get(t).schema}function ii(t,e){const r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=new Map;for(const i of t.seen.entries()){const a=t.metadataRegistry.get(i[0])?.id;if(a){const c=n.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,i[0])}}const s=i=>{const a=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){const d=t.external.registry.get(i[0])?.id,h=t.external.uri??(v=>v);if(d)return{ref:h(d)};const f=i[1].defId??i[1].schema.id??`schema${t.counter++}`;return i[1].defId=f,{defId:f,ref:`${h("__shared")}#/${a}/${f}`}}if(i[1]===r)return{ref:"#"};const l=`#/${a}/`,u=i[1].schema.id??`__schema${t.counter++}`;return{defId:u,ref:l+u}},o=i=>{if(i[1].schema.$ref)return;const a=i[1],{ref:c,defId:l}=s(i);a.def={...a.schema},l&&(a.defId=l);const u=a.schema;for(const d in u)delete u[d];u.$ref=c};if(t.cycles==="throw")for(const i of t.seen.entries()){const a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root> 46 47Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of t.seen.entries()){const a=i[1];if(e===i[0]){o(i);continue}if(t.external){const l=t.external.registry.get(i[0])?.id;if(e!==i[0]&&l){o(i);continue}}if(t.metadataRegistry.get(i[0])?.id){o(i);continue}if(a.cycle){o(i);continue}if(a.count>1&&t.reused==="ref"){o(i);continue}}}function ai(t,e){const r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=i=>{const a=t.seen.get(i);if(a.ref===null)return;const c=a.def??a.schema,l={...c},u=a.ref;if(a.ref=null,u){n(u);const h=t.seen.get(u),f=h.schema;if(f.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(f)):Object.assign(c,f),Object.assign(c,l),i._zod.parent===u)for(const m in c)m==="$ref"||m==="allOf"||m in l||delete c[m];if(f.$ref&&h.def)for(const m in c)m==="$ref"||m==="allOf"||m in h.def&&JSON.stringify(c[m])===JSON.stringify(h.def[m])&&delete c[m]}const d=i._zod.parent;if(d&&d!==u){n(d);const h=t.seen.get(d);if(h?.schema.$ref&&(c.$ref=h.schema.$ref,h.def))for(const f in c)f==="$ref"||f==="allOf"||f in h.def&&JSON.stringify(c[f])===JSON.stringify(h.def[f])&&delete c[f]}t.override({zodSchema:i,jsonSchema:c,path:a.path??[]})};for(const i of[...t.seen.entries()].reverse())n(i[0]);const s={};if(t.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){const i=t.external.registry.get(e)?.id;if(!i)throw new Error("Schema is missing an `id` property");s.$id=t.external.uri(i)}Object.assign(s,r.def??r.schema);const o=t.external?.defs??{};for(const i of t.seen.entries()){const a=i[1];a.def&&a.defId&&(o[a.defId]=a.def)}t.external||Object.keys(o).length>
vendor: 5,695 bytes, line 47
470&&(t.target==="draft-2020-12"?s.$defs=o:s.definitions=o);try{const i=JSON.parse(JSON.stringify(s));return Object.defineProperty(i,"~standard",{value:{...e["~standard"],jsonSchema:{input:sr(e,"input",t.processors),output:sr(e,"output",t.processors)}},enumerable:!1,writable:!1}),i}catch{throw new Error("Error converting schema to JSON.")}}function K(t,e){const r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);const n=t._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return K(n.element,r);if(n.type==="set")return K(n.valueType,r);if(n.type==="lazy")return K(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return K(n.innerType,r);if(n.type==="intersection")return K(n.left,r)||K(n.right,r);if(n.type==="record"||n.type==="map")return K(n.keyType,r)||K(n.valueType,r);if(n.type==="pipe")return K(n.in,r)||K(n.out,r);if(n.type==="object"){for(const s in n.shape)if(K(n.shape[s],r))return!0;return!1}if(n.type==="union"){for(const s of n.options)if(K(s,r))return!0;return!1}if(n.type==="tuple"){for(const s of n.items)if(K(s,r))return!0;return!!(n.rest&&K(n.rest,r))}return!1}const bh=(t,e={})=>r=>{const n=oi({...r,processors:e});return G(t,n),ii(n,t),ai(n,t)},sr=(t,e,r={})=>n=>{const{libraryOptions:s,target:o}=n??{},i=oi({...s??{},target:o,io:e,processors:r});return G(t,i),ii(i,t),ai(i,t)},yh={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},wh=(t,e,r,n)=>{const s=r;s.type="string";const{minimum:o,maximum:i,format:a,patterns:c,contentEncoding:l}=t._zod.bag;if(typeof o=="number"&&(s.minLength=o),typeof i=="number"&&(s.maxLength=i),a&&(s.format=yh[a]??a,s.format===""&&delete s.format,a==="time"&&delete s.format),l&&(s.contentEncoding=l),c&&c.size>0){const u=[...c];u.length===1?s.pattern=u[0].source:u.length>1&&(s.allOf=[...u.map(d=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},_h=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},kh=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Sh=(t,e,r,n)=>{const s=r,o=t._zod.def,{minimum:i,maximum:a}=t._zod.bag;typeof i=="number"&&(s.minItems=i),typeof a=="number"&&(s.maxItems=a),s.type="array",s.items=G(o.element,e,{...n,path:[...n.path,"items"]})},Eh=(t,e,r,n)=>{const s=t._zod.def,o=s.inclusive===!1,i=s.options.map((a,c)=>G(a,e,{...n,path:[...n.path,o?"oneOf":"anyOf",c]}));o?r.oneOf=i:r.anyOf=i},xh=(t,e,r,n)=>{const s=t._zod.def,o=G(s.left,e,{...n,path:[...n.path,"allOf",0]}),i=G(s.right,e,{...n,path:[...n.path,"allOf",1]}),a=l=>"allOf"in l&&Object.keys(l).length===1,c=[...a(o)?o.allOf:[o],...a(i)?i.allOf:[i]];r.allOf=c},Th=(t,e,r,n)=>{const s=t._zod.def,o=G(s.innerType,e,n),i=e.seen.get(t);e.target==="openapi-3.0"?(i.ref=s.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]},Ah=(t,e,r,n)=>{const s=t._zod.def;G(s.innerType,e,n);const o=e.seen.get(t);o.ref=s.innerType},Oh=(t,e,r,n)=>{const s=t._zod.def;G(s.innerType,e,n);const o=e.seen.get(t);o.ref=s.innerType,r.default=JSON.parse(JSON.stringify(s.defaultValue))},Ch=(t,e,r,n)=>{const s=t._zod.def;G(s.innerType,e,n);const o=e.seen.get(t);o.ref=s.innerType,e.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},Rh=(t,e,r,n)=>{const s=t._zod.def;G(s.innerType,e,n);const o=e.seen.get(t);o.ref=s.innerType;let i;try{i=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},jh=(t,e,r,n)=>{const s=t._zod.def,o=e.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;G(o,e,n);const i=e.seen.get(t);i.ref=o},Ph=(t,e,r,n)=>{const s=t._zod.def;G(s.innerType,e,n);const o=e.seen.get(t);o.ref=s.innerType,r.readOnly=!0},ci=(t,e,r,n)=>{const s=t._zod.def;G(s.innerType,e,n);const o=e.seen.get(t);o.ref=s.innerType},Nh=y("ZodISODateTime",(t,e)=>{rd.init(t,e),M.init(t,e)});function Ih(t){return Qd(Nh,t)}const $h=y("ZodISODate",(t,e)=>{nd.init(t,e),M.init(t,e)});function Lh(t){return eh($h,t)}const Dh=y("ZodISOTime",(t,e)=>{sd.init(t,e),M.init(t,e)});function Uh(t){return th(Dh,t)}const zh=y("ZodISODuration",(t,e)=>{od.init(t,e),M.init(t,e)});function Mh(t){return rh(zh,t)}const Bh=(t,e)=>{Go.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>eu(t,r)},flatten:{value:r=>Ql(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,Wr,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,Wr,2)}},isEmpty:{get(){return t.issues.length===0}}})},ne=y("ZodError",Bh,{Parent:Error}),Fh=gn(ne),Wh=mn(ne),qh=gr(ne),Hh=mr(ne),Zh=nu(ne),Vh=su(ne),Jh=ou(ne),Kh=iu(ne),Gh=au(ne),Yh=cu(ne),Xh=lu(ne),Qh=uu(ne),X=y("ZodType",(t,e)=>(Y.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:sr(t,"input"),output:sr(t,"output")}}),t.toJSONSchema=bh(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone(Kl(e,{checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),t.with=t.check,t.clone=(r,n)=>Yl(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.parse=(r,n)=>Fh(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>qh(t,r,n),t.parseAsync=async(r,n)=>Wh(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>Hh(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>Zh(t,r,n),t.decode=(r,n)=>Vh(t,r,n),t.encodeAsync=async(r,n)=>Jh(t,r,n),t.decodeAsync=async(r,n)=>Kh(t,r,n),t.safeEncode=(r,n)=>Gh(t,r,n),t.safeDecode=(r,n)=>Yh(t,r,n),t.safeEncodeAsync=async(r,n)=>
vendor: 4,248 bytes, line 47
47Xh(t,r,n),t.safeDecodeAsync=async(r,n)=>Qh(t,r,n),t.refine=(r,n)=>t.check(qf(r,n)),t.superRefine=r=>t.check(Hf(r)),t.overwrite=r=>t.check(at(r)),t.optional=()=>us(t),t.exactOptional=()=>Rf(t),t.nullable=()=>ds(t),t.nullish=()=>us(ds(t)),t.nonoptional=r=>Df(t,r),t.array=()=>_f(t),t.or=r=>Sf([t,r]),t.and=r=>xf(t,r),t.transform=r=>hs(t,Af(r)),t.default=r=>Nf(t,r),t.prefault=r=>$f(t,r),t.catch=r=>zf(t,r),t.pipe=r=>hs(t,r),t.readonly=()=>Ff(t),t.describe=r=>{const n=t.clone();return dt.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return dt.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return dt.get(t);const n=t.clone();return dt.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t.apply=r=>r(t),t)),li=y("_ZodString",(t,e)=>{vn.init(t,e),X.init(t,e),t._zod.processJSONSchema=(n,s,o)=>wh(t,n,s);const r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(nh(...n)),t.includes=(...n)=>t.check(ih(...n)),t.startsWith=(...n)=>t.check(ah(...n)),t.endsWith=(...n)=>t.check(ch(...n)),t.min=(...n)=>t.check(nr(...n)),t.max=(...n)=>t.check(ni(...n)),t.length=(...n)=>t.check(si(...n)),t.nonempty=(...n)=>t.check(nr(1,...n)),t.lowercase=n=>t.check(sh(n)),t.uppercase=n=>t.check(oh(n)),t.trim=()=>t.check(uh()),t.normalize=(...n)=>t.check(lh(...n)),t.toLowerCase=()=>t.check(dh()),t.toUpperCase=()=>t.check(hh()),t.slugify=()=>t.check(fh())}),ef=y("ZodString",(t,e)=>{vn.init(t,e),li.init(t,e),t.email=r=>t.check(Pd(rf,r)),t.url=r=>t.check(Dd(nf,r)),t.jwt=r=>t.check(Xd(yf,r)),t.emoji=r=>t.check(Ud(sf,r)),t.guid=r=>t.check(cs(ls,r)),t.uuid=r=>t.check(Nd(Wt,r)),t.uuidv4=r=>t.check(Id(Wt,r)),t.uuidv6=r=>t.check($d(Wt,r)),t.uuidv7=r=>t.check(Ld(Wt,r)),t.nanoid=r=>t.check(zd(of,r)),t.guid=r=>t.check(cs(ls,r)),t.cuid=r=>t.check(Md(af,r)),t.cuid2=r=>t.check(Bd(cf,r)),t.ulid=r=>t.check(Fd(lf,r)),t.base64=r=>t.check(Kd(mf,r)),t.base64url=r=>t.check(Gd(vf,r)),t.xid=r=>t.check(Wd(uf,r)),t.ksuid=r=>t.check(qd(df,r)),t.ipv4=r=>t.check(Hd(hf,r)),t.ipv6=r=>t.check(Zd(ff,r)),t.cidrv4=r=>t.check(Vd(pf,r)),t.cidrv6=r=>t.check(Jd(gf,r)),t.e164=r=>t.check(Yd(bf,r)),t.datetime=r=>t.check(Ih(r)),t.date=r=>t.check(Lh(r)),t.time=r=>t.check(Uh(r)),t.duration=r=>t.check(Mh(r))});function tf(t){return jd(ef,t)}const M=y("ZodStringFormat",(t,e)=>{z.init(t,e),li.init(t,e)}),rf=y("ZodEmail",(t,e)=>{Vu.init(t,e),M.init(t,e)}),ls=y("ZodGUID",(t,e)=>{Hu.init(t,e),M.init(t,e)}),Wt=y("ZodUUID",(t,e)=>{Zu.init(t,e),M.init(t,e)}),nf=y("ZodURL",(t,e)=>{Ju.init(t,e),M.init(t,e)}),sf=y("ZodEmoji",(t,e)=>{Ku.init(t,e),M.init(t,e)}),of=y("ZodNanoID",(t,e)=>{Gu.init(t,e),M.init(t,e)}),af=y("ZodCUID",(t,e)=>{Yu.init(t,e),M.init(t,e)}),cf=y("ZodCUID2",(t,e)=>{Xu.init(t,e),M.init(t,e)}),lf=y("ZodULID",(t,e)=>{Qu.init(t,e),M.init(t,e)}),uf=y("ZodXID",(t,e)=>{ed.init(t,e),M.init(t,e)}),df=y("ZodKSUID",(t,e)=>{td.init(t,e),M.init(t,e)}),hf=y("ZodIPv4",(t,e)=>{id.init(t,e),M.init(t,e)}),ff=y("ZodIPv6",(t,e)=>{ad.init(t,e),M.init(t,e)}),pf=y("ZodCIDRv4",(t,e)=>{cd.init(t,e),M.init(t,e)}),gf=y("ZodCIDRv6",(t,e)=>{ld.init(t,e),M.init(t,e)}),mf=y("ZodBase64",(t,e)=>{ud.init(t,e),M.init(t,e)}),vf=y("ZodBase64URL",(t,e)=>{hd.init(t,e),M.init(t,e)}),bf=y("ZodE164",(t,e)=>{fd.init(t,e),M.init(t,e)}),yf=y("ZodJWT",(t,e)=>{gd.init(t,e),M.init(t,e)}),wf=y("ZodArray",(t,e)=>{md.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Sh(t,r,n,s),t.element=e.element,t.min=(r,n)=>t.check(nr(r,n)),t.nonempty=r=>t.check(nr(1,r)),t.max=(r,n)=>t.check(ni(r,n)),t.length=(r,n)=>t.check(si(r,n)),t.unwrap=()=>t.element});function _f(t,e){return ph(wf,t,e)}const kf=y("ZodUnion",(t,e)=>{vd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Eh(t,r,n,s),t.options=e.options});function Sf(t,e){return new kf({type:"union",options:t,...N(e)})}const Ef=y("ZodIntersection",(t,e)=>{bd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,s)=>xh(t,r,n,s)});function xf(t,e){return new Ef({type:"intersection",left:t,right:e})}const Tf=y("ZodTransform",(t,e)=>{yd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,s)=>kh(t,r),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Zo(t.constructor.name);r.addIssue=o=>
47{if(typeof o=="string")r.issues.push(yt(o,r.value,e));else{const i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=t),r.issues.push(yt(i))}};const s=e.transform(r.value,r);return s instanceof Promise?s.then(o=>(r.value=o,r)):(r.value=s,r)}});function Af(t){return new Tf({type:"transform",transform:t})}const Of=y("ZodOptional",(t,e)=>{ri.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,s)=>ci(t,r,n,s),t.unwrap=()=>t._zod.def.innerType});function us(t){return new Of({type:"optional",innerType:t})}const Cf=y("ZodExactOptional",(t,e)=>{wd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,s)=>ci(t,r,n,s),t.unwrap=()=>t._zod.def.innerType});function Rf(t){return new Cf({type:"optional",innerType:t})}const jf=y("ZodNullable",(t,e)=>{_d.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Th(t,r,n,s),t.unwrap=()=>t._zod.def.innerType});function ds(t){return new jf({type:"nullable",innerType:t})}const Pf=y("ZodDefault",(t,e)=>{kd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Oh(t,r,n,s),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function Nf(t,e){return new Pf({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():Jo(e)}})}const If=y("ZodPrefault",(t,e)=>{Sd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Ch(t,r,n,s),t.unwrap=()=>t._zod.def.innerType});function $f(t,e){return new If({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():Jo(e)}})}const Lf=y("ZodNonOptional",(t,e)=>{Ed.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Ah(t,r,n,s),t.unwrap=()=>t._zod.def.innerType});function Df(t,e){return new Lf({type:"nonoptional",innerType:t,...N(e)})}const Uf=y("ZodCatch",(t,e)=>{xd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Rh(t,r,n,s),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function zf(t,e){return new Uf({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const Mf=y("ZodPipe",(t,e)=>{Td.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,s)=>jh(t,r,n,s),t.in=e.in,t.out=e.out});function hs(t,e){return new Mf({type:"pipe",in:t,out:e})}const Bf=y("ZodReadonly",(t,e)=>{Ad.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Ph(t,r,n,s),t.unwrap=()=>t._zod.def.innerType});function Ff(t){return new Bf({type:"readonly",innerType:t})}const Wf=y("ZodCustom",(t,e)=>{Od.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,s)=>_h(t,r)});function qf(t,e={}){return gh(Wf,t,e)}function Hf(t){return mh(t)}const Zf=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class bn extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class Vf extends bn{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class fs extends bn{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class ps extends bn{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var Zr;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(Zr||(Zr={}));class Jf{constructor(e,{headers:r={},customFetch:n,region:s=Zr.Any}={}){this.url=e,this.headers=r,this.region=s,this.fetch=Zf(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return Ja(this,arguments,void 0,function*(r,n={}){var s;let o,i;try{const{headers:a,method:c,body:l,signal:u,timeout:d}=n;let h={},{region:f}=n;f||(f=this.region);const v=new URL(`${this.url}/${r}`);f&&f!=="any"&&(h["x-region"]=f,v.searchParams.set("forceFunctionRegion",f));let m;l&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)?typeof Blob<"u"&&l instanceof Blob||l instanceof ArrayBuffer?(h["Content-Type"]="application/octet-stream",m=l):typeof l=="string"?(h["Content-Type"]="text/plain",m=l):typeof FormData<"u"&&l instanceof FormData?m=l:(h["Content-Type"]="application/json",m=JSON.stringify(l)):l&&typeof l!="string"&&!(typeof Blob<"u"&&l instanceof Blob)&&!(l instanceof ArrayBuffer)&&!(typeof FormData<"u"&&l instanceof FormData)?m=JSON.stringify(l):m=l;let b=u;d&&(i=new AbortController,o=setTimeout(()=>i.abort(),d),u?(b=i.signal,u.addEventListener("abort",()=>i.abort())):b=i.signal);const _=yield this.fetch(v.toString(),{method:c||"POST",headers:Object.assign(Object.assign(Object.assign({},h),this.headers),a),body:m,signal:b}).catch(I=>{throw new Vf(I)}),k=_.headers.get("x-relay-error");
47if(k&&k==="true")throw new fs(_);if(!_.ok)throw new ps(_);let w=((s=_.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),T;return w==="application/json"?T=yield _.json():w==="application/octet-stream"||w==="application/pdf"?T=yield _.blob():w==="text/event-stream"?T=_:w==="multipart/form-data"?T=yield _.formData():T=yield _.text(),{data:T,error:null,response:_}}catch(a){return{data:null,error:a,response:a instanceof ps||a instanceof fs?a.context:void 0}}finally{o&&clearTimeout(o)}})}}const ui=3,gs=t=>Math.min(1e3*2**t,3e4),Kf=[520,503],di=["GET","HEAD","OPTIONS"];var Gf=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function ms(t,e){return new Promise(r=>{if(e?.aborted){r();return}const n=setTimeout(()=>{e?.removeEventListener("abort",s),r()},t);function s(){clearTimeout(n),r()}e?.addEventListener("abort",s)})}function Yf(t,e,r,n){return!(!n||r>=ui||!di.includes(t)||!Kf.includes(e))}var Xf=class{constructor(t){var e,r,n,s,o;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(r=t.isMaybeSingle)!==null&&r!==void 0?r:!1,this.shouldStripNulls=(n=t.shouldStripNulls)!==null&&n!==void 0?n:!1,this.urlLengthLimit=(s=t.urlLengthLimit)!==null&&s!==void 0?s:8e3,this.retryEnabled=(o=t.retry)!==null&&o!==void 0?o:!0,t.fetch?this.fetch=t.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}retry(t){return this.retryEnabled=t,this}then(t,e){var r=this;if(this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const i=this.headers.get("Accept");i==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!i||i==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const n=this.fetch;let o=(async()=>{let i=0;for(;;){const l=new Headers(r.headers);i>0&&l.set("X-Retry-Count",String(i));let u;try{u=await n(r.url.toString(),{method:r.method,headers:l,body:JSON.stringify(r.body,(d,h)=>typeof h=="bigint"?h.toString():h),signal:r.signal})}catch(d){if(d?.name==="AbortError"||d?.code==="ABORT_ERR"||!di.includes(r.method))throw d;if(r.retryEnabled&&i<ui){const h=gs(i);i++,await ms(h,r.signal);continue}throw d}if(Yf(r.method,u.status,i,r.retryEnabled)){var a,c;const d=(a=(c=u.headers)===null||c===void 0?void 0:c.get("Retry-After"))!==null&&a!==void 0?a:null,h=d!==null?Math.max(0,parseInt(d,10)||0)*1e3:gs(i);await u.text(),i++,await ms(h,r.signal);continue}return await r.processResponse(u)}})();return this.shouldThrowOnError||(o=o.catch(i=>{var a;let c="",l="",u="";const d=i?.cause;if(d){var h,f,v,m;const k=(h=d?.message)!==null&&h!==void 0?h:"",w=(f=d?.code)!==null&&f!==void 0?f:"";c=`${(v=i?.name)!==null&&v!==void 0?v:"FetchError"}: ${i?.message}`,c+=` 48 49Caused by: ${(m=d?.name)!==null&&m!==void 0?m:"Error"}: ${k}`,w&&(c+=` (${w})`),d?.stack&&(c+=` 50${d.stack}`)}else{var b;c=(b=i?.stack)!==null&&b!==void 0?b:""}const _=this.url.toString().length;return i?.name==="AbortError"||i?.code==="ABORT_ERR"?(u="",l="Request was aborted (timeout or manual cancellation)",_>this.urlLengthLimit&&(l+=`. Note: Your request URL is ${_} 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.`)):(d?.name==="HeadersOverflowError"||d?.code==="UND_ERR_HEADERS_OVERFLOW")&&(u="",l="HTTP headers exceeded server limits (typically 16KB)",_>this.urlLengthLimit&&(l+=`. Your request URL is ${_} 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.`)),{success:!1,error:{message:`${(a=i?.name)!==null&&a!==void 0?a:"FetchError"}: ${i?.message}`,details:c,hint:l,code:u},data:null,count:null,status:0,statusText:""}}
50)),o.then(t,e)}async processResponse(t){var e=this;let r=null,n=null,s=null,o=t.status,i=t.statusText;if(t.ok){var a,c;if(e.method!=="HEAD"){var l;const h=await t.text();h===""||(e.headers.get("Accept")==="text/csv"||e.headers.get("Accept")&&(!((l=e.headers.get("Accept"))===null||l===void 0)&&l.includes("application/vnd.pgrst.plan+text"))?n=h:n=JSON.parse(h))}const u=(a=e.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),d=(c=t.headers.get("content-range"))===null||c===void 0?void 0:c.split("/");u&&d&&d.length>1&&(s=parseInt(d[1])),e.isMaybeSingle&&Array.isArray(n)&&(n.length>1?(r={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,s=null,o=406,i="Not Acceptable"):n.length===1?n=n[0]:n=null)}else{const u=await t.text();try{r=JSON.parse(u),Array.isArray(r)&&t.status===404&&(n=[],r=null,o=200,i="OK")}catch{t.status===404&&u===""?(o=204,i="No Content"):r={message:u}}if(r&&e.shouldThrowOnError)throw new Gf(r)}return{success:r===null,error:r,data:n,count:s,status:o,statusText:i}}returns(){return this}overrideTypes(){return this}},Qf=class extends Xf{select(t){let e=!1;const r=(t??"*").split("").map(n=>/\s/.test(n)&&!e?"":(n==='"'&&(e=!e),n)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:r,foreignTable:n,referencedTable:s=n}={}){const o=s?`${s}.order`:"order",i=this.url.searchParams.get(o);return this.url.searchParams.set(o,`${i?`${i},`:""}${t}.${e?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:r=e}={}){const n=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${t}`),this}range(t,e,{foreignTable:r,referencedTable:n=r}={}){const s=typeof n>"u"?"offset":`${n}.offset`,o=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(s,`${t}`),this.url.searchParams.set(o,`${e-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:t=!1,verbose:e=!1,settings:r=!1,buffers:n=!1,wal:s=!1,format:o="text"}={}){var i;const a=[t?"analyze":null,e?"verbose":null,r?"settings":null,n?"buffers":null,s?"wal":null].filter(Boolean).join("|"),c=(i=this.headers.get("Accept"))!==null&&i!==void 0?i:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${o}; for="${c}"; options=${a};`),o==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};const vs=new RegExp("[,()]");var Ye=class extends Qf{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){const r=Array.from(new Set(e)).map(n=>typeof n=="string"&&vs.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`in.(${r})`),this}notIn(t,e){const r=Array.from(new Set(e)).map(n=>typeof n=="string"&&vs.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`not.in.(${r})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:r,type:n}={}){let s="";n==="plain"?s="pl":n==="phrase"?s="ph":n==="websearch"&&(s="w");const o=r===void 0?"":`(${r})`;return this.url.searchParams.append(t,`${s}fts${o}.${e}`),this}match(t){return Object.entries(t).filter(([e,r])=>
50r!==void 0).forEach(([e,r])=>{this.url.searchParams.append(e,`eq.${r}`)}),this}not(t,e,r){return this.url.searchParams.append(t,`not.${e}.${r}`),this}or(t,{foreignTable:e,referencedTable:r=e}={}){const n=r?`${r}.or`:"or";return this.url.searchParams.append(n,`(${t})`),this}filter(t,e,r){return this.url.searchParams.append(t,`${e}.${r}`),this}},ep=class{constructor(t,{headers:e={},schema:r,fetch:n,urlLengthLimit:s=8e3,retry:o}){this.url=t,this.headers=new Headers(e),this.schema=r,this.fetch=n,this.urlLengthLimit=s,this.retry=o}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(t,e){const{head:r=!1,count:n}=e??{},s=r?"HEAD":"GET";let o=!1;const i=(t??"*").split("").map(l=>/\s/.test(l)&&!o?"":(l==='"'&&(o=!o),l)).join(""),{url:a,headers:c}=this.cloneRequestState();return a.searchParams.set("select",i),n&&c.append("Prefer",`count=${n}`),new Ye({method:s,url:a,headers:c,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(t,{count:e,defaultToNull:r=!0}={}){var n;const s="POST",{url:o,headers:i}=this.cloneRequestState();if(e&&i.append("Prefer",`count=${e}`),r||i.append("Prefer","missing=default"),Array.isArray(t)){const a=t.reduce((c,l)=>c.concat(Object.keys(l)),[]);if(a.length>
500){const c=[...new Set(a)].map(l=>`"${l}"`);o.searchParams.set("columns",c.join(","))}}return new Ye({method:s,url:o,headers:i,schema:this.schema,body:t,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(t,{onConflict:e,ignoreDuplicates:r=!1,count:n,defaultToNull:s=!0}={}){var o;const i="POST",{url:a,headers:c}=this.cloneRequestState();if(c.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),e!==void 0&&a.searchParams.set("on_conflict",e),n&&c.append("Prefer",`count=${n}`),s||c.append("Prefer","missing=default"),Array.isArray(t)){const l=t.reduce((u,d)=>u.concat(Object.keys(d)),[]);if(l.length>0){const u=[...new Set(l)].map(d=>`"${d}"`);a.searchParams.set("columns",u.join(","))}}return new Ye({method:i,url:a,headers:c,schema:this.schema,body:t,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(t,{count:e}={}){var r;const n="PATCH",{url:s,headers:o}=this.cloneRequestState();return e&&o.append("Prefer",`count=${e}`),new Ye({method:n,url:s,headers:o,schema:this.schema,body:t,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:t}={}){var e;const r="DELETE",{url:n,headers:s}=this.cloneRequestState();return t&&s.append("Prefer",`count=${t}`),new Ye({method:r,url:n,headers:s,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function wt(t){"@babel/helpers - typeof";return wt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wt(t)}function tp(t,e){if(wt(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(wt(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function rp(t){var e=tp(t,"string");return wt(e)=="symbol"?e:e+""}function np(t,e,r){return(e=rp(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function bs(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function qt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?bs(Object(r),!0).forEach(function(n){np(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):bs(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var sp=class hi{constructor(e,{headers:r={},schema:n,fetch:s,timeout:o,urlLengthLimit:i=8e3,retry:a}={}){this.url=e,this.headers=new Headers(r),this.schemaName=n,this.urlLengthLimit=i;const c=s??globalThis.fetch;o!==void 0&&o>0?this.fetch=(l,u)=>{const d=new AbortController,h=setTimeout(()=>d.abort(),o),f=u?.signal;if(f){if(f.aborted)return clearTimeout(h),c(l,u);const v=()=>{clearTimeout(h),d.abort()};return f.addEventListener("abort",v,{once:!0}),c(l,qt(qt({},u),{},{signal:d.signal})).finally(()=>{clearTimeout(h),f.removeEventListener("abort",v)})}return c(l,qt(qt({},u),{},{signal:d.signal})).finally(()=>clearTimeout(h))}:this.fetch=c,this.retry=a}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new ep(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(e){return new hi(this.url,{headers:this.headers,schema:e,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,r={},{head:n=!1,get:s=!1,count:o}={}){var i;let a;const c=new URL(`${this.url}/rpc/${e}`);let l;const u=f=>f!==null&&typeof f=="object"&&(!Array.isArray(f)||f.some(u)),d=n&&Object.values(r).some(u);d?(a="POST",l=r):n||s?(a=n?"HEAD":"GET",Object.entries(r).filter(([f,v])=>v!==void 0).map(([f,v])=>[f,Array.isArray(v)?`{${v.join(",")}}`:`${v}
50`]).forEach(([f,v])=>{c.searchParams.append(f,v)})):(a="POST",l=r);const h=new Headers(this.headers);return d?h.set("Prefer",o?`count=${o},return=minimal`:"return=minimal"):o&&h.set("Prefer",`count=${o}`),new Ye({method:a,url:c,headers:h,schema:this.schemaName,body:l,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class op{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const r=globalThis.process;if(r){const n=r.versions;if(n&&n.node){const s=n.node,o=parseInt(s.replace(/^v/,"").split(".")[0]);return o>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${o} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${o} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option: 51import ws from "ws" 52new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.constructor)return e.constructor;let r=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(r+=` 53 54Suggested solution: ${e.workaround}`),new Error(r)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const ip="2.104.1",ap=`realtime-js/${ip}`,cp="1.0.0",fi="2.0.0",lp=fi,up=1e4,dp=100,Se={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},pi={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},Vr={connecting:"connecting",closing:"closing",closed:"closed"};class hp{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=e??[]}encode(e,r){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(e));let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return r(JSON.stringify(n))}_binaryEncodeUserBroadcastPush(e){var r;return this._isArrayBuffer((r=e.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var r,n;const s=(n=(r=e.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,s)}_encodeJsonUserBroadcastPush(e){var r,n;const s=(n=(r=e.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:{},i=new TextEncoder().encode(JSON.stringify(s)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,i)}_encodeUserBroadcastPush(e,r,n){var s,o;const i=e.topic,a=(s=e.ref)!==null&&s!==void 0?s:"",c=(o=e.join_ref)!==null&&o!==void 0?o:"",l=e.payload.event,u=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},d=Object.keys(u).length===0?"":JSON.stringify(u);if(c.length>255)throw new Error(`joinRef length ${c.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`ref length ${a.length} exceeds maximum of 255`);if(i.length>255)throw new Error(`topic length ${i.length} exceeds maximum of 255`);if(l.length>255)throw new Error(`userEvent length ${l.length} exceeds maximum of 255`);if(d.length>255)throw new Error(`metadata length ${d.length} exceeds maximum of 255`);const h=this.USER_BROADCAST_PUSH_META_LENGTH+c.length+a.length+i.length+l.length+d.length,f=new ArrayBuffer(this.HEADER_LENGTH+h);let v=new DataView(f),m=0;v.setUint8(m++,this.KINDS.userBroadcastPush),v.setUint8(m++,c.length),v.setUint8(m++,a.length),v.setUint8(m++,i.length),v.setUint8(m++,l.length),v.setUint8(m++,d.length),v.setUint8(m++,r),Array.from(c,_=>v.setUint8(m++,_.charCodeAt(0))),Array.from(a,_=>v.setUint8(m++,_.charCodeAt(0))),Array.from(i,_=>v.setUint8(m++,_.charCodeAt(0))),Array.from(l,_=>v.setUint8(m++,_.charCodeAt(0))),Array.from(d,_=>v.setUint8(m++,_.charCodeAt(0)));var b=new Uint8Array(f.byteLength+n.byteLength);return b.set(new Uint8Array(f),0),b.set(new Uint8Array(n),f.byteLength),b.buffer}decode(e,r){if(this._isArrayBuffer(e)){let n=this._binaryDecode(e);return r(n)}if(typeof e=="string"){const n=JSON.parse(e),[s,o,i,a,c]=n;return r({join_ref:s,ref:o,topic:i,event:a,payload:c})}return r({})}_binaryDecode(e){const r=new DataView(e),n=r.getUint8(0),s=new TextDecoder;if(n===this.KINDS.userBroadcast)return this._decodeUserBroadcast(e,r,s)}_decodeUserBroadcast(e,r,n){const s=r.getUint8(1),o=r.getUint8(2),i=r.getUint8(3),a=r.getUint8(4);let c=this.HEADER_LENGTH+4;const l=n.decode(e.slice(c,c+s));c=c+s;
54const u=n.decode(e.slice(c,c+o));c=c+o;const d=n.decode(e.slice(c,c+i));c=c+i;const h=e.slice(c,e.byteLength),f=a===this.JSON_ENCODING?JSON.parse(n.decode(h)):h,v={type:this.BROADCAST_EVENT,event:u,payload:f};return i>0&&(v.meta=JSON.parse(d)),{join_ref:null,ref:null,topic:l,event:this.BROADCAST_EVENT,payload:v}}_isArrayBuffer(e){var r;return e instanceof ArrayBuffer||((r=e?.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}_pick(e,r){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([n])=>r.includes(n)))}}var U;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(U||(U={}));const ys=(t,e,r={})=>{var n;const s=(n=r.skipTypes)!==null&&n!==void 0?n:[];return e?Object.keys(e).reduce((o,i)=>(o[i]=fp(i,t,e,s),o),{}):{}},fp=(t,e,r,n)=>{const s=e.find(a=>a.name===t),o=s?.type,i=r[t];return o&&!n.includes(o)?gi(o,i):Jr(i)},gi=(t,e)=>{if(t.charAt(0)==="_"){const r=t.slice(1,t.length);return vp(e,r)}switch(t){case U.bool:return pp(e);case U.float4:case U.float8:case U.int2:case U.int4:case U.int8:case U.numeric:case U.oid:return gp(e);case U.json:case U.jsonb:return mp(e);case U.timestamp:return bp(e);case U.abstime:case U.date:case U.daterange:case U.int4range:case U.int8range:case U.money:case U.reltime:case U.text:case U.time:case U.timestamptz:case U.timetz:case U.tsrange:case U.tstzrange:return Jr(e);default:return Jr(e)}},Jr=t=>t,pp=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},gp=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},mp=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},vp=(t,e)=>{if(typeof t!="string")return t;const r=t.length-1,n=t[r];if(t[0]==="{"&&n==="}"){let o;const i=t.slice(1,r);try{o=JSON.parse("["+i+"]")}catch{o=i?i.split(","):[]}return o.map(a=>gi(e,a))}return t},bp=t=>typeof t=="string"?t.replace(" ","T"):t,mi=t=>{const e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};var pt=t=>typeof t=="function"?t:function(){return t},yp=typeof self<"u"?self:null,Xe=typeof window<"u"?window:null,le=yp||Xe||globalThis,wp="2.0.0",_p=1e4,kp=1e3,ue={connecting:0,open:1,closing:2,closed:3},Q={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},ge={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Kr={longpoll:"longpoll",websocket:"websocket"},Sp={complete:4},Gr="base64url.bearer.phx.",Ht=class{constructor(t,e,r,n){this.channel=t,this.event=e,this.payload=r||function(){return{}},this.receivedResp=null,this.timeout=n,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(t){this.timeout=t,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(t,e){return this.hasReceived(t)&&e(this.receivedResp.response),this.recHooks.push({status:t,callback:e}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:t,response:e,_ref:r}){this.recHooks.filter(n=>n.status===t).forEach(n=>n.callback(e))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,t=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=t,this.matchReceive(t)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}trigger(t,e){this.channel.trigger(this.refEvent,{status:t,response:e})}},vi=class{constructor(t,e){this.callback=t,this.timerCalc=e,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},Ep=class{constructor(t,e,r){this.state=Q.closed,this.topic=t,this.params=pt(e||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Ht(this,ge.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new vi(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=Q.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(n=>n.send()),this.pushBuffer=[]}),this.joinPush.receive("error",n=>{this.state=Q.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=Q.closed,this.socket.remove(this)}),this.onError(n=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.isJoining()&&this.joinPush.reset(),this.state=Q.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new Ht(this,ge.leave,pt({}),this.timeout).send(),this.state=Q.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(ge.reply,(n,s)=>{this.trigger(this.replyEventName(s),n)})}join(t=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=t,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Q.closed,this.bindings=[]}onClose(t){this.on(ge.close,t)}onError(t){return this.on(ge.error,e=>t(e))}on(t,e){let r=this.bindingRef++;return this.bindings.push({event:t,ref:r,callback:e}),r}off(t,e){this.bindings=this.bindings.filter(r=>!(r.event===t&&(typeof e>"u"||e===r.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(t,e,r=this.timeout){if(e=e||{},!this.joinedOnce)throw new Error(`tried to push '${t}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let n=new Ht(this,t,function(){return e},r);return this.canPush()?n.send():(n.startTimeout(),this.pushBuffer.push(n)),n}leave(t=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=Q.leaving;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(ge.close,"leave")},r=new Ht(this,ge.leave,pt({}),t);return r.receive("ok",()=>e()).receive("timeout",()=>e()),r.send(),this.canPush()||r.trigger("ok",{}),r}onMessage(t,e,r){return e}filterBindings(t,e,r){return!0}isMember(t,e,r,n){return this.topic!==t?!1:n&&n!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:t,event:e,payload:r,joinRef:n}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(t=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=Q.joining,this.joinPush.resend(t))}trigger(t,e,r,n){let s=this.onMessage(t,e,r,n);if(e&&!s)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let o=this.bindings.filter(i=>i.event===t&&this.filterBindings(i,e,r));for(let i=0;i<o.length;i++)o[i].callback(s,r,n||this.joinRef())}replyEventName(t){return`chan_reply_${t}`}isClosed(){return this.state===Q.closed}isErrored(){return this.state===Q.errored}isJoined(){return this.state===Q.joined}isJoining(){return this.state===Q.joining}isLeaving(){return this.state===Q.leaving}},or=class{static request(t,e,r,n,s,o,i){if(le.XDomainRequest){let a=new le.XDomainRequest;return this.xdomainRequest(a,t,e,n,s,o,i)}else if(le.XMLHttpRequest){let a=new le.XMLHttpRequest;return this.xhrRequest(a,t,e,r,n,s,o,i)}else{if(le.fetch&&le.AbortController)return this.fetchRequest(t,e,r,n,s,o,i);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(t,e,r,n,s,o,i){let a={method:t,headers:r,body:n},c=null;return s&&(c=new AbortController,setTimeout(()=>c.abort(),s),a.signal=c.signal),le.fetch(e,a).then(l=>l.text()).then(l=>this.parseJSON(l)).then(l=>i&&i(l)).catch(l=>{l.name==="AbortError"&&o?o():i&&i(null)}),c}static xdomainRequest(t,e,r,n,s,o,i){return t.timeout=s,t.open(e,r),t.onload=()=>{let a=this.parseJSON(t.responseText);i&&i(a)},o&&(t.ontimeout=o),t.onprogress=()=>{},t.send(n),t}static xhrRequest(t,e,r,n,s,o,i,a){t.open(e,r,!0),t.timeout=o;for(let[c,l]of Object.entries(n))t.setRequestHeader(c,l);return t.onerror=()=>a&&a(null),t.onreadystatechange=()=>{if(t.readyState===Sp.complete&&a){let c=this.parseJSON(t.responseText);a(c)}},i&&(t.ontimeout=i),t.send(s),t}static parseJSON(t){if(!t||t==="")return null;try{return JSON.parse(t)}catch{return console&&console.log("failed to parse JSON response",t),null}}static serialize(t,e){let r=[];for(var n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;let s=e?`${e}[${n}]`:n,o=t[n];typeof o=="object"?r.push(this.serialize(o,s)):r.push(encodeURIComponent(s)+"="+encodeURIComponent(o))}return r.join("&")}static appendParams(t,e){if(Object.keys(e).length===0)return t;let r=t.match(/\?/)?"&":"?";return`${t}${r}${this.serialize(e)}`}},xp=t=>{let e="",r=new Uint8Array(t),n=r.byteLength;for(let s=0;s<n;s++)e+=String.fromCharCode(r[s]);return btoa(e)}
vendor: 1,432 bytes, line 54
54,He=class{constructor(t,e){e&&e.length===2&&e[1].startsWith(Gr)&&(this.authToken=atob(e[1].slice(Gr.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(t),this.readyState=ue.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(t){return t.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+Kr.websocket),"$1/"+Kr.longpoll)}endpointURL(){return or.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(t,e,r){this.close(t,e,r),this.readyState=ue.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===ue.open||this.readyState===ue.connecting}poll(){const t={Accept:"application/json"};this.authToken&&(t["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",t,null,()=>this.ontimeout(),e=>{if(e){var{status:r,token:n,messages:s}=e;if(r===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=n}else r=0;switch(r){case 200:s.forEach(o=>{setTimeout(()=>this.onmessage({data:o}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=ue.open,this.onopen({}),this.poll();break;
54case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${r}`)}})}send(t){typeof t!="string"&&(t=xp(t)),this.currentBatch?this.currentBatch.push(t):this.awaitingBatchAck?this.batchBuffer.push(t):(this.currentBatch=[t],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(t){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},t.join(` 55`),()=>this.onerror("timeout"),e=>{this.awaitingBatchAck=!1,!e||e.status!==200?(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(t,e,r){for(let s of this.reqs)s.abort();this.readyState=ue.closed;let n=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:t,reason:e,wasClean:r});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",n)):this.onclose(n)}ajax(t,e,r,n,s){let o,i=()=>{this.reqs.delete(o),n()};o=or.request(t,this.endpointURL(),e,r,this.timeout,i,a=>{this.reqs.delete(o),this.isActive()&&s(a)}),this.reqs.add(o)}},Tp=class ht{constructor(e,r={}){let n=r.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=e,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(n.state,s=>{let{onJoin:o,onLeave:i,onSync:a}=this.caller;this.joinRef=this.channel.joinRef(),this.state=ht.syncState(this.state,s,o,i),this.pendingDiffs.forEach(c=>{this.state=ht.syncDiff(this.state,c,o,i)}),this.pendingDiffs=[],a()}),this.channel.on(n.diff,s=>{let{onJoin:o,onLeave:i,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=ht.syncDiff(this.state,s,o,i),a())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(e){return ht.list(this.state,e)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,r,n,s){let o=this.clone(e),i={},a={};return this.map(o,(c,l)=>{r[c]||(a[c]=l)}),this.map(r,(c,l)=>{let u=o[c];if(u){let d=l.metas.map(m=>m.phx_ref),h=u.metas.map(m=>m.phx_ref),f=l.metas.filter(m=>h.indexOf(m.phx_ref)<0),v=u.metas.filter(m=>d.indexOf(m.phx_ref)<0);f.length>0&&(i[c]=l,i[c].metas=f),v.length>0&&(a[c]=this.clone(u),a[c].metas=v)}else i[c]=l}),this.syncDiff(o,{joins:i,leaves:a},n,s)}static syncDiff(e,r,n,s){let{joins:o,leaves:i}=this.clone(r);return n||(n=function(){}),s||(s=function(){}),this.map(o,(a,c)=>{let l=e[a];if(e[a]=this.clone(c),l){let u=e[a].metas.map(h=>h.phx_ref),d=l.metas.filter(h=>u.indexOf(h.phx_ref)<0);e[a].metas.unshift(...d)}n(a,l,c)}),this.map(i,(a,c)=>{let l=e[a];if(!l)return;let u=c.metas.map(d=>d.phx_ref);l.metas=l.metas.filter(d=>u.indexOf(d.phx_ref)<0),s(a,l,c),l.metas.length===0&&delete e[a]}),e}static list(e,r){return r||(r=function(n,s){return s}),this.map(e,(n,s)=>r(n,s))}static map(e,r){return Object.getOwnPropertyNames(e).map(n=>r(n,e[n]))}static clone(e){return JSON.parse(JSON.stringify(e))}},Zt={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(t,e){if(t.payload.constructor===ArrayBuffer)return e(this.binaryEncode(t));{let r=[t.join_ref,t.ref,t.topic,t.event,t.payload];return e(JSON.stringify(r))}},decode(t,e){if(t.constructor===ArrayBuffer)return e(this.binaryDecode(t));{let[r,n,s,o,i]=JSON.parse(t);return e({join_ref:r,ref:n,topic:s,event:o,payload:i})}},binaryEncode(t){let{join_ref:e,ref:r,event:n,topic:s,payload:o}=t,i=this.META_LENGTH+e.length+r.length+s.length+n.length,a=new ArrayBuffer(this.HEADER_LENGTH+i),c=new DataView(a),l=0;c.setUint8(l++,this.KINDS.push),c.setUint8(l++,e.length),c.setUint8(l++,r.length),c.setUint8(l++,s.length),c.setUint8(l++,n.length),Array.from(e,d=>c.setUint8(l++,d.charCodeAt(0))),Array.from(r,d=>c.setUint8(l++,d.charCodeAt(0))),Array.from(s,d=>c.setUint8(l++,d.charCodeAt(0))),Array.from(n,d=>c.setUint8(l++,d.charCodeAt(0)));var u=new Uint8Array(a.byteLength+o.byteLength);return u.set(new Uint8Array(a),0),u.set(new Uint8Array(o),a.byteLength),u.buffer},binaryDecode(t){let e=new DataView(t),r=e.getUint8(0),n=new TextDecoder;switch(r){case this.KINDS.push:return this.decodePush(t,e,n);case this.KINDS.reply:return this.decodeReply(t,e,n);case this.KINDS.broadcast:return this.decodeBroadcast(t,e,n)}},decodePush(t,e,r){let n=e.getUint8(1),s=e.getUint8(2),o=e.getUint8(3),i=this.HEADER_LENGTH+this.META_LENGTH-1,a=r.decode(t.slice(i,i+n));i=i+n;let c=r.decode(t.slice(i,i+s));i=i+s;let l=r.decode(t.slice(i,i+o));i=i+o;let u=t.slice(i,t.byteLength);return{join_ref:a,ref:null,topic:c,event:l,payload:u}},decodeReply(t,e,r){let n=e.getUint8(1),s=e.getUint8(2),o=e.getUint8(3),i=e.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,c=r.decode(t.slice(a,a+n));a=a+n;let l=r.decode(t.slice(a,a+s));a=a+s;let u=r.decode(t.slice(a,a+o));a=a+o;let d=r.decode(t.slice(a,a+i));a=a+i;let h=t.slice(a,t.byteLength),f={status:d,response:h};return{join_ref:c,ref:l,topic:u,event:ge.reply,payload:f}},decodeBroadcast(t,e,r){let n=e.getUint8(1),s=e.getUint8(2),o=this.HEADER_LENGTH+2,i=r.decode(t.slice(o,o+n));o=o+n;let a=r.decode(t.slice(o,o+s));o=o+s;let c=t.slice(o,t.byteLength);return{join_ref:null,ref:null,topic:i,event:a,payload:c}}},Ap=class{constructor(t,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=e.timeout||_p,this.transport=e.transport||le.WebSocket||He,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=e.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=e.sessionStorage||le&&le.sessionStorage,this.establishedConnections=0,this.defaultEncoder=Zt.encode.bind(Zt),this.defaultDecoder=Zt.decode.bind(Zt),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=e.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==He?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let r=null;Xe&&Xe.addEventListener&&(Xe.addEventListener("pagehide",n=>{this.conn&&(this.disconnect(),r=this.connectClock)}),Xe.addEventListener("pageshow",n=>{r===this.connectClock&&(r=null,this.connect())}),Xe.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=e.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=e.autoSendHeartbeat??!0,this.heartbeatCallback=e.heartbeatCallback??(()=>{}),this.rejoinAfterMs=n=>e.rejoinAfterMs?e.rejoinAfterMs(n):[1e3,2e3,5e3][n-1]||1e4,this.reconnectAfterMs=n=>e.reconnectAfterMs?e.reconnectAfterMs(n):[10,50,100,150,200,250,500,1e3,2e3][n-1]||5e3,this.logger=e.logger||null,!this.logger&&e.debug&&(this.logger=(n,s,o)=>{console.log(`${n}: ${s}`,o)}),this.longpollerTimeout=e.longpollerTimeout||2e4,this.params=pt(e.params||{}),this.endPoint=`${t}/${Kr.websocket}`,this.vsn=e.vsn||wp,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new vi(()=>
55{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{e.beforeReconnect&&await e.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=e.authToken}getLongPollTransport(){return He}replaceTransport(t){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=t}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let t=or.appendParams(or.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return t.charAt(0)!=="/"?t:t.charAt(1)==="/"?`${this.protocol()}:${t}`:`${this.protocol()}://${location.host}${t}`}disconnect(t,e,r){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,t&&t()},e,r)}connect(t){t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=pt(t)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==He?this.connectWithF
vendor: 4,313 bytes, line 55
55allback(He,this.longPollFallbackMs):this.transportConnect())}log(t,e,r){this.logger&&this.logger(t,e,r)}hasLogger(){return this.logger!==null}onOpen(t){let e=this.makeRef();return this.stateChangeCallbacks.open.push([e,t]),e}onClose(t){let e=this.makeRef();return this.stateChangeCallbacks.close.push([e,t]),e}onError(t){let e=this.makeRef();return this.stateChangeCallbacks.error.push([e,t]),e}onMessage(t){let e=this.makeRef();return this.stateChangeCallbacks.message.push([e,t]),e}onHeartbeat(t){this.heartbeatCallback=t}ping(t){if(!this.isConnected())return!1;let e=this.makeRef(),r=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:e});let n=this.onMessage(s=>{s.ref===e&&(this.off([n]),t(Date.now()-r))});return!0}transportName(t){return t===He?"LongPoll":t.name}transportConnect(){this.connectClock++,this.closeWasClean=!1;let t;this.authToken&&(t=["phoenix",`${Gr}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),t),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(t){return this.sessionStore&&this.sessionStore.getItem(t)}storeSession(t,e){this.sessionStore&&this.sessionStore.setItem(t,e)}connectWithFallback(t,e=2500){clearTimeout(this.fallbackTimer);let r=!1,n=!0,s,o,i=this.transportName(t),a=c=>{this.log("transport",`falling back to ${i}...`,c),this.off([s,o]),n=!1,this.replaceTransport(t),this.transportConnect()};if(this.getSession(`phx:fallback:${i}`))return a("memorized");this.fallbackTimer=setTimeout(a,e),o=this.onError(c=>{this.log("transport","error",c),n&&!r&&(clearTimeout(this.fallbackTimer),a(c))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(r=!0,!n){let c=this.transportName(t);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${c}`,"true"),this.log("transport",`established ${c} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(a,e),this.ping(c=>{this.log("transport","connected to primary after",c),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(t){this.log("error","error in heartbeat callback",t)}this.triggerChanError(),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),kp,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(t,e,r){if(!this.conn)return t&&t();const n=this.conn;this.waitForBufferDone(n,()=>{e?n.close(e,r||""):n.close(),this.waitForSocketClosed(n,()=>{this.conn===n&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),t&&t()})})}waitForBufferDone(t,e,r=1){if(r===5||!t.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(t,e,r+1)},150*r)}waitForSocketClosed(t,e,r=1){if(r===5||t.readyState===ue.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(t,e,r+1)},150*r)}onConnClose(t){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",t),this.triggerChanError(),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",t)}onConnError(t){this.hasLogger()&&this.log("transport",t);let e=this.transport,r=this.establishedConnections;this.triggerStateCallbacks("error",t,e,r),(e===this.transport||r>0)&&this.triggerChanError()}
55triggerChanError(){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(ge.error)})}connectionState(){switch(this.conn&&this.conn.readyState){case ue.connecting:return"connecting";case ue.open:return"open";case ue.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(t){this.off(t.stateChangeRefs),this.channels=this.channels.filter(e=>e!==t)}off(t){for(let e in this.stateChangeCallbacks)this.stateChangeCallbacks[e]=this.stateChangeCallbacks[e].filter(([r])=>t.indexOf(r)===-1)}channel(t,e={}){let r=new Ep(t,e,this);return this.channels.push(r),r}push(t){if(this.hasLogger()){let{topic:e,event:r,payload:n,ref:s,join_ref:o}=t;this.log("push",`${e} ${r} (${o}, ${s})`,n)}this.isConnected()?this.encode(t,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(t,e=>this.conn.send(e)))}makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(t){this.log("error","error in heartbeat callback",t)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(t){this.log("error","error in heartbeat callback",t)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}onConnMessage(t){this.decode(t.data,e=>{let{topic:r,event:n,payload:s,ref:o,join_ref:i}=e;if(o&&o===this.pendingHeartbeatRef){const a=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(s.status==="ok"?"ok":"error",a)}catch(c){this.log("error","error in heartbeat callback",c)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${s.status||""} ${r} ${n} ${o&&"("+o+")"||""}`.trim(),s);for(let a=0;a<this.channels.length;a++){const c=this.channels[a];c.isMember(r,n,s,i)&&c.trigger(n,s,o,i)}this.triggerStateCallbacks("message",e)})}triggerStateCallbacks(t,...e){try{this.stateChangeCallbacks[t].forEach(([r,n])=>{try{n(...e)}catch(s){this.log("error",`error in ${t} callback`,s)}})}catch(r){this.log("error",`error triggering ${t} callbacks`,r)}}leaveOpenTopic(t){let e=this.channels.find(r=>r.topic===t&&(r.isJoined()||r.isJoining()));e&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${t}"`),e.leave())}};class gt{constructor(e,r){const n=Cp(r);this.presence=new Tp(e.getChannel(),n),this.presence.onJoin((s,o,i)=>{const a=gt.onJoinPayload(s,o,i);e.getChannel().trigger("presence",a)}),this.presence.onLeave((s,o,i)=>{const a=gt.onLeavePayload(s,o,i);e.getChannel().trigger("presence",a)}),this.presence.onSync(()=>{e.getChannel().trigger("presence",{event:"sync"})})}get state(){return gt.transformState(this.presence.state)}static transformState(e){return e=Op(e),Object.getOwnPropertyNames(e).reduce((r,n)=>{const s=e[n];return r[n]=er(s),r},{})}static onJoinPayload(e,r,n){const s=ws(r),o=er(n);return{event:"join",key:e,currentPresences:s,newPresences:o}}static onLeavePayload(e,r,n){const s=ws(r),o=er(n);return{event:"leave",key:e,currentPresences:s,leftPresences:o}}}function er(t){return t.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e))}function Op(t){return JSON.parse(JSON.stringify(t))}function Cp(t){return t?.events&&{events:t.events}}function ws(t){return t?.metas?er(t):[]}var _s;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(_s||(_s={}));class Rp{get state(){return this.presenceAdapter.state}constructor(e,r){this.channel=e,this.presenceAdapter=new gt(this.channel.channelAdapter,r)}}class jp{constructor(e,r,n){const s=Pp(n);this.channel=e.getSocket().channel(r,s),this.socket=e}get state(){return this.channel.state}set state(e){this.channel.state=e}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(e,r){return this.channel.on(e,r)}off(e,r){this.channel.off(e,r)}subscribe(e){return this.channel.join(e)}unsubscribe(e){return this.channel.leave(e)}teardown(){this.channel.teardown()}onClose(e){this.channel.onClose(e)}onError(e){return this.channel.onError(e)}push(e,r,n){let s;try{s=this.channel.push(e,r,n)}catch{throw new Error(`tried to push '${e}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>dp){const o=this.channel.pushBuffer.shift();o.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${o.event}`,o.payload())}return s}updateJoinPayload(e){const r=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},r),e)}
55canPush(){return this.socket.isConnected()&&this.state===Se.joined}isJoined(){return this.state===Se.joined}isJoining(){return this.state===Se.joining}isClosed(){return this.state===Se.closed}isLeaving(){return this.state===Se.leaving}updateFilterBindings(e){this.channel.filterBindings=e}updatePayloadTransform(e){this.channel.onMessage=e}getChannel(){return this.channel}}function Pp(t){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config)}}var ks;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(ks||(ks={}));var rt;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(rt||(rt={}));var me;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(me||(me={}));class mt{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,r={config:{}},n){var s,o;if(this.topic=e,this.params=r,this.socket=n,this.bindings={},this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.channelAdapter=new jp(this.socket.socketAdapter,e,this.params),this.presence=new Rp(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=mi(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((o=(s=this.params.config)===null||s===void 0?void 0:s.broadcast)===null||o===void 0)&&o.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(e,r=this.timeout){var n,s,o;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:i,presence:a,private:c}}=this.params,l=(s=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(f=>f.filter))!==null&&s!==void 0?s:[],u=!!this.bindings[rt.PRESENCE]&&this.bindings[rt.PRESENCE].length>0||((o=this.params.config.presence)===null||o===void 0?void 0:o.enabled)===!0,d={},h={broadcast:i,presence:Object.assign(Object.assign({},a),{enabled:u}),postgres_changes:l,private:c};this.socket.accessTokenValue&&(d.access_token=this.socket.accessTokenValue),this._onError(f=>{e?.(me.CHANNEL_ERROR,f)}),this._onClose(()=>e?.(me.CLOSED)),this.updateJoinPayload(Object.assign({config:h},d)),this._updateFilterMessage(),this.channelAdapter.subscribe(r).receive("ok",async({postgres_changes:f})=>{if(this.socket._isManualToken()||this.socket.setAuth(),f===void 0){e?.(me.SUBSCRIBED);return}this._updatePostgresBindings(f,e)}).receive("error",f=>{this.state=Se.errored,e?.(me.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(f).join(", ")||"error")))}).receive("timeout",()=>{e?.(me.TIMED_OUT)})}return this}_updatePostgresBindings(e,r){var n;const s=this.bindings.postgres_changes,o=(n=s?.length)!==null&&n!==void 0?n:0,i=[];for(let a=0;a<o;
55a++){const c=s[a],{filter:{event:l,schema:u,table:d,filter:h}}=c,f=e&&e[a];if(f&&f.event===l&&mt.isFilterValueEqual(f.schema,u)&&mt.isFilterValueEqual(f.table,d)&&mt.isFilterValueEqual(f.filter,h))i.push(Object.assign(Object.assign({},c),{id:f.id}));else{this.unsubscribe(),this.state=Se.errored,r?.(me.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=i,this.state!=Se.errored&&r&&r(me.SUBSCRIBED)}presenceState(){return this.presence.state}async track(e,r={}){return await this.send({type:"presence",event:"track",payload:e},r.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,r,n){const s=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),o=e===rt.PRESENCE||e===rt.POSTGRES_CHANGES;if(s&&o)throw this.socket.log("channel",`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(e,r,n)}async httpSend(e,r,n={}){var s;if(r==null)return Promise.reject(new Error("Payload is required for httpSend()"));const o={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const i={method:"POST",headers:o,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:r,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,i,(s=n.timeout)!==null&&s!==void 0?s:this.timeout);if(a.status===202)return{success:!0};let c=a.statusText;try{const l=await a.json();c=l.error||l.message||c}catch{}return Promise.reject(new Error(c))}async send(e,r={}){var n,s;if(!this.channelAdapter.canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated
55in the future. Please use httpSend() explicitly for REST delivery.");const{event:o,payload:i}=e,a={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(a.Authorization=`Bearer ${this.socket.accessTokenValue}`);const c={method:"POST",headers:a,body:JSON.stringify({messages:[{topic:this.subTopic,event:o,payload:i,private:this.private}]})};try{const l=await this._fetchWithTimeout(this.broadcastEndpointURL,c,(n=r.timeout)!==null&&n!==void 0?n:this.timeout);return await((s=l.body)===null||s===void 0?void 0:s.cancel()),l.ok?"ok":"error"}catch(l){return l.name==="AbortError"?"timed out":"error"}}else return new Promise(o=>{var i,a,c;const l=this.channelAdapter.push(e.type,e,r.timeout||this.timeout);e.type==="broadcast"&&!(!((c=(a=(i=this.params)===null||i===void 0?void 0:i.config)===null||a===void 0?void 0:a.broadcast)===null||c===void 0)&&c.ack)&&o("ok"),l.receive("ok",()=>o("ok")),l.receive("error",()=>o("error")),l.receive("timeout",()=>o("timed out"))})}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(r=>{this.channelAdapter.unsubscribe(e).receive("ok",()=>r("ok")).receive("timeout",()=>r("timed out")).receive("error",()=>r("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,r,n){const s=new AbortController,o=setTimeout(()=>s.abort(),n),i=await this.socket.fetch(e,Object.assign(Object.assign({},r),{signal:s.signal}));return clearTimeout(o),i}_on(e,r,n){const s=e.toLocaleLowerCase(),o=this.channelAdapter.on(e,n),i={type:s,filter:r,callback:n,ref:o};return this.bindings[s]?this.bindings[s].push(i):this.bindings[s]=[i],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,r,n)=>{var s,o,i,a,c,l,u;const d=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(d,n))return!1;const h=(s=this.bindings[d])===null||s===void 0?void 0:s.find(f=>f.ref===e.ref);if(!h)return!0;if(["broadcast","presence","postgres_changes"].includes(d))if("id"in h){const f=h.id,v=(o=h.filter)===null||o===void 0?void 0:o.event;return f&&((i=r.ids)===null||i===void 0?void 0:i.includes(f))&&(v==="*"||v?.toLocaleLowerCase()===((a=r.data)===null||a===void 0?void 0:a.type.toLocaleLowerCase()))}else{const f=(l=(c=h?.filter)===null||c===void 0?void 0:c.event)===null||l===void 0?void 0:l.toLocaleLowerCase();return f==="*"||f===((u=r?.event)===null||u===void 0?void 0:u.toLocaleLowerCase())}else return h.type.toLocaleLowerCase()===d})}_notThisChannelEvent(e,r){const{close:n,error:s,leave:o,join:i}=pi;return r&&[n,s,o,i].includes(e)&&r!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,r,n)=>{if(typeof r=="object"&&"ids"in r){const s=r.data,{schema:o,table:i,commit_timestamp:a,type:c,errors:l}=s;return Object.assign(Object.assign({},{schema:o,table:i,commit_timestamp:a,eventType:c,new:{},old:{},errors:l}),this._getPayloadRecords(s))}return r})}copyBindings(e){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const r in e.bindings)for(const n of e.bindings[r])this._on(n.type,n.filter,n.callback)}static isFilterValueEqual(e,r){return(e??void 0)===(r??void 0)}_getPayloadRecords(e){const r={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(r.new=ys(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(r.old=ys(e.columns,e.old_record)),r}}class Np{constructor(e,r){this.socket=new Ap(e,r)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(e){this.socket.heartbeatCallback=e}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(e,r,n,s=1e4){return new Promise(o=>{setTimeout(()=>
55o("timeout"),s),this.socket.disconnect(()=>{e(),o("ok")},r,n)})}push(e){this.socket.push(e)}log(e,r,n){this.socket.log(e,r,n)}makeRef(){return this.socket.makeRef()}onOpen(e){this.socket.onOpen(e)}onClose(e){this.socket.onClose(e)}onError(e){this.socket.onError(e)}onMessage(e){this.socket.onMessage(e)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==Vr.connecting}isDisconnecting(){return this.socket.connectionState()==Vr.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const Ip={HEARTBEAT_INTERVAL:25e3},$p=[1e3,2e3,5e3,1e4],Lp=1e4,Dp=` 56 addEventListener("message", (e) => { 57 if (e.data.event === "start") { 58 setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); 59 } 60 });`;class Up{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(e,r){var n;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint="",this.headers={},this.params={},this.ref=0,this.serializer=new hp,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._resolveFetch=o=>o?(...i)=>o(...i):(...i)=>fetch(...i),!(!((n=r?.params)===null||n===void 0)&&n.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=r.params.apikey;const s=this._initializeOptions(r);this.socketAdapter=new Np(e,s),this.httpEndpoint=mi(e),this.fetch=this._resolveFetch(r?.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(e){const r=e.message;throw r.includes("Node.js")?new Error(`${r} 61 62To use Realtime in Node.js, you need to provide a WebSocket implementation: 63 64Option 1: Use Node.js 22+ which has native WebSocket support 65Option 2: Install and provide the "ws" package: 66 67 npm install ws 68 69 import ws from "ws" 70 const client = new RealtimeClient(url, { 71 ...options, 72 transport: ws 73 })`):new Error(`WebSocket not available: ${r}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(e,r){return this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},e,r)}getChannels(){return this.channels}async removeChannel(e){const r=await e.unsubscribe();return r==="ok"&&e.teardown(),this.channels.length===0&&this.disconnect(),r}async removeAllChannels(){const e=this.channels.map(async n=>{const s=await n.unsubscribe();return n.teardown(),s}),r=await Promise.all(e);return this.disconnect(),r}log(e,r,n){this.socketAdapter.log(e,r,n)}connectionState(){return this.socketAdapter.connectionState()||Vr.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,r={config:{}}){const n=`realtime:${e}`,s=this.getChannels().find(o=>o.topic===n);if(s)return s;{const o=new mt(`realtime:${e}`,r,this);return this.channels.push(o),o}}push(e){this.socketAdapter.push(e)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(e){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(e)}_makeRef(){return this.socketAdapter.makeRef()}_remove(e){this.channels=this.channels.filter(r=>r.topic!==e.topic)}async _performAuth(e=null){let r,n=!1;if(e)r=e,n=!0;else if(this.accessToken)try{r=await this.accessToken()}catch(s){this.log("error","Error fetching access token from callback",s),r=this.accessTokenValue}else r=this.accessTokenValue;n?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEac
73h(s=>{const o={access_token:r,version:ap};r&&s.updateJoinPayload(o),s.joinedOnce&&s.channelAdapter.isJoined()&&s.channelAdapter.push(pi.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(r=>{this.log("error",`Error setting auth in ${e}`,r)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(r=>{this.log("error","error waiting for auth on connect",r)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(e=>{e.ref&&e.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(e){return(r,n)=>{r=="sent"&&this._setAuthSafely(),e&&e(r,n)}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(e){let r;if(e)r=e;else{const n=new Blob([Dp],{type:"application/javascript"});r=URL.createObjectURL(n)}return r}_initializeOptions(e){var r,n,s,o,i,a,c,l,u;this.worker=(r=e?.worker)!==null&&r!==void 0?r:!1,this.accessToken=(n=e?.accessToken)!==null&&n!==void 0?n:null;const d={};d.timeout=(s=e?.timeout)!==null&&s!==void 0?s:up,d.heartbeatIntervalMs=(o=e?.heartbeatIntervalMs)!==null&&o!==void 0?o:Ip.HEARTBEAT_INTERVAL,d.transport=(i=e?.transport)!==null&&i!==void 0?i:op.getWebSocketConstructor(),d.params=e?.params,d.logger=e?.logger,d.heartbeatCallback=this._wrapHeartbeatCallback(e?.heartbeatCallback),d.reconnectAfterMs=(a=e?.reconnectAfterMs)!==null&&a!==void 0?a:(m=>$p[m-1]||Lp);let h,f;const v=(c=e?.vsn)!==null&&c!==void 0?c:lp;switch(v){case cp:h=(m,b)=>b(JSON.stringify(m)),f=(m,b)=>b(JSON.parse(m));break;case fi:h=this.serializer.encode.bind(this.serializer),f=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${d.vsn}`)}if(d.vsn=v,d.encode=(l=e?.encode)!==null&&l!==void 0?l:h,d.decode=(u=e?.decode)!==null&&u!==void 0?u:f,d.beforeReconnect=this._reconnectAuth.bind(this),(e?.logLevel||e?.log_level)&&(this.logLevel=e.logLevel||e.log_level,d.params=Object.assign(Object.assign({},d.params),{log_level:this.logLevel})),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e?.workerUrl,d.autoSendHeartbeat=!this.worker}return d}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var _t=class extends Error{constructor(t,e){super(t),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&e.icebergType?.includes("CommitState")===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function zp(t,e,r){const n=new URL(e,t);if(r)for(const[s,o]of Object.entries(r))o!==void 0&&n.searchParams.set(s,o);return n.toString()}async function Mp(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function Bp(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:r,path:n,query:s,body:o,headers:i}){const a=zp(t.baseUrl,n,s),c=await Mp(t.auth),l=await e(a,{method:r,headers:{...o?{"Content-Type":"application/json"}:{},...c,...i},body:o?JSON.stringify(o):void 0}),u=await l.text(),d=(l.headers.get("content-type")||"").includes("application/json"),h=d&&u?JSON.parse(u):u;if(!l.ok){const f=d?h:void 0,v=f?.error;throw new _t(v?.message??`Request failed with status ${l.status}`,{status:l.status,icebergType:v?.type,icebergCode:v?.code,details:f})}return{status:l.status,headers:l.headers,data:h}}}}function Vt(t){return t.join("�")}var Fp=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:Vt(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(n=>({namespace:n}))}async createNamespace(t,e){const r={namespace:t.namespace,properties:e?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Vt(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Vt(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Vt(t.namespace)}`}),!0}catch(e){if(e instanceof _t&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(r){if(r instanceof _t&&r.status===409)return;throw r}}};function Ze(t){return t.join("�")}var Wp=class{constructor(t,e="",r){this.client=t,this.prefix=e,this.accessDelegation=r}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Ze(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Ze(t.namespace)}/tables`,body:e,headers:r})).data.metadata}async updateTable(t,e){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Ze(t.namespace)}
73/tables/${t.name}`,body:e});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Ze(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String(e?.purge??!1)}})}async loadTable(t){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Ze(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Ze(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(r){if(r instanceof _t&&r.status===404)return!1;throw r}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(r){if(r instanceof _t&&r.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw r}}},qp=class{constructor(t){let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const r=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=Bp({baseUrl:r,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=t.accessDelegation?.join(","),this.namespaceOps=new Fp(this.client,e),this.tableOps=new Wp(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}};function kt(t){"@babel/helpers - typeof";return kt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},kt(t)}function Hp(t,e){if(kt(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(kt(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Zp(t){var e=Hp(t,"string");return kt(e)=="symbol"?e:e+""}function Vp(t,e,r){return(e=Zp(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ss(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function j(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ss(Object(r),!0).forEach(function(n){Vp(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ss(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var br=class extends Error{constructor(t,e="storage",r,n){super(t),this.__isStorageError=!0,this.namespace=e,this.name=e==="vectors"?"StorageVectorsError":"StorageError",this.status=r,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function yr(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var Yr=class extends br{constructor(t,e,r,n="storage"){super(t,n,e,r),this.name=n==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=e,this.statusCode=r}toJSON(){return j({},super.toJSON())}},bi=class extends br{constructor(t,e,r="storage"){super(t,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};function yn(t,e,r){const n=j({},t),s=e.toLowerCase();for(const o of Object.keys(n))o.toLowerCase()===s&&delete n[o];return n[s]=r,n}function Jp(t){const e={};for(const[r,n]of Object.entries(t))e[r.toLowerCase()]=n;return e}const Kp=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Gp=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);
73return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Xr=t=>{if(Array.isArray(t))return t.map(r=>Xr(r));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([r,n])=>{const s=r.replace(/([-_][a-z])/gi,o=>o.toUpperCase().replace(/[-_]/g,""));e[s]=Xr(n)}),e},Yp=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t),Es=t=>{var e;return t.msg||t.message||t.error_description||(typeof t.error=="string"?t.error:(e=t.error)===null||e===void 0?void 0:e.message)||JSON.stringify(t)},Xp=async(t,e,r,n)=>{if(t!==null&&typeof t=="object"&&typeof t.json=="function"){const s=t;let o=parseInt(s.status,10);Number.isFinite(o)||(o=500),s.json().then(i=>{const a=i?.statusCode||i?.code||o+"";e(new Yr(Es(i),o,a,n))}).catch(()=>{const i=o+"";e(new Yr(s.statusText||`HTTP ${o} error`,o,i,n))})}else e(new bi(Es(t),t,n))},Qp=(t,e,r,n)=>{const s={method:t,headers:e?.headers||{}};if(t==="GET"||t==="HEAD"||!n)return j(j({},s),r);if(Gp(n)){var o;const i=e?.headers||{};let a;for(const[c,l]of Object.entries(i))c.toLowerCase()==="content-type"&&(a=l);s.headers=yn(i,"Content-Type",(o=a)!==null&&o!==void 0?o:"application/json"),s.body=JSON.stringify(n)}else s.body=n;return e?.duplex&&(s.duplex=e.duplex),j(j({},s),r)};async function ut(t,e,r,n,s,o,i){return new Promise((a,c)=>{t(r,Qp(e,n,s,o)).then(l=>{if(!l.ok)throw l;if(n?.noResolveJson)return l;if(i==="vectors"){const u=l.headers.get("content-type");if(l.headers.get("content-length")==="0"||l.status===204)return{};if(!u||!u.includes("application/json"))return{}}return l.json()}).then(l=>a(l)).catch(l=>Xp(l,c,n,i))})}function yi(t="storage"){return{get:async(e,r,n,s)=>ut(e,"GET",r,n,s,void 0,t),post:async(e,r,n,s,o)=>ut(e,"POST",r,s,o,n,t),put:async(e,r,n,s,o)=>ut(e,"PUT",r,s,o,n,t),head:async(e,r,n,s)=>ut(e,"HEAD",r,j(j({},n),{},{noResolveJson:!0}),s,void 0,t),remove:async(e,r,n,s,o)=>ut(e,"DELETE",r,s,o,n,t)}}const eg=yi("storage"),{get:St,post:ie,put:Qr,head:tg,remove:wn}=eg,re=yi("vectors");var ct=class{constructor(t,e={},r,n="storage"){this.shouldThrowOnError=!1,this.url=t,this.headers=Jp(e),this.fetch=Kp(r),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=yn(this.headers,t,e),this}async handleOperation(t){var e=this;try{return{data:await t(),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(yr(r))return{data:null,error:r};throw r}}},rg=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e}then(t,e){return this.execute().then(t,e)}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(yr(e))return{data:null,error:e};throw e}}};let wi;wi=Symbol.toStringTag;var ng=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[wi]="BlobDownloadBuilder",this.promise=null}asStream(){return new rg(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(yr(e))return{data:null,error:e};throw e}}};const sg={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},xs={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var og=class extends ct{constructor(t,e={},r,n){super(t,e,n,"storage"),this.bucketId=r}async uploadOrUpdate(t,e,r,n){var s=this;return s.handleOperation(async()=>{let o;const i=j(j({},xs),n);let a=j(j({},s.headers),t==="POST"&&{"x-upsert":String(i.upsert)});const c=i.metadata;if(typeof Blob<"u"&&r instanceof Blob?(o=new FormData,o.append("cacheControl",i.cacheControl),c&&o.append("metadata",s.encodeMetadata(c)),o.append("",r)):typeof FormData<"u"&&r instanceof FormData?(o=r,o.has("cacheControl")||o.append("cacheControl",i.cacheControl),c&&!o.has("metadata")&&o.append("metadata",s.encodeMetadata(c))):(o=r,a["cache-control"]=`max-age=${i.cacheControl}`,a["content-type"]=i.contentType,c&&(a["x-metadata"]=s.toBase64(s.encodeMetadata(c))),(typeof ReadableStream<"u"&&o instanceof ReadableStream||o&&typeof o=="object"&&"pipe"in o&&typeof o.pipe=="function")&&!i.duplex&&(i.duplex="half")),n?.headers)for(const[h,f]of Object.entries(n.headers))a=yn(a,h,f);const l=s._removeEmptyFolders(e),u=s._getFinalPath(l),d=await(t=="PUT"?Qr:ie)(s.fetch,`${s.url}/object/${u}`,o,j({headers:a},i?.duplex?{duplex:i.duplex}:{}));return{path:l,id:d.Id,fullPath:d.Key}})}async upload(t,e,r){return this.uploadOrUpdate("POST",t,e,r)}
73async uploadToSignedUrl(t,e,r,n){var s=this;const o=s._removeEmptyFolders(t),i=s._getFinalPath(o),a=new URL(s.url+`/object/upload/sign/${i}`);return a.searchParams.set("token",e),s.handleOperation(async()=>{let c;const l=j(j({},xs),n),u=j(j({},s.headers),{"x-upsert":String(l.upsert)});return typeof Blob<"u"&&r instanceof Blob?(c=new FormData,c.append("cacheControl",l.cacheControl),c.append("",r)):typeof FormData<"u"&&r instanceof FormData?(c=r,c.append("cacheControl",l.cacheControl)):(c=r,u["cache-control"]=`max-age=${l.cacheControl}`,u["content-type"]=l.contentType),{path:o,fullPath:(await Qr(s.fetch,a.toString(),c,{headers:u})).Key}})}async createSignedUploadUrl(t,e){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(t);const s=j({},r.headers);e?.upsert&&(s["x-upsert"]="true");const o=await ie(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:s}),i=new URL(r.url+o.url),a=i.searchParams.get("token");if(!a)throw new br("No token returned by API");return{signedUrl:i.toString(),path:t,token:a}})}async update(t,e,r){return this.uploadOrUpdate("PUT",t,e,r)}async move(t,e,r){var n=this;return n.handleOperation(async()=>await ie(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r?.destinationBucket},{headers:n.headers}))}async copy(t,e,r){var n=this;return n.handleOperation(async()=>({path:(await ie(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r?.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(t,e,r){var n=this;return n.handleOperation(async()=>{let s=n._getFinalPath(t);const o=typeof r?.transform=="object"&&r.transform!==null&&Object.keys(r.transform).length>0;let i=await ie(n.fetch,`${n.url}/object/sign/${s}`,j({expiresIn:e},o?{transform:r.transform}:{}),{headers:n.headers});const a=new URLSearchParams;r?.download&&a.set("download",r.download===!0?"":r.download),r?.cacheNonce!=null&&a.set("cacheNonce",String(r.cacheNonce));const c=a.toString();return{signedUrl:encodeURI(`${n.url}${i.signedURL}${c?`&${c}`:""}`)}})}async createSignedUrls(t,e,r){var n=this;return n.handleOperation(async()=>{const s=await ie(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:e,paths:t},{headers:n.headers}),o=new URLSearchParams;r?.download&&o.set("download",r.download===!0?"":r.download),r?.cacheNonce!=null&&o.set("cacheNonce",String(r.cacheNonce));const i=o.toString();return s.map(a=>j(j({},a),{},{signedUrl:a.signedURL?encodeURI(`${n.url}${a.signedURL}${i?`&${i}`:""}`):null}))})}download(t,e,r){const n=typeof e?.transform=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image/authenticated":"object",s=new URLSearchParams;e?.transform&&this.applyTransformOptsToQuery(s,e.transform),e?.cacheNonce!=null&&s.set("cacheNonce",String(e.cacheNonce));const o=s.toString(),i=this._getFinalPath(t),a=()=>St(this.fetch,`${this.url}/${n}/${i}${o?`?${o}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new ng(a,this.shouldThrowOnError)}async info(t){var e=this;const r=e._getFinalPath(t);return e.handleOperation(async()=>Xr(await St(e.fetch,`${e.url}/object/info/${r}`,{headers:e.headers})))}async exists(t){var e=this;const r=e._getFinalPath(t);try{return await tg(e.fetch,`${e.url}/object/${r}`,{headers:e.headers}),{data:!0,error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(yr(s)){var n;const o=s instanceof Yr?s.status:s instanceof bi?(n=s.originalError)===null||n===void 0?void 0:n.status:void 0;if(o!==void 0&&[400,404].includes(o))return{data:!1,error:s}}throw s}}getPublicUrl(t,e){const r=this._getFinalPath(t),n=new URLSearchParams;e?.download&&n.set("download",e.download===!0?"":e.download),e?.transform&&this.applyTransformOptsToQuery(n,e.transform),e?.cacheNonce!=null&&n.set("cacheNonce",String(e.cacheNonce));const s=n.toString(),o=typeof e?.transform=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${o}/public/${r}`)+(s?`?${s}`:"")}}}async remove(t){var e=this;return e.handleOperation(async()=>await wn(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}))}async list(t,e,r){var n=this;return n.handleOperation(async()=>{const s=j(j(j({},sg),e),{},{prefix:t||""});return await ie(n.fetch,`${n.url}/object/list/${n.bucketId}`,s,{headers:n.headers},r)})}async listV2(t,e){var r=this;return r.handleOperation(async()=>{const n=j({},t);return await ie(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},e)})}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(t,e){return e.width&&t.set("width",e.width.toString()),e.height&&t.set("height",e.height.toString()),e.resize&&t.set("resize",e.resize),e.format&&t.set("format",e.format),e.quality&&t.set("qual
73ity",e.quality.toString()),t}};const ig="2.104.1",Ot={"X-Client-Info":`storage-js/${ig}`};var ag=class extends ct{constructor(t,e={},r,n){const s=new URL(t);n?.useNewHostname&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase."));const o=s.href.replace(/\/$/,""),i=j(j({},Ot),e);super(o,i,r,"storage")}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const r=e.listBucketOptionsToQueryString(t);return await St(e.fetch,`${e.url}/bucket${r}`,{headers:e.headers})})}async getBucket(t){var e=this;return e.handleOperation(async()=>await St(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}))}async createBucket(t,e={public:!1}){var r=this;return r.handleOperation(async()=>await ie(r.fetch,`${r.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}))}async updateBucket(t,e){var r=this;return r.handleOperation(async()=>await Qr(r.fetch,`${r.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(t){var e=this;return e.handleOperation(async()=>await ie(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await wn(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}listBucketOptionsToQueryString(t){const e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},cg=class extends ct{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=j(j({},Ot),e);super(n,s,r,"storage")}async createBucket(t){var e=this;return e.handleOperation(async()=>await ie(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}))}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const r=new URLSearchParams;t?.limit!==void 0&&r.set("limit",t.limit.toString()),t?.offset!==void 0&&r.set("offset",t.offset.toString()),t?.sortColumn&&r.set("sortColumn",t.sortColumn),t?.sortOrder&&r.set("sortOrder",t.sortOrder),t?.search&&r.set("search",t.search);const n=r.toString(),s=n?`${e.url}/bucket?${n}`:`${e.url}/bucket`;return await St(e.fetch,s,{headers:e.headers})})}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await wn(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}from(t){var e=this;if(!Yp(t))throw new br("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const r=new qp({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),n=this.shouldThrowOnError;return new Proxy(r,{get(s,o){const i=s[o];return typeof i!="function"?i:async(...a)=>{try{return{data:await i.apply(s,a),error:null}}catch(c){if(n)throw c;return{data:null,error:c}}}}})}},lg=class extends ct{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=j(j({},Ot),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async createIndex(t){var e=this;return e.handleOperation(async()=>await re.post(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{})}async getIndex(t,e){var r=this;return r.handleOperation(async()=>await re.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers}))}async listIndexes(t){var e=this;return e.handleOperation(async()=>await re.post(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}))}async deleteIndex(t,e){var r=this;return r.handleOperation(async()=>await re.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers})||{})}},ug=class extends ct{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=j(j({},Ot),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async putVectors(t){var e=this;if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return e.handleOperation(async()=>await re.post(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{})}async getVectors(t){var e=this;return e.handleOperation(async()=>await re.post(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}))}async listVectors(t){var e=this;if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");
73if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return e.handleOperation(async()=>await re.post(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}))}async queryVectors(t){var e=this;return e.handleOperation(async()=>await re.post(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}))}async deleteVectors(t){var e=this;if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return e.handleOperation(async()=>await re.post(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{})}},dg=class extends ct{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=j(j({},Ot),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async createBucket(t){var e=this;return e.handleOperation(async()=>await re.post(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}async getBucket(t){var e=this;return e.handleOperation(async()=>await re.post(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}))}async listBuckets(t={}){var e=this;return e.handleOperation(async()=>await re.post(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await re.post(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}},hg=class extends dg{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new fg(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,r=this;return e().call(r,t)}async getBucket(t){var e=()=>super.getBucket,r=this;return e().call(r,t)}async listBuckets(t={}){var e=()=>super.listBuckets,r=this;return e().call(r,t)}async deleteBucket(t){var e=()=>super.deleteBucket,r=this;return e().call(r,t)}},fg=class extends lg{constructor(t,e,r,n){super(t,e,n),this.vectorBucketName=r}async createIndex(t){var e=()=>super.createIndex,r=this;return e().call(r,j(j({},t),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,r=this;return e().call(r,j(j({},t),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,r=this;return e().call(r,r.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,r=this;return e().call(r,r.vectorBucketName,t)}index(t){return new pg(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},pg=class extends ug{constructor(t,e,r,n,s){super(t,e,s),this.vectorBucketName=r,this.indexName=n}async putVectors(t){var e=()=>super.putVectors,r=this;return e().call(r,j(j({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(t){var e=()=>super.getVectors,r=this;return e().call(r,j(j({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,r=this;return e().call(r,j(j({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,r=this;return e().call(r,j(j({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,r=this;return e().call(r,j(j({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},gg=class extends ag{constructor(t,e={},r,n){super(t,e,r,n)}from(t){return new og(this.url,this.headers,t,this.fetch)}get vectors(){return new hg(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new cg(this.url+"/iceberg",this.headers,this.fetch)}};const _i="2.104.1",Qe=30*1e3,en=3,$r=en*Qe,mg="http://localhost:9999",vg="supabase.auth.token",bg={"X-Client-Info":`gotrue-js/${_i}`},tn="X-Supabase-Api-Version",ki={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},yg=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,wg=600*1e3;class Et extends Error{constructor(e,r,n){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=n}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function E(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}
73class _g extends Et{constructor(e,r,n){super(e,r,n),this.name="AuthApiError",this.status=r,this.code=n}}function kg(t){return E(t)&&t.name==="AuthApiError"}class Ie extends Et{constructor(e,r){super(e),this.name="AuthUnknownError",this.originalError=r}}class be extends Et{constructor(e,r,n,s){super(e,n,s),this.name=r,this.status=n}}class te extends be{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Jt(t){return E(t)&&t.name==="AuthSessionMissingError"}class Ve extends be{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Kt extends be{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class Gt extends be{constructor(e,r=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function Sg(t){return E(t)&&t.name==="AuthImplicitGrantRedirectError"}class Ts extends be{constructor(e,r=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class Eg extends be{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class rn extends be{constructor(e,r){super(e,"AuthRetryableFetchError",r,void 0)}}function Lr(t){return E(t)&&t.name==="AuthRetryableFetchError"}class As extends be{constructor(e,r,n){super(e,"AuthWeakPasswordError",r,"weak_password"),this.reasons=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class nn extends be{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const ir="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Os=` 74\r=`.split(""),xg=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<Os.length;e+=1)t[Os[e].charCodeAt(0)]=-2;for(let e=0;e<ir.length;e+=1)t[ir[e].charCodeAt(0)]=e;return t})();function Cs(t,e,r){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;r(ir[n]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;r(ir[n]),e.queuedBits-=6}}function Si(t,e,r){const n=xg[t];if(n>-1)for(e.queue=e.queue<<6|n,e.queuedBits+=6;e.queuedBits>=8;)r(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(n===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function Rs(t){const e=[],r=i=>{e.push(String.fromCodePoint(i))},n={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},o=i=>{Og(i,n,r)};for(let i=0;i<t.length;i+=1)Si(t.charCodeAt(i),s,o);return e.join("")}function Tg(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function Ag(t,e){for(let r=0;r<t.length;r+=1){let n=t.charCodeAt(r);if(n>55295&&n<=56319){const s=(n-55296)*1024&65535;n=(t.charCodeAt(r+1)-56320&65535|s)+65536,r+=1}Tg(n,e)}}function Og(t,e,r){if(e.utf8seq===0){if(t<=127){r(t);return}for(let n=1;n<6;n+=1)if((t>>7-n&1)===0){e.utf8seq=n;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&r(e.codepoint)}}function ot(t){const e=[],r={queue:0,queuedBits:0},n=s=>{e.push(s)};for(let s=0;s<t.length;
74s+=1)Si(t.charCodeAt(s),r,n);return new Uint8Array(e)}function Cg(t){const e=[];return Ag(t,r=>e.push(r)),new Uint8Array(e)}function $e(t){const e=[],r={queue:0,queuedBits:0},n=s=>{e.push(s)};return t.forEach(s=>Cs(s,r,n)),Cs(null,r,n),e.join("")}function Rg(t){return Math.round(Date.now()/1e3)+t}function jg(){return Symbol("auth-callback")}const Z=()=>typeof window<"u"&&typeof document<"u",je={tested:!1,writable:!1},Ei=()=>{if(!Z())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(je.tested)return je.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),je.tested=!0,je.writable=!0}catch{je.tested=!0,je.writable=!1}return je.writable};function Pg(t){const e={},r=new URL(t);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((s,o)=>{e[o]=s})}catch{}return r.searchParams.forEach((n,s)=>{e[s]=n}),e}const xi=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Ng=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",et=async(t,e,r)=>{await t.setItem(e,JSON.stringify(r))},Pe=async(t,e)=>{const r=await t.getItem(e);if(!r)return null;try{return JSON.parse(r)}catch{return r}},H=async(t,e)=>{await t.removeItem(e)};class wr{constructor(){this.promise=new wr.promiseConstructor((e,r)=>{this.resolve=e,this.reject=r})}}wr.promiseConstructor=Promise;function Yt(t){const e=t.split(".");if(e.length!==3)throw new nn("Invalid JWT structure");for(let n=0;n<e.length;n++)if(!yg.test(e[n]))throw new nn("JWT not in base64url format");return{header:JSON.parse(Rs(e[0])),payload:JSON.parse(Rs(e[1])),signature:ot(e[2]),raw:{header:e[0],payload:e[1]}}}async function Ig(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function $g(t,e){return new Promise((n,s)=>{(async()=>{for(let o=0;o<1/0;o++)try{const i=await t(o);if(!e(o,null,i)){n(i);return}}catch(i){if(!e(o,i)){s(i);return}}})()})}function Lg(t){return("0"+t.toString(16)).substr(-2)}function Dg(){const e=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=r.length;let s="";for(let o=0;o<56;o++)s+=r.charAt(Math.floor(Math.random()*n));return s}return crypto.getRandomValues(e),Array.from(e,Lg).join("")}async function Ug(t){const r=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",r),s=new Uint8Array(n);return Array.from(s).map(o=>String.fromCharCode(o)).join("")}async function zg(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;const r=await Ug(t);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Je(t,e,r=!1){const n=Dg();let s=n;r&&(s+="/recovery"),await et(t,`${e}-code-verifier`,s);const o=await zg(n);return[o,n===o?"plain":"s256"]}const Mg=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Bg(t){const e=t.headers.get(tn);if(!e||!e.match(Mg))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function Fg(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function Wg(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const qg=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Ke(t){if(!qg.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Dr(){const t={};return new Proxy(t,{get:(e,r)=>{if(r==="__isUserNotAvailableProxy")return!0;if(typeof r=="symbol"){const n=r.toString();if(n==="Symbol(Symbol.toPrimitive)"||n==="Symbol(Symbol.toStringTag)"||n==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${r}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function Hg(t,e){return new Proxy(t,{get:(r,n,s)=>{if(n==="__isInsecureUserWarningProxy")return!0;
74if(typeof n=="symbol"){const o=n.toString();if(o==="Symbol(Symbol.toPrimitive)"||o==="Symbol(Symbol.toStringTag)"||o==="Symbol(util.inspect.custom)"||o==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(r,n,s)}return!e.value&&typeof n=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),e.value=!0),Reflect.get(r,n,s)}})}function js(t){return JSON.parse(JSON.stringify(t))}const Ne=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),Zg=[502,503,504,520,521,522,523,524,530];async function Ps(t){var e;if(!Ng(t))throw new rn(Ne(t),0);if(Zg.includes(t.status))throw new rn(Ne(t),t.status);let r;try{r=await t.json()}catch(o){throw new Ie(Ne(o),o)}let n;const s=Bg(t);if(s&&s.getTime()>=ki["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?n=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(n=r.error_code),n){if(n==="weak_password")throw new As(Ne(r),t.status,((e=r.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(n==="session_not_found")throw new te}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((o,i)=>o&&typeof i=="string",!0))throw new As(Ne(r),t.status,r.weak_password.reasons);throw new _g(Ne(r),t.status||500,n)}const Vg=(t,e,r,n)=>{const s={method:t,headers:e?.headers||{}};return t==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e?.headers),s.body=JSON.stringify(n),Object.assign(Object.assign({},s),r))};async function O(t,e,r,n){var s;const o=Object.assign({},n?.headers);o[tn]||(o[tn]=ki["2024-01-01"].name),n?.jwt&&(o.Authorization=`Bearer ${n.jwt}`);const i=(s=n?.query)!==null&&s!==void 0?s:{};n?.redirectTo&&(i.redirect_to=n.redirectTo);const a=Object.keys(i).length?"?"+new URLSearchParams(i).toString():"",c=await Jg(t,e,r+a,{headers:o,noResolveJson:n?.noResolveJson},{},n?.body);return n?.xform?n?.xform(c):{data:Object.assign({},c),error:null}}async function Jg(t,e,r,n,s,o){const i=Vg(e,n,s,o);let a;try{a=await t(r,Object.assign({},i))}catch(c){throw console.error(c),new rn(Ne(c),0)}if(a.ok||await Ps(a),n?.noResolveJson)return a;try{return await a.json()}catch(c){await Ps(c)}}function oe(t){var e;let r=null;Yg(t)&&(r=Object.assign({},t),t.expires_at||(r.expires_at=Rg(t.expires_in)));const n=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:r,user:n},error:null}}function Ns(t){const e=oe(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((r,n)=>r&&typeof n=="string",!0)&&(e.data.weak_password=t.weak_password),e}function Ee(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function Kg(t){return{data:t,error:null}}function Gg(t){const{action_link:e,email_otp:r,hashed_token:n,redirect_to:s,verification_type:o}=t,i=it(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:e,email_otp:r,hashed_token:n,redirect_to:s,verification_type:o},c=Object.assign({},i);return{data:{properties:a,user:c},error:null}}function Is(t){return t}function Yg(t){return t.access_token&&t.refresh_token&&t.expires_in}const Ur=["global","local","others"];class Xg{constructor({url:e="",headers:r={},fetch:n}){this.url=e,this.headers=r,this.fetch=xi(n),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)}}async signOut(e,r=Ur[0]){if(Ur.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Ur.join(", ")}`);try{return await O(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(n){if(E(n))return{data:null,error:n};throw n}}async inviteUserByEmail(e,r={}){try{return await O(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:Ee})}catch(n){if(E(n))return{data:{user:null},error:n};throw n}}async generateLink(e){try{const{options:r}=e,n=it(e,["options"]),s=Object.assign(Object.assign({},n),r);return"newEmail"in n&&(s.new_email=n?.newEmail,delete s.newEmail),await O(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:Gg,redirectTo:r?.redirectTo})}catch(r){if(E(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(e){try{return await O(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:Ee})}catch(r){if(E(r))return{data:{user:null},error:r};throw r}}async listUsers(e){var r,n,s,o,i,a,c;try{const l={nextPage:null,lastPage:0,total:0},u=await O(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=e?.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(o=(s=e?.perPage)===null||s===void 0?void 0:s.toString())!==null&&o!==void 0?o:""},xform:Is});if(u.error)throw u.error;const d=await u.json(),h=(i=u.headers.get("x-total-count"))!==null&&i!==void 0?i:0,f=(c=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&c!==void 0?c:[];return f.length>0&&(f.forEach(v=>{const m=parseInt(v.split(";")[0].split("=")[1].substring(0,1)),b=JSON.parse(v.split(";")[1].split("=")[1]);l[`${b}Page`]=m}),l.total=parseInt(h)),{data:Object.assign(Object.assign({},d),l),error:null}}catch(l){if(E(l))return{data:{users:[]},error:l};throw l}}async getUserById(e){Ke(e);try{return await O(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Ee})}catch(r){if(E(r))return{data:{user:null},error:r};throw r}}async updateUserById(e,r){Ke(e);try{return await O(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:r,headers:this.headers,xform:Ee})}catch(n){if(E(n))return{data:{user:null},error:n};throw n}}async deleteUser(e,r=!1){Ke(e);
74try{return await O(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:r},xform:Ee})}catch(n){if(E(n))return{data:{user:null},error:n};throw n}}async _listFactors(e){Ke(e.userId);try{const{data:r,error:n}=await O(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:r,error:n}}catch(r){if(E(r))return{data:null,error:r};throw r}}async _deleteFactor(e){Ke(e.userId),Ke(e.id);try{return{data:await O(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(r){if(E(r))return{data:null,error:r};throw r}}async _listOAuthClients(e){var r,n,s,o,i,a,c;try{const l={nextPage:null,lastPage:0,total:0},u=await O(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=e?.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(o=(s=e?.perPage)===null||s===void 0?void 0:s.toString())!==null&&o!==void 0?o:""},xform:Is});if(u.error)throw u.error;const d=await u.json(),h=(i=u.headers.get("x-total-count"))!==null&&i!==void 0?i:0,f=(c=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&c!==void 0?c:[];return f.length>0&&(f.forEach(v=>{const m=parseInt(v.split(";")[0].split("=")[1].substring(0,1)),b=JSON.parse(v.split(";")[1].split("=")[1]);l[`${b}Page`]=m}),l.total=parseInt(h)),{data:Object.assign(Object.assign({},d),l),error:null}}catch(l){if(E(l))return{data:{clients:[]},error:l};throw l}}async _createOAuthClient(e){try{return await O(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(E(r))return{data:null,error:r};throw r}}async _getOAuthClient(e){try{return await O(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(E(r))return{data:null,error:r};throw r}}async _updateOAuthClient(e,r){try{return await O(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(E(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(e){try{return await O(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(E(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(e){try{return await O(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(E(r))return{data:null,error:r};throw r}}async _listCustomProviders(e){try{const r={};return e?.type&&(r.type=e.type),await O(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:r,xform:n=>{var s;return{data:{providers:(s=n?.providers)!==null&&s!==void 0?s:[]},error:null}}})}catch(r){if(E(r))return{data:{providers:[]},error:r};throw r}}async _createCustomProvider(e){try{return await O(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(E(r))return{data:null,error:r};throw r}}async _getCustomProvider(e){try{return await O(this.fetch,"GET",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(E(r))return{data:null,error:r};throw r}}async _updateCustomProvider(e,r){try{return await O(this.fetch,"PUT",`${this.url}/admin/custom-providers/${e}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(E(n))return{data:null,error:n};throw n}}async _deleteCustomProvider(e){try{return await O(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(E(r))return{data:null,error:r};throw r}}}function $s(t={}){return{getItem:e=>t[e]||null,setItem:(e,r)=>{t[e]=r},removeItem:e=>{delete t[e]}}}const ce={debug:!!(globalThis&&Ei()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};
74class Ti extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class Ls extends Ti{}async function Qg(t,e,r){ce.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const n=new globalThis.AbortController;let s;e>0&&(s=setTimeout(()=>{n.abort(),ce.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e)),await Promise.resolve();try{return await globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:n.signal},async o=>{if(o){clearTimeout(s),ce.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,o.name);try{return await r()}finally{ce.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,o.name)}}else{if(e===0)throw ce.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new Ls(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(ce.debug)try{const i=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(i,null," "))}catch(i){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",i)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),clearTimeout(s),await r()}})}catch(o){if(e>0&&clearTimeout(s),o?.name==="AbortError"&&e>0){if(n.signal.aborted)return ce.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",t),console.warn(`@supabase/gotrue-js: Lock "${t}" was not released within ${e}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,{mode:"exclusive",steal:!0},async i=>{if(i){ce.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",t,i.name);try{return await r()}finally{ce.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",t,i.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await r()}));throw ce.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",t),new Ls(`Lock "${t}" was released because another request stole it`)}throw o}}function em(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function Ai(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function tm(t){return parseInt(t,16)}function rm(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}function nm(t){var e;const{chainId:r,domain:n,expirationTime:s,issuedAt:o=new Date,nonce:i,notBefore:a,requestId:c,resources:l,scheme:u,uri:d,version:h}=t;{if(!Number.isInteger(r))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!n)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(i&&i.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${i}`);if(!d)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(h!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${h}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(` 75`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const f=Ai(t.address),v=u?`${u}://${n}`:n,m=t.statement?`${t.statement} 76`:"",b=`${v} wants you to sign in with your Ethereum account: 77${f} 78 79${m}`;let _=`URI: ${d} 80Version: ${h} 81Chain ID: ${r}${i?` 82Nonce: ${i}`:""} 83Issued At: ${o.toISOString()}`;if(s&&(_+=` 84Expiration Time: ${s.toISOString()}`),a&&(_+=` 85Not Before: ${a.toISOString()}
85`),c&&(_+=` 86Request ID: ${c}`),l){let k=` 87Resources:`;for(const w of l){if(!w||typeof w!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${w}`);k+=` 88- ${w}`}_+=k}return`${b} 89${_}`}class F extends Error{constructor({message:e,code:r,cause:n,name:s}){var o;super(e,{cause:n}),this.__isWebAuthnError=!0,this.name=(o=s??(n instanceof Error?n.name:void 0))!==null&&o!==void 0?o:"Unknown Error",this.code=r}}class ar extends F{constructor(e,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:e}),this.name="WebAuthnUnknownError",this.originalError=r}}function sm({error:t,options:e}){var r,n,s;const{publicKey:o}=e;if(!o)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new F({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((r=o.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new F({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((n=o.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new F({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((s=o.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new F({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new F({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new F({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return o.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new F({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new F({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const i=window.location.hostname;if(Oi(i)){if(o.rp.id!==i)return new F({message:`The RP ID "${o.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new F({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(o.user.id.byteLength<1||o.user.id.byteLength>64)return new F({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new F({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new F({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function om({error:t,options:e}){const{publicKey:r}=e;if(!r)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new F({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new F({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const n=window.location.hostname;if(Oi(n)){if(r.rpId!==n)return new F({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new F({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new F({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ER
89ROR",cause:t})}return new F({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class im{createNewAbortSignal(){if(this.controller){const r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const am=new im;function cm(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:r,excludeCredentials:n}=t,s=it(t,["challenge","user","excludeCredentials"]),o=ot(e).buffer,i=Object.assign(Object.assign({},r),{id:ot(r.id).buffer}),a=Object.assign(Object.assign({},s),{challenge:o,user:i});if(n&&n.length>0){a.excludeCredentials=new Array(n.length);for(let c=0;c<n.length;c++){const l=n[c];a.excludeCredentials[c]=Object.assign(Object.assign({},l),{id:ot(l.id).buffer,type:l.type||"public-key",transports:l.transports})}}return a}function lm(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:r}=t,n=it(t,["challenge","allowCredentials"]),s=ot(e).buffer,o=Object.assign(Object.assign({},n),{challenge:s});if(r&&r.length>0){o.allowCredentials=new Array(r.length);for(let i=0;i<r.length;i++){const a=r[i];o.allowCredentials[i]=Object.assign(Object.assign({},a),{id:ot(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return o}function um(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const r=t;return{id:t.id,rawId:t.id,response:{attestationObject:$e(new Uint8Array(t.response.attestationObject)),clientDataJSON:$e(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function dm(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const r=t,n=t.getClientExtensionResults(),s=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:$e(new Uint8Array(s.authenticatorData)),clientDataJSON:$e(new Uint8Array(s.clientDataJSON)),signature:$e(new Uint8Array(s.signature)),userHandle:s.userHandle?$e(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Oi(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function Ds(){var t,e;return!!(Z()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator?.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator?.credentials)===null||e===void 0?void 0:e.get)=="function")}async function hm(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new ar("Browser returned unexpected credential type",e)}:{data:null,error:new ar("Empty credential response",e)}}catch(e){return{data:null,error:sm({error:e,options:t})}}}async function fm(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new ar("Browser returned unexpected credential type",e)}:{data:null,error:new ar("Empty credential response",e)}}catch(e){return{data:null,error:om({error:e,options:t})}}}const pm={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},gm={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function cr(...t){const e=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),r=s=>s instanceof ArrayBuffer||ArrayBuffer.isView(s),n={};for(const s of t)if(s)for(const o in s){const i=s[o];if(i!==void 0)if(Array.isArray(i))n[o]=i;else if(r(i))n[o]=i;else if(e(i)){const a=n[o];e(a)?n[o]=cr(a,i):n[o]=cr(i)}else n[o]=i}return n}function mm(t,e){return cr(pm,t,e||{})}function vm(t,e){return cr(gm,t,e||{})}class bm{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:r,friendlyName:n,signal:s},o){var i;try{const{data:a,error:c}=await this.client.mfa.challenge({factorId:e,webauthn:r});if(!a)return{data:null,error:c};const l=s??am.createNewAbortSignal();if(a.webauthn.type==="create"){const{user:u}=a.webauthn.credential_options.publicKey;if(!u.name){const d=n;if(d)u.name=`${u.id}:${d}`;else{const f=(await this.client.getUser()).data.user,v=((i=f?.user_metadata)===null||i===void 0?void 0:i.name)||f?.email||f?.id||"User";u.name=`${u.id}:${v}`}}u.displayName||(u.displayName=u.name)}
89switch(a.webauthn.type){case"create":{const u=mm(a.webauthn.credential_options.publicKey,o?.create),{data:d,error:h}=await hm({publicKey:u,signal:l});return d?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:d}},error:null}:{data:null,error:h}}case"request":{const u=vm(a.webauthn.credential_options.publicKey,o?.request),{data:d,error:h}=await fm(Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:u,signal:l}));return d?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:d}},error:null}:{data:null,error:h}}}}catch(a){return E(a)?{data:null,error:a}:{data:null,error:new Ie("Unexpected error in challenge",a)}}}async _verify({challengeId:e,factorId:r,webauthn:n}){return this.client.mfa.verify({factorId:r,challengeId:e,webauthn:n})}async _authenticate({factorId:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},o){if(!r)return{data:null,error:new Et("rpId is required for WebAuthn authentication")};try{if(!Ds())return{data:null,error:new Ie("Browser does not support WebAuthn",null)};const{data:i,error:a}=await this.challenge({factorId:e,webauthn:{rpId:r,rpOrigins:n},signal:s},{request:o});if(!i)return{data:null,error:a};const{webauthn:c}=i;return this._verify({factorId:e,challengeId:i.challengeId,webauthn:{type:c.type,rpId:r,rpOrigins:n,credential_response:c.credential_response}})}catch(i){return E(i)?{data:null,error:i}:{data:null,error:new Ie("Unexpected error in authenticate",i)}}}async _register({friendlyName:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},o){if(!r)return{data:null,error:new Et("rpId is required for WebAuthn registration")};try{if(!Ds())return{data:null,error:new Ie("Browser does not support WebAuthn",null)};const{data:i,error:a}=await this._enroll({friendlyName:e});if(!i)return await this.client.mfa.listFactors().then(u=>{var d;return(d=u.data)===null||d===void 0?void 0:d.all.find(h=>h.factor_type==="webauthn"&&h.friendly_name===e&&h.status!=="unverified")}).then(u=>u?this.client.mfa.unenroll({factorId:u?.id}):void 0),{data:null,error:a};const{data:c,error:l}=await this._challenge({factorId:i.id,friendlyName:i.friendly_name,webauthn:{rpId:r,rpOrigins:n},signal:s},{create:o});return c?this._verify({factorId:i.id,challengeId:c.challengeId,webauthn:{rpId:r,rpOrigins:n,type:c.webauthn.type,credential_response:c.webauthn.credential_response}}):{data:null,error:l}}catch(i){return E(i)?{data:null,error:i}:{data:null,error:new Ie("Unexpected error in register",i)}}}}em();const ym={url:mg,storageKey:vg,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:bg,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1};async function Us(t,e,r){return await r()}const Ge={};class xt{get jwks(){var e,r;return(r=(e=Ge[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){Ge[this.storageKey]=Object.assign(Object.assign({},Ge[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=Ge[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Ge[this.storageKey]=Object.assign(Object.assign({},Ge[this.storageKey]),{cachedAt:e})}constructor(e){var r,n,s;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const o=Object.assign(Object.assign({},ym),e);if(this.storageKey=o.storageKey,this.instanceID=(r=xt.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,xt.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!o.debug,typeof o.debug=="function"&&(this.logger=o.debug),this.instanceID>0&&Z()){const i=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(i),this.logDebugMessages&&console.trace(i)}if(this.persistSession=o.persistSession,this.autoRefreshToken=o.autoRefreshToken,this.admin=new Xg({url:o.url,headers:o.headers,fetch:o.fetch}),this.url=o.url,this.headers=o.headers,this.fetch=xi(o.fetch),this.lock=o.lock||Us,this.detectSessionInUrl=o.detectSessionInUrl,this.flowType=o.flowType,this.hasCustomAuthorizationHeader=o.hasCustomAuthorizationHeader,this.throwOnError=o.throwOnError,this.lockAcquireTimeout=o.lockAcquireTimeout,o.lock?this.lock=o.lock:this.persistSession&&Z()&&(!((n=globalThis?.navigator)===null||n===void 0)&&n.locks)?this.lock=Qg:this.lock=Us,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new bm(this)}
89,this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.persistSession?(o.storage?this.storage=o.storage:Ei()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=$s(this.memoryStorage)),o.userStorage&&(this.userStorage=o.userStorage)):(this.memoryStorage={},this.storage=$s(this.memoryStorage)),Z()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(i){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",i)}(s=this.broadcastChannel)===null||s===void 0||s.addEventListener("message",async i=>{this._debug("received broadcast notification from other tab or client",i);try{await this._notifyAllSubscribers(i.data.event,i.data.session,!1)}catch(a){this._debug("#broadcastChannel","error",a)}})}o.skipAutoInitialize||this.initialize().catch(i=>{this._debug("#initialize()","error",i)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${_i}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{let r={},n="none";if(Z()&&(r=Pg(window.location.href),this._isImplicitGrantCallback(r)?n="implicit":await this._isPKCECallback(r)&&(n="pkce")),Z()&&this.detectSessionInUrl&&n!=="none"){const{data:s,error:o}=await this._getSessionFromURL(r,n);if(o){if(this._debug("#_initialize()","error detecting session from URL",o),Sg(o)){const c=(e=o.details)===null||e===void 0?void 0:e.code;if(c==="identity_already_exists"||c==="identity_not_found"||c==="single_identity_not_deletable")return{error:o}}return{error:o}}const{session:i,redirectType:a}=s;return this._debug("#_initialize()","detected session in URL",i,"redirect type",a),await this._saveSession(i),setTimeout(async()=>{a==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",i):await this._notifyAllSubscribers("SIGNED_IN",i)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(r){return E(r)?this._returnResult({error:r}):this._returnResult({error:new Ie("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var r,n,s;try{const o=await O(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(r=e?.options)===null||r===void 0?void 0:r.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(s=e?.options)===null||s===void 0?void 0:s.captchaToken}},xform:oe}),{data:i,error:a}=o;if(a||!i)return this._returnResult({data:{user:null,session:null},error:a});const c=i.session,l=i.user;return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:l,session:c},error:null})}catch(o){if(E(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async signUp(e){var r,n,s;try{let o;if("email"in e){const{email:u,password:d,options:h}=e;let f=null,v=null;this.flowType==="pkce"&&([f,v]=await Je(this.storage,this.storageKey)),o=await O(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:h?.emailRedirectTo,body:{email:u,password:d,data:(r=h?.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:h?.captchaToken},code_challenge:f,code_challenge_method:v},xform:oe})}else if("phone"in e){const{phone:u,password:d,options:h}=e;o=await O(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:d,data:(n=h?.data)!==null&&n!==void 0?n:{},channel:(s=h?.channel)!==null&&s!==void 0?s:"sms",gotrue_meta_security:{captcha_token:h?.captchaToken}},xform:oe})}else throw new Kt("You must provide either an email or phone number and a password");const{data:i,error:a}=o;if(a||!i)return await H(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:a});const c=i.session,l=i.user;return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:l,session:c},error:null})}catch(o){if(await H(this.storage,`${this.storageKey}-code-verifier`),E(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async signInWithPassword(e){try{let r;if("email"in e){const{email:o,password:i,options:a}=e;r=await O(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:o,password:i,gotrue_meta_security:{captcha_token:a?.captchaToken}},xform:Ns})}else if("phone"in e){const{phone:o,password:i,options:a}=e;r=await O(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:o,password:i,gotrue_meta_security:{captcha_token:a?.captchaToken}},xform:Ns})}else throw new Kt("You must provide either an email or phone number and a password");const{data:n,error:s}=r;if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!n||!n.session||!n.user){const o=new Ve;return this._returnResult({data:{user:null,session:null},error:o})}return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:s})}catch(r){if(E(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(e){var r,n,s,o;return await this._handleProviderSignIn(e.provider,{redirectTo:(r=e.options)===null||r===void 0?void 0:r.redirectTo,scopes:(n=e.options)===null||n===void 0?void 0:n.scopes,queryParams:(s=e.options)===null||s===void 0?void 0:s.queryParams,skipBrowserRedirect:(o=e.options)===null||o===void 0?void 0:o.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:r}=e;switch(r){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(e){var r,n,s,o,i,a,c,l,u,d,h;let f,v;if("message"in e)f=e.message,v=e.signature;else{const{chain:m,wallet:b,statement:_,options:k}=e;let w;if(Z())if(typeof b=="object")w=b;else{const L=window;if("ethereum"in L&&typeof L.ethereum=="object"&&"request"in L.ethereum&&typeof L.ethereum.request=="function")w=L.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof b!="object"||!k?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");w=b}const T=new URL((r=k?.url)!==null&&r!==void 0?r:window.location.href),I=await w.request({method:"eth_requestAccounts"}).then(L=>L).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!I||I.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const P=Ai(I[0]);let C=(n=k?.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!C){const L=await w.request({method:"eth_chainId"});C=tm(L)}const A={domain:T.host,address:P,statement:_,uri:T.href,version:"1",chainId:C,nonce:(s=k?.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(i=(o=k?.signInWithEthereum)===null||o===void 0?void 0:o.issuedAt)!==null&&i!==void 0?i:new Date,expirationTime:(a=k?.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(c=k?.signInWithEthereum)===null||c===void 0?void 0:c.notBefore,requestId:(l=k?.signInWithEthereum)===null||l===void 0?void 0:l.requestId,resources:(u=k?.signInWithEthereum)===null||u===void 0?void 0:u.resources};f=nm(A),v=await w.request({method:"personal_sign",params:[rm(f),P]})}try{const{data:m,error:b}=await O(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:v},!((d=e.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(h=e.options)===null||h===void 0?void 0:h.captchaToken}}:null),xform:oe});if(b)throw b;if(!m||!m.session||!m.user){const _=new Ve;return this._returnResult({data:{user:null,session:null},error:_})}return m.session&&(await this._saveSession(m.session),await this._notifyAllSubscribers("SIGNED_IN",m.session)),this._returnResult({data:Object.assign({},m),error:b})}catch(m){if(E(m))return this._returnResult({data:{user:null,session:null},error:m});throw m}}async signInWithSolana(e){var r,n,s,o,i,a,c,l,u,d,h,f;let v,m;if("message"in e)v=e.message,m=e.signature;else{const{chain:b,wallet:_,statement:k,options:w}=e;let T;if(Z())if(typeof _=="object")T=_;else{const P=window;if("solana"in P&&typeof P.solana=="object"&&("signIn"in P.solana&&typeof P.solana.signIn=="function"||"signMessage"in P.solana&&typeof P.solana.signMessage=="function"))T=P.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof _!="object"||!w?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");T=_}const I=new URL((r=w?.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in T&&T.signIn){const P=await T.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},w?.signInWithSolana),{version:"1",domain:I.host,uri:I.href}),k?{statement:k}:null));let C;if(Array.isArray(P)&&P[0]&&typeof P[0]=="object")C=P[0];else if(P&&typeof P=="object"&&"signedMessage"in P&&"signature"in P)C=P;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in C&&"signature"in C&&(typeof C.signedMessage=="string"||C.signedMessage instanceof Uint8Array)&&C.signature instanceof Uint8Array)v=typeof C.signedMessage=="string"?C.signedMessage:new TextDecoder().decode(C.signedMessage),m=C.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in T)||typeof T.signMessage!="function"||!("publicKey"in T)||typeof T!="object"||!T.publicKey||!("toBase58"in T.publicKey)||typeof T.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");v=[`${I.host} wants you to sign in with your Solana account:`,T.publicKey.toBase58(),...k?["",k,""]:[""],"Version: 1",`URI: ${I.href}`,`Issued At: ${(s=(n=w?.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((o=w?.signInWithSolana)===null||o===void 0)&&o.notBefore?[`Not Before: ${w.signInWithSolana.notBefore}`]:[],...!((i=w?.signInWithSolana)===null||i===void 0)&&i.expirationTime?[`Expiration Time: ${w.signInWithSolana.expirationTime}`]:[],...!((a=w?.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${w.signInWithSolana.chainId}`]:[],...!((c=w?.signInWithSolana)===null||c===void 0)&&c.nonce?[`Nonce: ${w.signInWithSolana.nonce}`]:[],...!((l=w?.signInWithSolana)===null||l===void 0)&&l.requestId?[`Request ID: ${w.signInWithSolana.requestId}`]:[],...!((d=(u=w?.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||d===void 0)&&d.length?["Resources",...w.sign
89InWithSolana.resources.map(C=>`- ${C}`)]:[]].join(` 90`);const P=await T.signMessage(new TextEncoder().encode(v),"utf8");if(!P||!(P instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");m=P}}try{const{data:b,error:_}=await O(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:v,signature:$e(m)},!((h=e.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(f=e.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:oe});if(_)throw _;if(!b||!b.session||!b.user){const k=new Ve;return this._returnResult({data:{user:null,session:null},error:k})}return b.session&&(await this._saveSession(b.session),await this._notifyAllSubscribers("SIGNED_IN",b.session)),this._returnResult({data:Object.assign({},b),error:_})}catch(b){if(E(b))return this._returnResult({data:{user:null,session:null},error:b});throw b}}async _exchangeCodeForSession(e){const r=await Pe(this.storage,`${this.storageKey}-code-verifier`),[n,s]=(r??"").split("/");try{if(!n&&this.flowType==="pkce")throw new Eg;const{data:o,error:i}=await O(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:oe});if(await H(this.storage,`${this.storageKey}-code-verifier`),i)throw i;if(!o||!o.session||!o.user){const a=new Ve;return this._returnResult({data:{user:null,session:null,redirectType:null},error:a})}return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers(s==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",o.session)),this._returnResult({data:Object.assign(Object.assign({},o),{redirectType:s??null}),error:i})}catch(o){if(await H(this.storage,`${this.storageKey}-code-verifier`),E(o))return this._returnResult({data:{user:null,session:null,redirectType:null},error:o});throw o}}async signInWithIdToken(e){try{const{options:r,provider:n,token:s,access_token:o,nonce:i}=e,a=await O(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:s,access_token:o,nonce:i,gotrue_meta_security:{captcha_token:r?.captchaToken}},xform:oe}),{data:c,error:l}=a;if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!c||!c.session||!c.user){const u=new Ve;return this._returnResult({data:{user:null,session:null},error:u})}return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",c.session)),this._returnResult({data:c,error:l})}catch(r){if(E(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(e){var r,n,s,o,i;try{if("email"in e){const{email:a,options:c}=e;let l=null,u=null;this.flowType==="pkce"&&([l,u]=await Je(this.storage,this.storageKey));const{error:d}=await O(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(r=c?.data)!==null&&r!==void 0?r:{},create_user:(n=c?.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:c?.captchaToken},code_challenge:l,code_challenge_method:u},redirectTo:c?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:d})}if("phone"in e){const{phone:a,options:c}=e,{data:l,error:u}=await O(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,data:(s=c?.data)!==null&&s!==void 0?s:{},create_user:(o=c?.shouldCreateUser)!==null&&o!==void 0?o:!0,gotrue_meta_security:{captcha_token:c?.captchaToken},channel:(i=c?.channel)!==null&&i!==void 0?i:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:l?.message_id},error:u})}throw new Kt("You must provide either an email or phone number.")}catch(a){if(await H(this.storage,`${this.storageKey}-code-verifier`),E(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async verifyOtp(e){var r,n;try{let s,o;"options"in e&&(s=(r=e.options)===null||r===void 0?void 0:r.redirectTo,o=(n=e.options)===null||n===void 0?void 0:n.captchaToken);const{data:i,error:a}=await O(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:o}}),redirectTo:s,xform:oe});if(a)throw a;if(!i)throw new Error("An error occurred on token verification.");const c=i.session,l=i.user;return c?.access_token&&(await this._saveSession(c),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",c)),this._returnResult({data:{user:l,session:c},error:null})}catch(s){if(E(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithSSO(e){var r,n,s,o,i;try{let a=null,c=null;this.flowType==="pkce"&&([a,c]=await Je(this.storage,this.storageKey));const l=await O(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(n=(r=e.options)===null||r===void 0?void 0:r.redirectTo)!==null&&n!==void 0?n:void 0}),!((s=e?.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:c}),headers:this.headers,xform:Kg});return!((o=l.data)===null||o===void 0)&&o.url&&Z()&&!(!((i=e.options)===null||i===void 0)&&i.skipBrowserRedirect)&&window.location.assign(l.data.url),this._returnResult(l)}catch(a){if(await H(this.storage,`${this.storageKey}-code-verifier`),E(a))return this._returnResult({data:null,error:a});throw a}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)throw n;if(!r)throw new te;const{error:s}=await O(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:s})})}catch(e){if(E(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const r=`${this.url}/resend`;if("email"in e){const{email:n,type:s,options:o}=e,{error:i}=await O(this.fetch,"POST",r,{headers:this.headers,body:{email:n,type:s,gotrue_meta_security:{captcha_token:o?.captchaToken}},redirectTo:o?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:i})}else if("phone"in e){const{phone:n,type:s,options:o}=e,{data:i,error:a}=await O(this.fetch,"POST",r,{headers:this.headers,body:{phone:n,type:s,gotrue_meta_security:{captcha_token:o?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:i?.message_id},error:a})}throw new Kt("You must provide either an email or phone number and a type")}catch(r){if(E(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async r=>r))}async _acquireLock(e,r){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await n,await r()))();return this.pendingInLock.push((async()=>{try{await s}catch{}})()),s}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const n=r();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){const s=[...this.pendingInLock];await Promise.all(s),this.pendingInLock.splice(0,s.length)}return await n}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const r=await this.__loadSession();return await e(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const r=await Pe(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?e=r:(this._debug("#getSession()","session from storage is not val
90id"),await this._removeSession())),!e)return{data:{session:null},error:null};const n=e.expires_at?e.expires_at*1e3-Date.now()<$r:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.userStorage){const i=await Pe(this.userStorage,this.storageKey+"-user");i?.user?e.user=i.user:e.user=Dr()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const i={value:this.suppressGetSessionWarning};e.user=Hg(e.user,i),i.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:s,error:o}=await this._callRefreshToken(e.refresh_token);return o?this._returnResult({data:{session:null},error:o}):this._returnResult({data:{session:s},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;const r=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return r.data.user&&(this.suppressGetSessionWarning=!0),r}async _getUser(e){try{return e?await O(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Ee}):await this._useSession(async r=>{var n,s,o;const{data:i,error:a}=r;if(a)throw a;return!(!((n=i.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new te}:await O(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(o=(s=i.session)===null||s===void 0?void 0:s.access_token)!==null&&o!==void 0?o:void 0,xform:Ee})})}catch(r){if(E(r))return Jt(r)&&(await this._removeSession(),await H(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(e,r={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,r))}async _updateUser(e,r={}){try{return await this._useSession(async n=>{const{data:s,error:o}=n;if(o)throw o;if(!s.session)throw new te;const i=s.session;let a=null,c=null;this.flowType==="pkce"&&e.email!=null&&([a,c]=await Je(this.storage,this.storageKey));const{data:l,error:u}=await O(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r?.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:c}),jwt:i.access_token,xform:Ee});if(u)throw u;return i.user=l.user,await this._saveSession(i),await this._notifyAllSubscribers("USER_UPDATED",i),this._returnResult({data:{user:i.user},error:null})})}catch(n){if(await H(this.storage,`${this.storageKey}-code-verifier`),E(n))return this._returnResult({data:{user:null},error:n});throw n}}async setSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new te;const r=Date.now()/1e3;let n=r,s=!0,o=null;const{payload:i}=Yt(e.access_token);if(i.exp&&(n=i.exp,s=n<=r),s){const{data:a,error:c}=await this._callRefreshToken(e.refresh_token);if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!a)return{data:{user:null,session:null},error:null};o=a}else{const{data:a,error:c}=await this._getUser(e.access_token);if(c)return this._returnResult({data:{user:null,session:null},error:c});o={access_token:e.access_token,refresh_token:e.refresh_token,user:a.user,token_type:"bearer",expires_in:n-r,expires_at:n},await this._saveSession(o),await this._notifyAllSubscribers("SIGNED_IN",o)}return this._returnResult({data:{user:o.user,session:o},error:null})}catch(r){if(E(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async r=>{var n;if(!e){const{data:i,error:a}=r;if(a)throw a;e=(n=i.session)!==null&&n!==void 0?n:void 0}if(!e?.refresh_token)throw new te;const{data:s,error:o}=await this._callRefreshToken(e.refresh_token);return o?this._returnResult({data:{user:null,session:null},error:o}):s?this._returnResult({data:{user:s.user,session:s},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if(E(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(e,r){var n;
90try{if(!Z())throw new Gt("No browser detected.");if(e.error||e.error_description||e.error_code)throw new Gt(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new Ts("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Gt("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new Ts("No code detected.");const{data:w,error:T}=await this._exchangeCodeForSession(e.code);if(T)throw T;const I=new URL(window.location.href);return I.searchParams.delete("code"),window.history.replaceState(window.history.state,"",I.toString()),{data:{session:w.session,redirectType:(n=w.redirectType)!==null&&n!==void 0?n:null},error:null}}const{provider_token:s,provider_refresh_token:o,access_token:i,refresh_token:a,expires_in:c,expires_at:l,token_type:u}=e;if(!i||!c||!a||!u)throw new Gt("No session defined in URL");const d=Math.round(Date.now()/1e3),h=parseInt(c);let f=d+h;l&&(f=parseInt(l));const v=f-d;v*1e3<=Qe&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${v}s, should have been closer to ${h}s`);const m=f-h;d-m>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",m,f,d):d-m<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",m,f,d);const{data:b,error:_}=await this._getUser(i);if(_)throw _;const k={provider_token:s,provider_refresh_token:o,access_token:i,expires_in:h,expires_at:f,refresh_token:a,token_type:u,user:b.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:k,redirectType:e.type},error:null})}catch(s){if(E(s))return this._returnResult({data:{session:null,redirectType:null},error:s});throw s}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){const r=await Pe(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&r)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async r=>{var n;const{data:s,error:o}=r;if(o&&!Jt(o))return this._returnResult({error:o});const i=(n=s.session)===null||n===void 0?void 0:n.access_token;if(i){const{error:a}=await this.admin.signOut(i,e);if(a&&!(kg(a)&&(a.status===404||a.status===401||a.status===403)||Jt(a)))return this._returnResult({error:a})}return e!=="others"&&(await this._removeSession(),await H(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const r=jg(),n={id:r,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,n),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:n}}}async _emitInitialSession(e){return await this._useSession(async r=>{var n,s;try{const{data:{session:o},error:i}=r;if(i)throw i;await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",o)),this._debug("INITIAL_SESSION","callback id",e,"session",o)}catch(o){await((s=this.stateChangeEmitters.get(e))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",o),Jt(o)?console.warn(o):console.error(o)}})}async resetPasswordForEmail(e,r={}){let n=null,s=null;this.flowType==="pkce"&&([n,s]=await Je(this.storage,this.storageKey,!0));try{return await O(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:s,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(o){if(await H(this.storage,`${this.storageKey}-code-verifier`),E(o))return this._returnResult({data:null,error:o});throw o}}async getUserIdentities(){var e;try{const{data:r,error:n}=await this.getUser();if(n)throw n;return this._returnResult({data:{identities:(e=r.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(r){if(E(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var r;try{const{data:n,error:s}=await this._useSession(async o=>{var i,a,c,l,u;const{data:d,error:h}=o;if(h)throw h;const f=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(i=e.options)===null||i===void 0?void 0:i.redirectTo,scopes:(a=e.options)===null||a===void 0?void 0:a.scopes,queryParams:(c=e.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:!0});return await O(this.fetch,"GET",f,{headers:this.headers,jwt:(u=(l=d.session)===null||l===void 0?void 0:l.access_token)!==null&&u!==void 0?u:void 0})});if(s)throw s;return Z()&&!(!((r=e.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(n?.url),this._returnResult({data:{provider:e.provider,url:n?.url},error:null})}catch(n){if(E(n))return this._returnResult({data:{provider:e.provider,url:null},error:n});throw n}}async linkIdentityIdToken(e){return await this._useSession(async r=>{var n;try{const{error:s,data:{session:o}}=r;if(s)throw s;const{options:i,provider:a,token:c,access_token:l,nonce:u}=e,d=await O(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(n=o?.access_token)!==null&&n!==void 0?n:void 0,body:{provider:a,id_token:c,access_token:l,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:i?.captchaToken}},xform:oe}),{data:h,error:f}=d;return f?this._returnResult({data:{user:null,session:null},error:f}):!h||!h.session||!h.user?this._returnResult({data:{user:null,session:null},error:new Ve}):(h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("USER_UPDATED",h.session)),this._returnResult({data:h,error:f}))}catch(s){if(await H(this.storage,`${this.storageKey}-code-verifier`),E(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}})}async unlinkIdentity(e){try{return await this._useSession(async r=>{var n,s;const{data:o,error:i}=r;if(i)throw i;
90return await O(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(s=(n=o.session)===null||n===void 0?void 0:n.access_token)!==null&&s!==void 0?s:void 0})})}catch(r){if(E(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(e){const r=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(r,"begin");try{const n=Date.now();return await $g(async s=>(s>0&&await Ig(200*Math.pow(2,s-1)),this._debug(r,"refreshing attempt",s),await O(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:oe})),(s,o)=>{const i=200*Math.pow(2,s);return o&&Lr(o)&&Date.now()+i-n<Qe})}catch(n){if(this._debug(r,"error",n),E(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}finally{this._debug(r,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,r){const n=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",r,"url",n),Z()&&!r.skipBrowserRedirect&&window.location.assign(n),{data:{provider:e,url:n},error:null}}async _recoverAndRefresh(){var e,r;const n="#_recoverAndRefresh()";this._debug(n,"begin");try{const s=await Pe(this.storage,this.storageKey);if(s&&this.userStorage){let i=await Pe(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!i&&(i={user:s.user},await et(this.userStorage,this.storageKey+"-user",i)),s.user=(e=i?.user)!==null&&e!==void 0?e:Dr()}else if(s&&!s.user&&!s.user){const i=await Pe(this.storage,this.storageKey+"-user");i&&i?.user?(s.user=i.user,await H(this.storage,this.storageKey+"-user"),await et(this.storage,this.storageKey,s)):s.user=Dr()}if(this._debug(n,"session from storage",s),!this._isValidSession(s)){this._debug(n,"session is not valid"),s!==null&&await this._removeSession();return}const o=((r=s.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<$r;if(this._debug(n,`session has${o?"":" not"} expired with margin of ${$r}s`),o){if(this.autoRefreshToken&&s.refresh_token){const{error:i}=await this._callRefreshToken(s.refresh_token);i&&(console.error(i),Lr(i)||(this._debug(n,"refresh failed with a non-retryable error, removing the session",i),await this._removeSession()))}}else if(s.user&&s.user.__isUserNotAvailableProxy===!0)try{const{data:i,error:a}=await this._getUser(s.access_token);!a&&i?.user?(s.user=i.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):this._debug(n,"could not get user data, skipping SIGNED_IN notification")}catch(i){console.error("Error getting user data:",i),this._debug(n,"error getting user data, skipping SIGNED_IN notification",i)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){this._debug(n,"error",s),console.error(s);return}finally{this._debug(n,"end")}}async _callRefreshToken(e){var r,n;if(!e)throw new te;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const s=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new wr;const{data:o,error:i}=await this._refreshAccessToken(e);if(i)throw i;if(!o.session)throw new te;await this._saveSession(o.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",o.session);const a={data:o.session,error:null};return this.refreshingDeferred.resolve(a),a}catch(o){if(this._debug(s,"error",o),E(o)){const i={data:null,error:o};return Lr(o)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(i),i}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(o),o}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(e,r,n=!0){const s=`#_notifyAllSubscribers(${e})`;this._debug(s,"begin",r,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:e,session:r});const o=[],i=Array.from(this.stateChangeEmitters.values()).map(async a=>{try{await a.callback(e,r)}catch(c){o.push(c)}});if(await Promise.all(i),o.length>0){for(let a=0;a<o.length;a+=1)console.error(o[a]);throw o[0]}}finally{this._debug(s,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await H(this.storage,`${this.storageKey}-code-verifier`);const r=Object.assign({},e),n=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&r.user&&await et(this.userStorage,this.storageKey+"-user",{user:r.user});const s=Object.assign({},r);delete s.user;const o=js(s);await et(this.storage,this.storageKey,o)}else{const s=js(r);await et(this.storage,this.storageKey,s)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await H(this.storage,this.storageKey),await H(this.storage,this.storageKey+"-code-verifier"),await H(this.storage,this.storageKey+"-user"),this.userStorage&&await H(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Z()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",e)}
90catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),Qe);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);const r=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=r,r&&typeof r=="object"&&typeof r.unref=="function"?r.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(r)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const r=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,r&&clearTimeout(r)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async r=>{const{data:{session:n}}=r;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((n.expires_at*1e3-e)/Qe);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${Qe}ms, refresh threshold is ${en} ticks`),s<=en&&await this._callRefreshToken(n.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof Ti)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Z()||!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug("#visibilityChangedCallback","error",e)}},window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const r=`#_onVisibilityChanged(${e})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,r,n){const s=[`provider=${encodeURIComponent(r)}`];if(n?.redirectTo&&s.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n?.scopes&&s.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){const[o,i]=await Je(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(o)}`,code_challenge_method:`${encodeURIComponent(i)}`});s.push(a.toString())}if(n?.queryParams){const o=new URLSearchParams(n.queryParams);s.push(o.toString())}return n?.skipBrowserRedirect&&s.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${e}?${s.join("&")}`}async _unenroll(e){try{return await this._useSession(async r=>{var n;const{data:s,error:o}=r;return o?this._returnResult({data:null,error:o}):await O(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(n=s?.session)===null||n===void 0?void 0:n.access_token})})}catch(r){if(E(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(e){try{return await this._useSession(async r=>{var n,s;const{data:o,error:i}=r;if(i)return this._returnResult({data:null,error:i});const a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:c,error:l}=await O(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(n=o?.session)===null||n===void 0?void 0:n.access_token});return l?this._returnResult({data:null,error:l}):(e.factorType==="totp"&&c.type==="totp"&&(!((s=c?.totp)===null||s===void 0)&&s.qr_code)&&(c.totp.qr_code=`data:image/svg+xml;utf-8,${c.totp.qr_code}`),this._returnResult({data:c,error:null}))})}catch(r){if(E(r))return this._returnResult({data:null,error:r});throw r}}async _verify(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var n;const{data:s,error:o}=r;if(o)return this._returnResult({data:null,error:o});const i=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?um(e.webauthn.credential_response):dm(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:c}=await O(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:i,headers:this.headers,jwt:(n=s?.session)===null||n===void 0?void 0:n.access_token});return c?this._returnResult({data:null,error:c}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),this._returnResult({data:a,error:c}))})}catch(r){if(E(r))return this._returnResult({data:null,error:r});throw r}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var n;const{data:s,error:o}=r;if(o)return this._returnResult({data:null,error:o});const i=await O(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(n=s?.session)===null||n===void 0?void 0:n.access_token});if(i.error)return i;const{data:a}=i;if(a.type!=="webauthn")return{data:a,error:null};switch(a.webauthn.type){case"create":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:cm(a.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:lm(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(E(r))return this._returnResult({data:null,error:r});throw r}})}async _challengeAndVerify(e){const{data:r,error:n}=await this._challenge({factorId:e.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:e.factorId,challengeId:r.id,code:e.code})}async _listFactors(){var e;const{data:{user:r},error:n}=await this.getUser();if(n)return{data:null,error:n};const s={all:[],phone:[],totp:[],webauthn:[]};for(const o of(e=r?.factors)!==null&&e!==void 0?e:[])s.all.push(o),o.status==="verified"&&s[o.factor_type].push(o);return{data:s,error:null}}async _getAuthenticatorAssuranceLevel(e){var r,n,s,o;if(e)try{const{payload:f}=Yt(e);let v=null;f.aal&&(v=f.aal);let m=v;const{data:{user:b},error:_}=await this.getUser(e);if(_)return this._returnResult({data:null,error:_});((n=(r=b?.factors)===null||r===void 0?void 0:r.filter(T=>T.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(m="aal2");const w=f.amr||[];return{data:{currentLevel:v,nextLevel:m,currentAuthenticationMethods:w},error:null}}catch(f){if(E(f))return this._returnResult({data:null,error:f});throw f}const{data:{session:i},error:a}
90=await this.getSession();if(a)return this._returnResult({data:null,error:a});if(!i)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:c}=Yt(i.access_token);let l=null;c.aal&&(l=c.aal);let u=l;((o=(s=i.user.factors)===null||s===void 0?void 0:s.filter(f=>f.status==="verified"))!==null&&o!==void 0?o:[]).length>0&&(u="aal2");const h=c.amr||[];return{data:{currentLevel:l,nextLevel:u,currentAuthenticationMethods:h},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;return s?this._returnResult({data:null,error:s}):n?await O(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:n.access_token,xform:o=>({data:o,error:null})}):this._returnResult({data:null,error:new te})})}catch(r){if(E(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(e,r){try{return await this._useSession(async n=>{const{data:{session:s},error:o}=n;if(o)return this._returnResult({data:null,error:o});if(!s)return this._returnResult({data:null,error:new te});const i=await O(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return i.data&&i.data.redirect_url&&Z()&&!r?.skipBrowserRedirect&&window.location.assign(i.data.redirect_url),i})}catch(n){if(E(n))return this._returnResult({data:null,error:n});throw n}}async _denyAuthorization(e,r){try{return await this._useSession(async n=>{const{data:{session:s},error:o}=n;if(o)return this._returnResult({data:null,error:o});if(!s)return this._returnResult({data:null,error:new te});const i=await O(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return i.data&&i.data.redirect_url&&Z()&&!r?.skipBrowserRedirect&&window.location.assign(i.data.redirect_url),i})}catch(n){if(E(n))return this._returnResult({data:null,error:n});throw n}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;return n?this._returnResult({data:null,error:n}):r?await O(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new te})})}catch(e){if(E(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;return s?this._returnResult({data:null,error:s}):n?(await O(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new te})})}catch(r){if(E(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(e,r={keys:[]}){let n=r.keys.find(a=>a.kid===e);if(n)return n;const s=Date.now();if(n=this.jwks.keys.find(a=>a.kid===e),n&&this.jwks_cached_at+wg>s)return n;const{data:o,error:i}=await O(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(i)throw i;return!o.keys||o.keys.length===0||(this.jwks=o,this.jwks_cached_at=s,n=o.keys.find(a=>a.kid===e),!n)?null:n}async getClaims(e,r={}){try{let n=e;if(!n){const{data:f,error:v}
90=await this.getSession();if(v||!f.session)return this._returnResult({data:null,error:v});n=f.session.access_token}const{header:s,payload:o,signature:i,raw:{header:a,payload:c}}=Yt(n);r?.allowExpired||Fg(o.exp);const l=!s.alg||s.alg.startsWith("HS")||!s.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(s.kid,r?.keys?{keys:r.keys}:r?.jwks);if(!l){const{error:f}=await this.getUser(n);if(f)throw f;return{data:{claims:o,header:s,signature:i},error:null}}const u=Wg(s.alg),d=await crypto.subtle.importKey("jwk",l,u,!0,["verify"]);if(!await crypto.subtle.verify(u,d,i,Cg(`${a}.${c}`)))throw new nn("Invalid JWT signature");return{data:{claims:o,header:s,signature:i},error:null}}catch(n){if(E(n))return this._returnResult({data:null,error:n});throw n}}}xt.nextInstanceID={};const wm=xt,_m="2.104.1";let ft="";typeof Deno<"u"?ft="deno":typeof document<"u"?ft="web":typeof navigator<"u"&&navigator.product==="ReactNative"?ft="react-native":ft="node";const km={"X-Client-Info":`supabase-js-${ft}/${_m}`},Sm={headers:km},Em={schema:"public"},xm={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Tm={};function Tt(t){"@babel/helpers - typeof";return Tt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Tt(t)}function Am(t,e){if(Tt(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Tt(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Om(t){var e=Am(t,"string");return Tt(e)=="symbol"?e:e+""}function Cm(t,e,r){return(e=Om(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function zs(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function B(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?zs(Object(r),!0).forEach(function(n){Cm(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):zs(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}const Rm=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),jm=()=>Headers,Pm=(t,e,r)=>{const n=Rm(r),s=jm();return async(o,i)=>{var a;const c=(a=await e())!==null&&a!==void 0?a:t;let l=new s(i?.headers);return l.has("apikey")||l.set("apikey",t),l.has("Authorization")||l.set("Authorization",`Bearer ${c}`),n(o,B(B({},i),{},{headers:l}))}};function Nm(t){return t.endsWith("/")?t:t+"/"}function Im(t,e){var r,n;const{db:s,auth:o,realtime:i,global:a}=t,{db:c,auth:l,realtime:u,global:d}=e,h={db:B(B({},c),s),auth:B(B({},l),o),realtime:B(B({},u),i),storage:{},global:B(B(B({},d),a),{},{headers:B(B({},(r=d?.headers)!==null&&r!==void 0?r:{}),(n=a?.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return t.accessToken?h.accessToken=t.accessToken:delete h.accessToken,h}function $m(t){const e=t?.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(Nm(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var Lm=class extends wm{constructor(t){super(t)}},Dm=class{constructor(t,e,r){var n,s;this.supabaseUrl=t,this.supabaseKey=e;const o=$m(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",o),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",o),this.storageUrl=new URL("storage/v1",o),this.functionsUrl=new URL("functions/v1",o);const i=`sb-${o.hostname.split(".")[0]}-auth-token`,a={db:Em,realtime:Tm,auth:B(B({},xm),{},{storageKey:i}),global:Sm},c=Im(r??{},a);if(this.storageKey=(n=c.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(s=c.global.headers)!==null&&s!==void 0?s:{},c.accessToken)this.accessToken=c.accessToken,this.auth=new Proxy({},{get:(u,d)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(d)} is not possible`)}});else{var l;this.auth=this._initSupabaseAuthClient((l=c.auth)!==null&&l!==void 0?l:{},this.headers,c.global.fetch)}this.fetch=Pm(e,this._getAccessToken.bind(this),c.global.fetch),this.realtime=this._initRealtimeClient(B({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},c.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(u=>this.realtime.setAuth(u)).catch(u=>console.warn("Failed to set initial Realtime auth token:",u)),this.rest=new sp(new URL("rest/v1",o).href,{headers:this.headers,schema:c.db.schema,fetch:this.fetch,timeout:c.db.timeout,urlLengthLimit:c.db.urlLengthLimit}),this.storage=new gg(this.storageUrl.href,this.headers,this.fetch,r?.storage),c.accessToken||this._listenForAuthEvents()}get functions(){return new Jf(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,r)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t=this,e,r;if(t.accessToken)return await t.accessToken();const{data:n}=await t.auth.getSession();return(e=(r=n.session)===null||r===void 0?void 0:r.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:s,storageKey:o,flowType:i,lock:a,debug:c,throwOnError:l},u,d){const h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Lm({url:this.authUrl.href,headers:B(B({},h),u),storageKey:o,autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:s,flowType:i,lock:a,debug:c,throwOnError:l,fetch:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(f=>f.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new Up(this.realtimeUrl.href,B(B({},t),{},{params:B(B({},{apikey:this.supabaseKey}),t?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e?.access_token)})}_handleTokenChanged(t,e,r){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const Um=(t,e,r)=>new Dm(t,e,r);function zm(){if(typeof window<"u")return!1;const t=globalThis.process;if(!t)return!1;const e=t.version;if(e==null)return!1;const r=e.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=18:!1}zm()&&console.warn("â ï¸ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to N
90ode.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");function Mm(){return Um("https://thygewuaylxewsgcgtap.supabase.co","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InRoeWdld3VheWx4ZXdzZ2NndGFwIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzY4MjU5NDgsImV4cCI6MjA5MjQwMTk0OH0.HxuM6R57BeQgYqvnWSqezUr-g6aA9QCjIGgWaMDWYTQ",{auth:{storage:typeof window<"u"?localStorage:void 0,persistSession:!0,autoRefreshToken:!0}})}let zr;const Bm=new Proxy({},{get(t,e,r){return zr||(zr=Mm()),Reflect.get(zr,e,r)}}),Fm=tf().trim().min(3,{message:"Please enter your email"}).max(255,{message:"Email is too long"}).email({message:"Please enter a valid email"});function Wm(){const[t,e]=g.useState(""),[r,n]=g.useState("idle"),s=async o=>{if(o.preventDefault(),r==="loading")return;const i=Fm.safeParse(t);if(!i.success){Nt.error(i.error.issues[0]?.message??"Invalid email");return}n("loading");const{error:a}=await Bm.from("newsletter_subscribers").insert({email:i.data.toLowerCase(),source:"footer"});if(a){if(a.code==="23505"){n("success"),Nt.success("You're already on the list â thank you.");return}n("idle"),Nt.error("Something went wrong. Please try again.");return}n("success"),Nt.success("Welcome aboard. Watch your inbox."),e("")};return p.jsxs("div",{children:[p.jsx("h3",{className:"font-display text-sm uppercase tracking-[0.25em] text-gold",children:"Newsletter"}),p.jsx("p",{className:"mt-5 text-sm leading-relaxed text-muted-foreground",children:"Recent weddings, brand events and productions from our team. Stay connected."}),r==="success"?p.jsxs("div",{className:"mt-5 flex items-center gap-3 rounded-full border border-gold/40 bg-gold/5 px-5 py-3 text-sm text-foreground",children:[p.jsx(Wi,{className:"h-4 w-4 text-gold"}),p.jsx("span",{children:"Subscribed â thank you."})]}):p.jsxs("form",{onSubmit:s,className:"mt-5 flex w-full items-center gap-2 rounded-full border border-border bg-background/40 p-1.5 transition-colors focus-within:border-gold",children:[p.jsx("label",{htmlFor:"newsletter-email",className:"sr-only",children:"Email address"}),p.jsx("input",{id:"newsletter-email",type:"email",inputMode:"email",autoComplete:"email",required:!0,maxLength:255,placeholder:"[email protected]",value:t,onChange:o=>e(o.target.value),disabled:r==="loading",className:"flex-1 bg-transparent px-4 py-2 text-sm text-foreground placeholder:text-muted-foreground/70 focus:outline-none disabled:opacity-50"}),p.jsxs("button",{type:"submit",disabled:r==="loading","aria-label":"Subscribe",className:"group inline-flex items-center gap-1.5 rounded-full bg-gold px-4 py-2 text-xs font-medium uppercase tracking-[0.2em] text-gold-foreground transition-all hover:scale-[1.02] disabled:opacity-60 disabled:hover:scale-100",children:[r==="loading"?"â¦":"Join",p.jsx(zi,{className:"h-3.5 w-3.5 transition-transform group-hover:translate-x-0.5"})]})]})]})}const qm=({className:t})=>p.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:t,"aria-hidden":"true",children:p.jsx("path",{d:"M19.59 6.69a4.83 4.83 0 0 1-3.77-4.25V2h-3.45v13.67a2.89 2.89 0 0 1-5.2 1.74 2.89 2.89 0 0 1 2.31-4.64 2.93 2.93 0 0 1 .88.13V9.4a6.84 6.84 0 0 0-1-.05A6.33 6.33 0 0 0 5.8 20.1a6.34 6.34 0 0 0 10.86-4.43V8.66a8.16 8.16 0 0 0 4.77 1.52V6.73a4.85 4.85 0 0 1-1.84-.04Z"})}),Hm=[{title:"Explore",links:[{label:"Home",to:"/"},{label:"Services",to:"/services"},{label:"Vendors",to:"/vendors"},{label:"About",to:"/"}]},{title:"Services",links:[{label:"Live Music",to:"/services",hash:"live-music"},{label:"DJs & Sound",to:"/services",hash:"djs"},{label:"Staging & Lighting",to:"/services",hash:"staging"},{label:"Headline Artists",to:"/services",hash:"live-music"}]},{title:"Contact",links:[{label:"[email protected]",to:"/"},{label:"English (754) 422-5299",to:"/"},{label:"Español (786) 898-7298",to:"/"},{label:"Request a Quote",to:"/"}]}];function ev(){return p.jsx("footer",{className:"border-t border-border bg-card/40",children:p.jsxs("div",{className:"mx-auto max-w-7xl px-6 py-20 lg:px-10",children:[p.jsxs("div",{className:"grid gap-14 lg:grid-cols-[1.1fr_2.4fr_1.2fr]",children:[p.jsxs("div",{children:[p.jsxs(pe,{to:"/",className:"group inline-flex items-center",children:[p.jsx("img",{src:qo,alt:"Cadenza Events",className:"hidden h-20 w-auto opacity-90 transition-opacity group-hover:opacity-100 dark:block"}),p.jsx("img",{src:Ho,alt:"Cadenza Events",className:"block h-20 w-auto opacity-90 transition-opacity group-hover:opacity-100 dark:hidden"})]}),p.jsx("p",{className:"mt-5 max-w-sm text-sm leading-relaxed text-muted-foreground",children:"Live event entertainment, staging, lighting and media â produced under one roof for weddings, brand events and live shows."}),p.jsx("div",{className:"mt-8 flex items-center gap-3",children:[{Icon:Ki,href:"https://www.instagram.com/cadenzaevents_",label:"Instagram"},{Icon:Vi,href:"https://www.facebook.com/profile.php?id=61552128208888",label:"Facebook"},{Icon:qm,href:"https://www.tiktok.com/@ajthedj305",label:"TikTok"},{Icon:la,href:"https://www.youtube.com/@ajthedj.cadenza",label:"YouTube"}].map(({Icon:t,href:e,label:r})=>p.jsx("a",{href:e,target:e.startsWith("http")?"_blank":void 0,rel:e.startsWith("http")?"noopener noreferrer":void 0,"aria-label":r,className:"flex h-10 w-10 items-center justify-center rounded-full border border-border text-muted-foreground transition-all hover:border-gold hover:text-gold",children:p.jsx(t,{className:"h-4 w-4"})},r))})]}),p.jsx("div",{className:"grid grid-cols-2 gap-x-6 gap-y-10 sm:grid-cols-3",children:Hm.map(t=>p.jsxs("div",{children:[p.jsx("h3",{className:"font-display text-xs uppercase tracking-[0.18em] text-gold",children:t.title}),p.jsx("ul",{className:"mt-5 space-y-3",children:t.links.map(e=>p.jsx("li",{children:p.jsx(pe,{to:e.to,hash:e.hash,className:"text-sm text-muted-foreground transition-colors hover:text-foreground",children:e.label})},e.label))})]},t.title))}),p.jsx(Wm,{})]}),p.jsxs("div",{className:"mt-16 flex flex-col items-start justify-between gap-4 border-t border-border pt-8 sm:flex-row sm:items-center",children:[p.jsxs("p",{className:"text-xs tracking-wide text-muted-foreground",children:["© ",new Date().getFullYear()," Cadenza Events Ltd. All rights reserved."]}),p.jsxs("p",{className:"text-xs tracking-wide text-muted-foreground",children:["Developed by"," ",p.jsx("a",{href:"https://wedo.software",target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground transition-colors hover:text-gold",children:"wedo.software"})]})]})]})})}const lr="69b1c21f29cb6300337e91dd",ur="69b1c21f29cb6300337e91df",Zm="https://widget.honeybook.com/assets_users_production/websiteplacements/placement-controller.min.js",Vm=`https://www.honeybook.com/widget/cadenza_events_${lr}/cf_id/${ur}`,Jm=1e4,Km=3;function dr(){const t=window;return t._HB_=t._HB_||{},t._HB_.pid=lr,t._HB_}function Ms(t){const e=dr(),r=e.iframeElements?.[ur];r&&(!r.isConnected||!t?.contains(r))&&delete e.iframeElements?.[ur]}function Ci(t=1){return new Promise((e,r)=>{dr();const n=document.querySelector('script[data-hb-loader="true"]');if(n&&n.dataset.loaded==="true"){e();return}n&&n.remove();const s=document.createElement("script");s.type="text/javascript",s.async=!0,s.src=`${Zm}?v=${Date.now()}`,s.dataset.hbLoader="true",s.onload=()=>{s.dataset.loaded="true",e()},s.onerror=()=>{if(s.remove(),t<Km){const o=500*2**(t-1);setTimeout(()=>{Ci(t+1).then(e,r)},o)}else r(new Error("Failed to load HoneyBook widget"))},document.body.appendChild(s)})}function Gm(){const[t,e]=g.useState("loading"),[r,n]=g.useState(0),s=g.useRef(null);g.useEffect(()=>{let i=!1;if(e("loading"),Ms(s.current),s.current?.querySelector("iframe"))return e("ready"),()=>{i=!0};const c=new MutationObserver(()=>{if(i)return;s.current?.querySelector("iframe")&&(e("ready"),c.disconnect())});s.current&&c.observe(s.current,{childList:!0,subtree:!0});const l=window.setTimeout(()=>{if(i)return;s.current?.querySelector("iframe")||(e("error"),c.disconnect())},Jm);return Ci().then(()=>{i||requestAnimationFrame(()=>{if(i)return;if(s.current?.querySelector("iframe")){e("ready");return}const d=dr();Ms(s.current),d.runIfGotAllConfigurations?.()})}).catch(()=>{i||e("error")}),()=>{i=!0,c.disconnect(),window.clearTimeout(l)}},[r]);const o=()=>{document.querySelectorAll('script[data-hb-loader="true"]').forEach(a=>a.remove());const i=dr();delete i.iframeElements?.[ur],n(a=>a+1)};return p.jsxs("div",{className:"relative w-full",children:[t==="loading"&&p.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-3 rounded-lg bg-background/80 backdrop-blur-sm","aria-live":"polite",children:[p.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-gold/30 border-t-gold"}),p.jsx("p",{className:"text-xs uppercase tracking-[0.3em] text-muted-foreground",children:"Loading formâ¦"})]}),t==="error"&&p.jsxs("div",{className:"rounded-lg border border-gold/30 bg-background/60 p-6 text-center",children:[p.jsx(Bi,{className:"mx-auto h-8 w-8 text-gold"}),p.jsx("h3",{className:"mt-3 font-display text-lg text-foreground",children:"Form is taking too long to load"}),p.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Reach us instantly through any of the options below, or retry the form."}),p.jsxs("div",{className:"mt-5 flex flex-col gap-2 sm:flex-row sm:justify-center",children:[p.jsxs("a",{href:Vm,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center gap-2 rounded-full bg-gold px-5 py-2.5 text-sm font-medium text-gold-foreground transition-all hover:scale-[1.02]",children:[p.jsx(Hi,{className:"h-4 w-4"}),"Open form in new tab"]}),p.jsxs("button",{type:"button",onClick:o,className:"inline-flex items-center justify-center gap-2 rounded-full border border-border bg-transparent px-5 py-2.5 text-sm font-medium text-foreground transition-colors hover:border-gold hover:text-gold",children:[p.jsx(sa,{className:"h-4 w-4"}),"Try again"]})]}),p.jsxs("div",{className:"mt-6 flex flex-col items-center gap-3 border-t border-border pt-5 text-sm",children:[p.jsxs("a",{href:"mailto:[email protected]",className:"inline-flex items-center gap-2 text-muted-foreground transition-colors hover:text-gold",children:[p.jsx(Yi,{className:"h-4 w-4"}),"[email protected]"]}),p.jsxs("a",{href:"tel:+17544225299",className:"inline-flex items-center gap-2 text-muted-foreground transition-colors hover:text-gold",children:[p.jsx(On,{className:"h-4 w-4"}),"English (754) 422-5299"]}),p.jsxs("a",{href:"tel:+17868987298",className:"inline-flex items-center gap-2 text-muted-foreground transition-colors hover:text-gold",children:[p.jsx(On,{className:"h-4 w-4"}
90),"Español (786) 898-7298"]})]})]}),p.jsxs("div",{ref:s,className:`w-full min-h-[760px] [&_iframe]:!block [&_iframe]:!w-full [&_iframe]:!min-h-[760px] [&_iframe]:!border-0 ${t==="error"?"hidden":""}`,children:[p.jsx("div",{className:`hb-p-${lr}-2 min-h-[760px] w-full`}),p.jsx("img",{height:"1",width:"1",style:{display:"none"},src:`https://www.honeybook.com/p.png?pid=${lr}`,alt:""})]})]})}function tv(){return p.jsx("section",{id:"contact",className:"px-6 py-32 lg:px-10",children:p.jsxs("div",{className:"relative mx-auto max-w-6xl overflow-hidden rounded-2xl border border-border bg-card px-8 py-20 shadow-soft sm:px-16 sm:py-28",children:[p.jsx("div",{className:"pointer-events-none absolute -top-32 -right-32 h-96 w-96 rounded-full bg-gold/20 blur-3xl"}),p.jsx("div",{className:"pointer-events-none absolute -bottom-32 -left-32 h-96 w-96 rounded-full bg-gold/10 blur-3xl"}),p.jsxs("div",{className:"relative grid gap-12 lg:grid-cols-[1.1fr_1fr] lg:items-start",children:[p.jsxs("div",{className:"max-w-2xl",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("span",{className:"gold-divider"}),p.jsx("span",{className:"text-[11px] uppercase tracking-[0.4em] text-gold",children:"Let's Chat About Your Event"})]}),p.jsxs("h2",{className:"mt-6 font-display text-4xl leading-tight text-card-foreground sm:text-5xl lg:text-6xl",children:["One Team. Real"," ",p.jsx("em",{className:"font-normal italic text-gold",children:"Attention to Detail"}),"."]}),p.jsx("p",{className:"mt-6 max-w-xl text-base leading-relaxed text-muted-foreground",children:"No two weddings or events are ever the same, and we never treat them like they are."}),p.jsx("p",{className:"mt-4 max-w-xl text-base leading-relaxed text-muted-foreground",children:"We take the time to understand what matters most to you so everything feels thoughtful, personal and genuinely fun for both you and your guests."})]}),p.jsxs("div",{className:"relative w-full",children:[p.jsx("div",{className:"pointer-events-none absolute -left-px top-8 bottom-8 w-[2px] rounded-full bg-gradient-to-b from-transparent via-gold to-transparent opacity-70"}),p.jsx("div",{className:"relative rounded-xl border border-gold/25 bg-background/60 p-4 shadow-elegant backdrop-blur-sm sm:p-6",children:p.jsx(Gm,{})})]})]})]})})}export{zi as A,tv as C,Qm as S,ev as a,ee as c};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.