@nextblock-cms/db 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,57 @@
1
+ "use strict";const Ts=s=>{let e;return s?e=s:typeof fetch>"u"?e=(...t)=>Promise.resolve().then(()=>tt).then(({default:r})=>r(...t)):e=fetch,(...t)=>e(...t)};class br extends Error{constructor(e,t="FunctionsError",r){super(e),this.name=t,this.context=r}}class As extends br{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class Kr extends br{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class Jr extends br{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var cr;(function(s){s.Any="any",s.ApNortheast1="ap-northeast-1",s.ApNortheast2="ap-northeast-2",s.ApSouth1="ap-south-1",s.ApSoutheast1="ap-southeast-1",s.ApSoutheast2="ap-southeast-2",s.CaCentral1="ca-central-1",s.EuCentral1="eu-central-1",s.EuWest1="eu-west-1",s.EuWest2="eu-west-2",s.EuWest3="eu-west-3",s.SaEast1="sa-east-1",s.UsEast1="us-east-1",s.UsWest1="us-west-1",s.UsWest2="us-west-2"})(cr||(cr={}));var Os=function(s,e,t,r){function n(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function c(h){try{l(r.next(h))}catch(f){o(f)}}function u(h){try{l(r.throw(h))}catch(f){o(f)}}function l(h){h.done?i(h.value):n(h.value).then(c,u)}l((r=r.apply(s,e||[])).next())})};class js{constructor(e,{headers:t={},customFetch:r,region:n=cr.Any}={}){this.url=e,this.headers=t,this.region=n,this.fetch=Ts(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e,t={}){var r;return Os(this,void 0,void 0,function*(){try{const{headers:n,method:i,body:o}=t;let c={},{region:u}=t;u||(u=this.region);const l=new URL(`${this.url}/${e}`);u&&u!=="any"&&(c["x-region"]=u,l.searchParams.set("forceFunctionRegion",u));let h;o&&(n&&!Object.prototype.hasOwnProperty.call(n,"Content-Type")||!n)&&(typeof Blob<"u"&&o instanceof Blob||o instanceof ArrayBuffer?(c["Content-Type"]="application/octet-stream",h=o):typeof o=="string"?(c["Content-Type"]="text/plain",h=o):typeof FormData<"u"&&o instanceof FormData?h=o:(c["Content-Type"]="application/json",h=JSON.stringify(o)));const f=yield this.fetch(l.toString(),{method:i||"POST",headers:Object.assign(Object.assign(Object.assign({},c),this.headers),n),body:h}).catch(O=>{throw new As(O)}),_=f.headers.get("x-relay-error");if(_&&_==="true")throw new Kr(f);if(!f.ok)throw new Jr(f);let y=((r=f.headers.get("Content-Type"))!==null&&r!==void 0?r:"text/plain").split(";")[0].trim(),v;return y==="application/json"?v=yield f.json():y==="application/octet-stream"?v=yield f.blob():y==="text/event-stream"?v=f:y==="multipart/form-data"?v=yield f.formData():v=yield f.text(),{data:v,error:null,response:f}}catch(n){return{data:null,error:n,response:n instanceof Jr||n instanceof Kr?n.context:void 0}}})}}function Cs(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Ps(s){if(Object.prototype.hasOwnProperty.call(s,"__esModule"))return s;var e=s.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(r){var n=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return s[r]}})}),t}var ne={},Be={},He={},We={},Fe={},Ge={},$s=function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")},et=$s();const xs=et.fetch,Kn=et.fetch.bind(et),Jn=et.Headers,Is=et.Request,Ds=et.Response,tt=Object.freeze(Object.defineProperty({__proto__:null,Headers:Jn,Request:Is,Response:Ds,default:Kn,fetch:xs},Symbol.toStringTag,{value:"Module"})),Ns=Ps(tt);var bt={},Yr;function Yn(){if(Yr)return bt;Yr=1,Object.defineProperty(bt,"__esModule",{value:!0});class s extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}}return bt.default=s,bt}var Vr;function Vn(){if(Vr)return Ge;Vr=1;var s=Ge&&Ge.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Ge,"__esModule",{value:!0});const e=s(Ns),t=s(Yn());class r{constructor(i){this.shouldThrowOnError=!1,this.method=i.method,this.url=i.url,this.headers=i.headers,this.schema=i.schema,this.body=i.body,this.shouldThrowOnError=i.shouldThrowOnError,this.signal=i.signal,this.isMaybeSingle=i.isMaybeSingle,i.fetch?this.fetch=i.fetch:typeof fetch>"u"?this.fetch=e.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(i,o){return this.headers=Object.assign({},this.headers),this.headers[i]=o,this}then(i,o){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers["Accept-Profile"]=this.schema:this.headers["Content-Profile"]=this.schema),this.method!=="GET"&&this.method!=="HEAD"&&(this.headers["Content-Type"]="application/json");const c=this.fetch;let u=c(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async l=>{var h,f,_;let y=null,v=null,O=null,T=l.status,j=l.statusText;if(l.ok){if(this.method!=="HEAD"){const d=await l.text();d===""||(this.headers.Accept==="text/csv"||this.headers.Accept&&this.headers.Accept.includes("application/vnd.pgrst.plan+text")?v=d:v=JSON.parse(d))}const A=(h=this.headers.Prefer)===null||h===void 0?void 0:h.match(/count=(exact|planned|estimated)/),U=(f=l.headers.get("content-range"))===null||f===void 0?void 0:f.split("/");A&&U&&U.length>1&&(O=parseInt(U[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(v)&&(v.length>1?(y={code:"PGRST116",details:`Results contain ${v.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},v=null,O=null,T=406,j="Not Acceptable"):v.length===1?v=v[0]:v=null)}else{const A=await l.text();try{y=JSON.parse(A),Array.isArray(y)&&l.status===404&&(v=[],y=null,T=200,j="OK")}catch{l.status===404&&A===""?(T=204,j="No Content"):y={message:A}}if(y&&this.isMaybeSingle&&(!((_=y==null?void 0:y.details)===null||_===void 0)&&_.includes("0 rows"))&&(y=null,T=200,j="OK"),y&&this.shouldThrowOnError)throw new t.default(y)}return{error:y,data:v,count:O,status:T,statusText:j}});return this.shouldThrowOnError||(u=u.catch(l=>{var h,f,_;return{error:{message:`${(h=l==null?void 0:l.name)!==null&&h!==void 0?h:"FetchError"}: ${l==null?void 0:l.message}`,details:`${(f=l==null?void 0:l.stack)!==null&&f!==void 0?f:""}`,hint:"",code:`${(_=l==null?void 0:l.code)!==null&&_!==void 0?_:""}`},data:null,count:null,status:0,statusText:""}})),u.then(i,o)}returns(){return this}overrideTypes(){return this}}return Ge.default=r,Ge}var Xr;function Xn(){if(Xr)return Fe;Xr=1;var s=Fe&&Fe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Fe,"__esModule",{value:!0});const e=s(Vn());class t extends e.default{select(n){let i=!1;const o=(n??"*").split("").map(c=>/\s/.test(c)&&!i?"":(c==='"'&&(i=!i),c)).join("");return this.url.searchParams.set("select",o),this.headers.Prefer&&(this.headers.Prefer+=","),this.headers.Prefer+="return=representation",this}order(n,{ascending:i=!0,nullsFirst:o,foreignTable:c,referencedTable:u=c}={}){const l=u?`${u}.order`:"order",h=this.url.searchParams.get(l);return this.url.searchParams.set(l,`${h?`${h},`:""}${n}.${i?"asc":"desc"}${o===void 0?"":o?".nullsfirst":".nullslast"}`),this}limit(n,{foreignTable:i,referencedTable:o=i}={}){const c=typeof o>"u"?"limit":`${o}.limit`;return this.url.searchParams.set(c,`${n}`),this}range(n,i,{foreignTable:o,referencedTable:c=o}={}){const u=typeof c>"u"?"offset":`${c}.offset`,l=typeof c>"u"?"limit":`${c}.limit`;return this.url.searchParams.set(u,`${n}`),this.url.searchParams.set(l,`${i-n+1}`),this}abortSignal(n){return this.signal=n,this}single(){return this.headers.Accept="application/vnd.pgrst.object+json",this}maybeSingle(){return this.method==="GET"?this.headers.Accept="application/json":this.headers.Accept="application/vnd.pgrst.object+json",this.isMaybeSingle=!0,this}csv(){return this.headers.Accept="text/csv",this}geojson(){return this.headers.Accept="application/geo+json",this}explain({analyze:n=!1,verbose:i=!1,settings:o=!1,buffers:c=!1,wal:u=!1,format:l="text"}={}){var h;const f=[n?"analyze":null,i?"verbose":null,o?"settings":null,c?"buffers":null,u?"wal":null].filter(Boolean).join("|"),_=(h=this.headers.Accept)!==null&&h!==void 0?h:"application/json";return this.headers.Accept=`application/vnd.pgrst.plan+${l}; for="${_}"; options=${f};`,l==="json"?this:this}rollback(){var n;return((n=this.headers.Prefer)!==null&&n!==void 0?n:"").trim().length>0?this.headers.Prefer+=",tx=rollback":this.headers.Prefer="tx=rollback",this}returns(){return this}}return Fe.default=t,Fe}var Qr;function Er(){if(Qr)return We;Qr=1;var s=We&&We.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(We,"__esModule",{value:!0});const e=s(Xn());class t extends e.default{eq(n,i){return this.url.searchParams.append(n,`eq.${i}`),this}neq(n,i){return this.url.searchParams.append(n,`neq.${i}`),this}gt(n,i){return this.url.searchParams.append(n,`gt.${i}`),this}gte(n,i){return this.url.searchParams.append(n,`gte.${i}`),this}lt(n,i){return this.url.searchParams.append(n,`lt.${i}`),this}lte(n,i){return this.url.searchParams.append(n,`lte.${i}`),this}like(n,i){return this.url.searchParams.append(n,`like.${i}`),this}likeAllOf(n,i){return this.url.searchParams.append(n,`like(all).{${i.join(",")}}`),this}likeAnyOf(n,i){return this.url.searchParams.append(n,`like(any).{${i.join(",")}}`),this}ilike(n,i){return this.url.searchParams.append(n,`ilike.${i}`),this}ilikeAllOf(n,i){return this.url.searchParams.append(n,`ilike(all).{${i.join(",")}}`),this}ilikeAnyOf(n,i){return this.url.searchParams.append(n,`ilike(any).{${i.join(",")}}`),this}is(n,i){return this.url.searchParams.append(n,`is.${i}`),this}in(n,i){const o=Array.from(new Set(i)).map(c=>typeof c=="string"&&new RegExp("[,()]").test(c)?`"${c}"`:`${c}`).join(",");return this.url.searchParams.append(n,`in.(${o})`),this}contains(n,i){return typeof i=="string"?this.url.searchParams.append(n,`cs.${i}`):Array.isArray(i)?this.url.searchParams.append(n,`cs.{${i.join(",")}}`):this.url.searchParams.append(n,`cs.${JSON.stringify(i)}`),this}containedBy(n,i){return typeof i=="string"?this.url.searchParams.append(n,`cd.${i}`):Array.isArray(i)?this.url.searchParams.append(n,`cd.{${i.join(",")}}`):this.url.searchParams.append(n,`cd.${JSON.stringify(i)}`),this}rangeGt(n,i){return this.url.searchParams.append(n,`sr.${i}`),this}rangeGte(n,i){return this.url.searchParams.append(n,`nxl.${i}`),this}rangeLt(n,i){return this.url.searchParams.append(n,`sl.${i}`),this}rangeLte(n,i){return this.url.searchParams.append(n,`nxr.${i}`),this}rangeAdjacent(n,i){return this.url.searchParams.append(n,`adj.${i}`),this}overlaps(n,i){return typeof i=="string"?this.url.searchParams.append(n,`ov.${i}`):this.url.searchParams.append(n,`ov.{${i.join(",")}}`),this}textSearch(n,i,{config:o,type:c}={}){let u="";c==="plain"?u="pl":c==="phrase"?u="ph":c==="websearch"&&(u="w");const l=o===void 0?"":`(${o})`;return this.url.searchParams.append(n,`${u}fts${l}.${i}`),this}match(n){return Object.entries(n).forEach(([i,o])=>{this.url.searchParams.append(i,`eq.${o}`)}),this}not(n,i,o){return this.url.searchParams.append(n,`not.${i}.${o}`),this}or(n,{foreignTable:i,referencedTable:o=i}={}){const c=o?`${o}.or`:"or";return this.url.searchParams.append(c,`(${n})`),this}filter(n,i,o){return this.url.searchParams.append(n,`${i}.${o}`),this}}return We.default=t,We}var Zr;function Qn(){if(Zr)return He;Zr=1;var s=He&&He.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(He,"__esModule",{value:!0});const e=s(Er());class t{constructor(n,{headers:i={},schema:o,fetch:c}){this.url=n,this.headers=i,this.schema=o,this.fetch=c}select(n,{head:i=!1,count:o}={}){const c=i?"HEAD":"GET";let u=!1;const l=(n??"*").split("").map(h=>/\s/.test(h)&&!u?"":(h==='"'&&(u=!u),h)).join("");return this.url.searchParams.set("select",l),o&&(this.headers.Prefer=`count=${o}`),new e.default({method:c,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}insert(n,{count:i,defaultToNull:o=!0}={}){const c="POST",u=[];if(this.headers.Prefer&&u.push(this.headers.Prefer),i&&u.push(`count=${i}`),o||u.push("missing=default"),this.headers.Prefer=u.join(","),Array.isArray(n)){const l=n.reduce((h,f)=>h.concat(Object.keys(f)),[]);if(l.length>0){const h=[...new Set(l)].map(f=>`"${f}"`);this.url.searchParams.set("columns",h.join(","))}}return new e.default({method:c,url:this.url,headers:this.headers,schema:this.schema,body:n,fetch:this.fetch,allowEmpty:!1})}upsert(n,{onConflict:i,ignoreDuplicates:o=!1,count:c,defaultToNull:u=!0}={}){const l="POST",h=[`resolution=${o?"ignore":"merge"}-duplicates`];if(i!==void 0&&this.url.searchParams.set("on_conflict",i),this.headers.Prefer&&h.push(this.headers.Prefer),c&&h.push(`count=${c}`),u||h.push("missing=default"),this.headers.Prefer=h.join(","),Array.isArray(n)){const f=n.reduce((_,y)=>_.concat(Object.keys(y)),[]);if(f.length>0){const _=[...new Set(f)].map(y=>`"${y}"`);this.url.searchParams.set("columns",_.join(","))}}return new e.default({method:l,url:this.url,headers:this.headers,schema:this.schema,body:n,fetch:this.fetch,allowEmpty:!1})}update(n,{count:i}={}){const o="PATCH",c=[];return this.headers.Prefer&&c.push(this.headers.Prefer),i&&c.push(`count=${i}`),this.headers.Prefer=c.join(","),new e.default({method:o,url:this.url,headers:this.headers,schema:this.schema,body:n,fetch:this.fetch,allowEmpty:!1})}delete({count:n}={}){const i="DELETE",o=[];return n&&o.push(`count=${n}`),this.headers.Prefer&&o.unshift(this.headers.Prefer),this.headers.Prefer=o.join(","),new e.default({method:i,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}}return He.default=t,He}var st={},it={},en;function Us(){return en||(en=1,Object.defineProperty(it,"__esModule",{value:!0}),it.version=void 0,it.version="0.0.0-automated"),it}var tn;function Ls(){if(tn)return st;tn=1,Object.defineProperty(st,"__esModule",{value:!0}),st.DEFAULT_HEADERS=void 0;const s=Us();return st.DEFAULT_HEADERS={"X-Client-Info":`postgrest-js/${s.version}`},st}var rn;function qs(){if(rn)return Be;rn=1;var s=Be&&Be.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Be,"__esModule",{value:!0});const e=s(Qn()),t=s(Er()),r=Ls();class n{constructor(o,{headers:c={},schema:u,fetch:l}={}){this.url=o,this.headers=Object.assign(Object.assign({},r.DEFAULT_HEADERS),c),this.schemaName=u,this.fetch=l}from(o){const c=new URL(`${this.url}/${o}`);return new e.default(c,{headers:Object.assign({},this.headers),schema:this.schemaName,fetch:this.fetch})}schema(o){return new n(this.url,{headers:this.headers,schema:o,fetch:this.fetch})}rpc(o,c={},{head:u=!1,get:l=!1,count:h}={}){let f;const _=new URL(`${this.url}/rpc/${o}`);let y;u||l?(f=u?"HEAD":"GET",Object.entries(c).filter(([O,T])=>T!==void 0).map(([O,T])=>[O,Array.isArray(T)?`{${T.join(",")}}`:`${T}`]).forEach(([O,T])=>{_.searchParams.append(O,T)})):(f="POST",y=c);const v=Object.assign({},this.headers);return h&&(v.Prefer=`count=${h}`),new t.default({method:f,url:_,headers:v,schema:this.schemaName,body:y,fetch:this.fetch,allowEmpty:!1})}}return Be.default=n,Be}var nn;function Ms(){if(nn)return ne;nn=1;var s=ne&&ne.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(ne,"__esModule",{value:!0}),ne.PostgrestError=ne.PostgrestBuilder=ne.PostgrestTransformBuilder=ne.PostgrestFilterBuilder=ne.PostgrestQueryBuilder=ne.PostgrestClient=void 0;const e=s(qs());ne.PostgrestClient=e.default;const t=s(Qn());ne.PostgrestQueryBuilder=t.default;const r=s(Er());ne.PostgrestFilterBuilder=r.default;const n=s(Xn());ne.PostgrestTransformBuilder=n.default;const i=s(Vn());ne.PostgrestBuilder=i.default;const o=s(Yn());return ne.PostgrestError=o.default,ne.default={PostgrestClient:e.default,PostgrestQueryBuilder:t.default,PostgrestFilterBuilder:r.default,PostgrestTransformBuilder:n.default,PostgrestBuilder:i.default,PostgrestError:o.default},ne}var Bs=Ms();const Hs=Cs(Bs),{PostgrestClient:Ws,PostgrestQueryBuilder:Qo,PostgrestFilterBuilder:Zo,PostgrestTransformBuilder:ea,PostgrestBuilder:ta,PostgrestError:ra}=Hs;class Fs{static dynamicRequire(e){try{return typeof process<"u"&&process.versions&&process.versions.node&&typeof require<"u"?require(e):null}catch{return null}}static detectEnvironment(){var e,t;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."};if(typeof process<"u"&&process.versions&&process.versions.node){const r=parseInt(process.versions.node.split(".")[0]);if(r>=22)try{if(typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};const n=this.dynamicRequire("undici");if(n&&n.WebSocket)return{type:"native",constructor:n.WebSocket};throw new Error("undici not available")}catch{return{type:"unsupported",error:`Node.js ${r} detected but native WebSocket not found.`,workaround:'Install the "ws" package or check your Node.js installation.'}}try{const n=this.dynamicRequire("ws");if(n)return{type:"ws",constructor:(t=n.WebSocket)!==null&&t!==void 0?t:n};throw new Error("ws package not available")}catch{return{type:"unsupported",error:`Node.js ${r} detected without WebSocket support.`,workaround:'Install the "ws" package: npm install 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 t=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(t+=`
2
+
3
+ Suggested solution: ${e.workaround}`),new Error(t)}static createWebSocket(e,t){const r=this.getWebSocketConstructor();return new r(e,t)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const Gs="2.15.0",zs=`realtime-js/${Gs}`,Ks="1.0.0",lr=1e4,Js=1e3,Ys=100;var ct;(function(s){s[s.connecting=0]="connecting",s[s.open=1]="open",s[s.closing=2]="closing",s[s.closed=3]="closed"})(ct||(ct={}));var re;(function(s){s.closed="closed",s.errored="errored",s.joined="joined",s.joining="joining",s.leaving="leaving"})(re||(re={}));var ye;(function(s){s.close="phx_close",s.error="phx_error",s.join="phx_join",s.reply="phx_reply",s.leave="phx_leave",s.access_token="access_token"})(ye||(ye={}));var hr;(function(s){s.websocket="websocket"})(hr||(hr={}));var Ne;(function(s){s.Connecting="connecting",s.Open="open",s.Closing="closing",s.Closed="closed"})(Ne||(Ne={}));class Vs{constructor(){this.HEADER_LENGTH=1}decode(e,t){return e.constructor===ArrayBuffer?t(this._binaryDecode(e)):t(typeof e=="string"?JSON.parse(e):{})}_binaryDecode(e){const t=new DataView(e),r=new TextDecoder;return this._decodeBroadcast(e,t,r)}_decodeBroadcast(e,t,r){const n=t.getUint8(1),i=t.getUint8(2);let o=this.HEADER_LENGTH+2;const c=r.decode(e.slice(o,o+n));o=o+n;const u=r.decode(e.slice(o,o+i));o=o+i;const l=JSON.parse(r.decode(e.slice(o,e.byteLength)));return{ref:null,topic:c,event:u,payload:l}}}class Zn{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=t}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var Q;(function(s){s.abstime="abstime",s.bool="bool",s.date="date",s.daterange="daterange",s.float4="float4",s.float8="float8",s.int2="int2",s.int4="int4",s.int4range="int4range",s.int8="int8",s.int8range="int8range",s.json="json",s.jsonb="jsonb",s.money="money",s.numeric="numeric",s.oid="oid",s.reltime="reltime",s.text="text",s.time="time",s.timestamp="timestamp",s.timestamptz="timestamptz",s.timetz="timetz",s.tsrange="tsrange",s.tstzrange="tstzrange"})(Q||(Q={}));const sn=(s,e,t={})=>{var r;const n=(r=t.skipTypes)!==null&&r!==void 0?r:[];return Object.keys(e).reduce((i,o)=>(i[o]=Xs(o,s,e,n),i),{})},Xs=(s,e,t,r)=>{const n=e.find(c=>c.name===s),i=n==null?void 0:n.type,o=t[s];return i&&!r.includes(i)?es(i,o):dr(o)},es=(s,e)=>{if(s.charAt(0)==="_"){const t=s.slice(1,s.length);return ti(e,t)}switch(s){case Q.bool:return Qs(e);case Q.float4:case Q.float8:case Q.int2:case Q.int4:case Q.int8:case Q.numeric:case Q.oid:return Zs(e);case Q.json:case Q.jsonb:return ei(e);case Q.timestamp:return ri(e);case Q.abstime:case Q.date:case Q.daterange:case Q.int4range:case Q.int8range:case Q.money:case Q.reltime:case Q.text:case Q.time:case Q.timestamptz:case Q.timetz:case Q.tsrange:case Q.tstzrange:return dr(e);default:return dr(e)}},dr=s=>s,Qs=s=>{switch(s){case"t":return!0;case"f":return!1;default:return s}},Zs=s=>{if(typeof s=="string"){const e=parseFloat(s);if(!Number.isNaN(e))return e}return s},ei=s=>{if(typeof s=="string")try{return JSON.parse(s)}catch(e){return console.log(`JSON parse error: ${e}`),s}return s},ti=(s,e)=>{if(typeof s!="string")return s;const t=s.length-1,r=s[t];if(s[0]==="{"&&r==="}"){let i;const o=s.slice(1,t);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(c=>es(e,c))}return s},ri=s=>typeof s=="string"?s.replace(" ","T"):s,ts=s=>{let e=s;return e=e.replace(/^ws/i,"http"),e=e.replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,""),e.replace(/\/+$/,"")+"/api/broadcast"};class Mt{constructor(e,t,r={},n=lr){this.channel=e,this.event=t,this.payload=r,this.timeout=n,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,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()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,t){var r;return this._hasReceived(e)&&t((r=this.receivedResp)===null||r===void 0?void 0:r.response),this.recHooks.push({status:e,callback:t}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=t=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=t,this._matchReceive(t)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,t){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:t})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:t}){this.recHooks.filter(r=>r.status===e).forEach(r=>r.callback(t))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var on;(function(s){s.SYNC="sync",s.JOIN="join",s.LEAVE="leave"})(on||(on={}));class lt{constructor(e,t){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const r=(t==null?void 0:t.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(r.state,{},n=>{const{onJoin:i,onLeave:o,onSync:c}=this.caller;this.joinRef=this.channel._joinRef(),this.state=lt.syncState(this.state,n,i,o),this.pendingDiffs.forEach(u=>{this.state=lt.syncDiff(this.state,u,i,o)}),this.pendingDiffs=[],c()}),this.channel._on(r.diff,{},n=>{const{onJoin:i,onLeave:o,onSync:c}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(n):(this.state=lt.syncDiff(this.state,n,i,o),c())}),this.onJoin((n,i,o)=>{this.channel._trigger("presence",{event:"join",key:n,currentPresences:i,newPresences:o})}),this.onLeave((n,i,o)=>{this.channel._trigger("presence",{event:"leave",key:n,currentPresences:i,leftPresences:o})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,t,r,n){const i=this.cloneDeep(e),o=this.transformState(t),c={},u={};return this.map(i,(l,h)=>{o[l]||(u[l]=h)}),this.map(o,(l,h)=>{const f=i[l];if(f){const _=h.map(T=>T.presence_ref),y=f.map(T=>T.presence_ref),v=h.filter(T=>y.indexOf(T.presence_ref)<0),O=f.filter(T=>_.indexOf(T.presence_ref)<0);v.length>0&&(c[l]=v),O.length>0&&(u[l]=O)}else c[l]=h}),this.syncDiff(i,{joins:c,leaves:u},r,n)}static syncDiff(e,t,r,n){const{joins:i,leaves:o}={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)};return r||(r=()=>{}),n||(n=()=>{}),this.map(i,(c,u)=>{var l;const h=(l=e[c])!==null&&l!==void 0?l:[];if(e[c]=this.cloneDeep(u),h.length>0){const f=e[c].map(y=>y.presence_ref),_=h.filter(y=>f.indexOf(y.presence_ref)<0);e[c].unshift(..._)}r(c,h,u)}),this.map(o,(c,u)=>{let l=e[c];if(!l)return;const h=u.map(f=>f.presence_ref);l=l.filter(f=>h.indexOf(f.presence_ref)<0),e[c]=l,n(c,l,u),l.length===0&&delete e[c]}),e}static map(e,t){return Object.getOwnPropertyNames(e).map(r=>t(r,e[r]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((t,r)=>{const n=e[r];return"metas"in n?t[r]=n.metas.map(i=>(i.presence_ref=i.phx_ref,delete i.phx_ref,delete i.phx_ref_prev,i)):t[r]=n,t},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var an;(function(s){s.ALL="*",s.INSERT="INSERT",s.UPDATE="UPDATE",s.DELETE="DELETE"})(an||(an={}));var ht;(function(s){s.BROADCAST="broadcast",s.PRESENCE="presence",s.POSTGRES_CHANGES="postgres_changes",s.SYSTEM="system"})(ht||(ht={}));var Ee;(function(s){s.SUBSCRIBED="SUBSCRIBED",s.TIMED_OUT="TIMED_OUT",s.CLOSED="CLOSED",s.CHANNEL_ERROR="CHANNEL_ERROR"})(Ee||(Ee={}));class Sr{constructor(e,t={config:{}},r){this.topic=e,this.params=t,this.socket=r,this.bindings={},this.state=re.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config),this.timeout=this.socket.timeout,this.joinPush=new Mt(this,ye.join,this.params,this.timeout),this.rejoinTimer=new Zn(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=re.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(n=>n.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=re.closed,this.socket._remove(this)}),this._onError(n=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,n),this.state=re.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=re.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",n=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,n),this.state=re.errored,this.rejoinTimer.scheduleTimeout())}),this._on(ye.reply,{},(n,i)=>{this._trigger(this._replyEventName(i),n)}),this.presence=new lt(this),this.broadcastEndpointURL=ts(this.socket.endPoint),this.private=this.params.config.private||!1}subscribe(e,t=this.timeout){var r,n;if(this.socket.isConnected()||this.socket.connect(),this.state==re.closed){const{config:{broadcast:i,presence:o,private:c}}=this.params,u=(n=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(_=>_.filter))!==null&&n!==void 0?n:[],l=!!this.bindings[ht.PRESENCE]&&this.bindings[ht.PRESENCE].length>0,h={},f={broadcast:i,presence:Object.assign(Object.assign({},o),{enabled:l}),postgres_changes:u,private:c};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(_=>e==null?void 0:e(Ee.CHANNEL_ERROR,_)),this._onClose(()=>e==null?void 0:e(Ee.CLOSED)),this.updateJoinPayload(Object.assign({config:f},h)),this.joinedOnce=!0,this._rejoin(t),this.joinPush.receive("ok",async({postgres_changes:_})=>{var y;if(this.socket.setAuth(),_===void 0){e==null||e(Ee.SUBSCRIBED);return}else{const v=this.bindings.postgres_changes,O=(y=v==null?void 0:v.length)!==null&&y!==void 0?y:0,T=[];for(let j=0;j<O;j++){const D=v[j],{filter:{event:A,schema:U,table:d,filter:b}}=D,E=_&&_[j];if(E&&E.event===A&&E.schema===U&&E.table===d&&E.filter===b)T.push(Object.assign(Object.assign({},D),{id:E.id}));else{this.unsubscribe(),this.state=re.errored,e==null||e(Ee.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=T,e&&e(Ee.SUBSCRIBED);return}}).receive("error",_=>{this.state=re.errored,e==null||e(Ee.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(_).join(", ")||"error")))}).receive("timeout",()=>{e==null||e(Ee.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,t={}){return await this.send({type:"presence",event:"track",payload:e},t.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,t,r){return this.state===re.joined&&e===ht.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(()=>this.subscribe())),this._on(e,t,r)}async send(e,t={}){var r,n;if(!this._canPush()&&e.type==="broadcast"){const{event:i,payload:o}=e,u={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:o,private:this.private}]})};try{const l=await this._fetchWithTimeout(this.broadcastEndpointURL,u,(r=t.timeout)!==null&&r!==void 0?r:this.timeout);return await((n=l.body)===null||n===void 0?void 0:n.cancel()),l.ok?"ok":"error"}catch(l){return l.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var o,c,u;const l=this._push(e.type,e,t.timeout||this.timeout);e.type==="broadcast"&&!(!((u=(c=(o=this.params)===null||o===void 0?void 0:o.config)===null||c===void 0?void 0:c.broadcast)===null||u===void 0)&&u.ack)&&i("ok"),l.receive("ok",()=>i("ok")),l.receive("error",()=>i("error")),l.receive("timeout",()=>i("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=re.leaving;const t=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(ye.close,"leave",this._joinRef())};this.joinPush.destroy();let r=null;return new Promise(n=>{r=new Mt(this,ye.leave,{},e),r.receive("ok",()=>{t(),n("ok")}).receive("timeout",()=>{t(),n("timed out")}).receive("error",()=>{n("error")}),r.send(),this._canPush()||r.trigger("ok",{})}).finally(()=>{r==null||r.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=re.closed,this.bindings={}}async _fetchWithTimeout(e,t,r){const n=new AbortController,i=setTimeout(()=>n.abort(),r),o=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:n.signal}));return clearTimeout(i),o}_push(e,t,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let n=new Mt(this,e,t,r);return this._canPush()?n.send():this._addToPushBuffer(n),n}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>Ys){const t=this.pushBuffer.shift();t&&(t.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${t.event}`,t.payload))}}_onMessage(e,t,r){return t}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,t,r){var n,i;const o=e.toLocaleLowerCase(),{close:c,error:u,leave:l,join:h}=ye;if(r&&[c,u,l,h].indexOf(o)>=0&&r!==this._joinRef())return;let _=this._onMessage(o,t,r);if(t&&!_)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(o)?(n=this.bindings.postgres_changes)===null||n===void 0||n.filter(y=>{var v,O,T;return((v=y.filter)===null||v===void 0?void 0:v.event)==="*"||((T=(O=y.filter)===null||O===void 0?void 0:O.event)===null||T===void 0?void 0:T.toLocaleLowerCase())===o}).map(y=>y.callback(_,r)):(i=this.bindings[o])===null||i===void 0||i.filter(y=>{var v,O,T,j,D,A;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in y){const U=y.id,d=(v=y.filter)===null||v===void 0?void 0:v.event;return U&&((O=t.ids)===null||O===void 0?void 0:O.includes(U))&&(d==="*"||(d==null?void 0:d.toLocaleLowerCase())===((T=t.data)===null||T===void 0?void 0:T.type.toLocaleLowerCase()))}else{const U=(D=(j=y==null?void 0:y.filter)===null||j===void 0?void 0:j.event)===null||D===void 0?void 0:D.toLocaleLowerCase();return U==="*"||U===((A=t==null?void 0:t.event)===null||A===void 0?void 0:A.toLocaleLowerCase())}else return y.type.toLocaleLowerCase()===o}).map(y=>{if(typeof _=="object"&&"ids"in _){const v=_.data,{schema:O,table:T,commit_timestamp:j,type:D,errors:A}=v;_=Object.assign(Object.assign({},{schema:O,table:T,commit_timestamp:j,eventType:D,new:{},old:{},errors:A}),this._getPayloadRecords(v))}y.callback(_,r)})}_isClosed(){return this.state===re.closed}_isJoined(){return this.state===re.joined}_isJoining(){return this.state===re.joining}_isLeaving(){return this.state===re.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,t,r){const n=e.toLocaleLowerCase(),i={type:n,filter:t,callback:r};return this.bindings[n]?this.bindings[n].push(i):this.bindings[n]=[i],this}_off(e,t){const r=e.toLocaleLowerCase();return this.bindings[r]&&(this.bindings[r]=this.bindings[r].filter(n=>{var i;return!(((i=n.type)===null||i===void 0?void 0:i.toLocaleLowerCase())===r&&Sr.isEqual(n.filter,t))})),this}static isEqual(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(ye.close,{},e)}_onError(e){this._on(ye.error,{},t=>e(t))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=re.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const t={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(t.new=sn(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(t.old=sn(e.columns,e.old_record)),t}}const un=()=>{},Et={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},ni=[1e3,2e3,5e3,1e4],si=1e4,ii=`
4
+ addEventListener("message", (e) => {
5
+ if (e.data.event === "start") {
6
+ setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
7
+ }
8
+ });`;class oi{constructor(e,t){var r;if(this.accessTokenValue=null,this.apiKey=null,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=lr,this.transport=null,this.heartbeatIntervalMs=Et.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=un,this.ref=0,this.reconnectTimer=null,this.logger=un,this.conn=null,this.sendBuffer=[],this.serializer=new Vs,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=n=>{let i;return n?i=n:typeof fetch>"u"?i=(...o)=>Promise.resolve().then(()=>tt).then(({default:c})=>c(...o)).catch(c=>{throw new Error(`Failed to load @supabase/node-fetch: ${c.message}. This is required for HTTP requests in Node.js environments without native fetch.`)}):i=fetch,(...o)=>i(...o)},!(!((r=t==null?void 0:t.params)===null||r===void 0)&&r.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=t.params.apikey,this.endPoint=`${e}/${hr.websocket}`,this.httpEndpoint=ts(e),this._initializeOptions(t),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(t==null?void 0:t.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=Fs.createWebSocket(this.endpointURL())}catch(e){throw this._setConnectionState("disconnected"),new Error(`WebSocket not available: ${e.message}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:Ks}))}disconnect(e,t){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const r=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(r),this._setConnectionState("disconnected")},e?this.conn.close(e,t??""):this.conn.close(),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const t=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),t}async removeAllChannels(){const e=await Promise.all(this.channels.map(t=>t.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,t,r){this.logger(e,t,r)}connectionState(){switch(this.conn&&this.conn.readyState){case ct.connecting:return Ne.Connecting;case ct.open:return Ne.Open;case ct.closing:return Ne.Closing;default:return Ne.Closed}}isConnected(){return this.connectionState()===Ne.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,t={config:{}}){const r=`realtime:${e}`,n=this.getChannels().find(i=>i.topic===r);if(n)return n;{const i=new Sr(`realtime:${e}`,t,this);return this.channels.push(i),i}}push(e){const{topic:t,event:r,payload:n,ref:i}=e,o=()=>{this.encode(e,c=>{var u;(u=this.conn)===null||u===void 0||u.send(c)})};this.log("push",`${t} ${r} (${i})`,n),this.isConnected()?o():this.sendBuffer.push(o)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}async sendHeartbeat(){var e;if(!this.isConnected()){this.heartbeatCallback("disconnected");return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.heartbeatCallback("timeout"),this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(Js,"heartbeat timeout"),setTimeout(()=>{var t;this.isConnected()||(t=this.reconnectTimer)===null||t===void 0||t.scheduleTimeout()},Et.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatCallback("sent"),this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let t=this.channels.find(r=>r.topic===e&&(r._isJoined()||r._isJoining()));t&&(this.log("transport",`leaving duplicate topic "${e}"`),t.unsubscribe())}_remove(e){this.channels=this.channels.filter(t=>t.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,t=>{t.topic==="phoenix"&&t.event==="phx_reply"&&this.heartbeatCallback(t.payload.status==="ok"?"ok":"error"),t.ref&&t.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:r,event:n,payload:i,ref:o}=t,c=o?`(${o})`:"",u=i.status||"";this.log("receive",`${u} ${r} ${n} ${c}`.trim(),i),this.channels.filter(l=>l._isMember(r)).forEach(l=>l._trigger(n,i,o)),this._triggerStateCallbacks("message",t)})}_clearTimer(e){var t;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((t=this.reconnectTimer)===null||t===void 0||t.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),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))}_teardownConnection(){this.conn&&(this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null),this._clearAllTimers(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),this.flushSendBuffer(),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_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=t=>{this.log("worker","worker error",t.message),this.workerRef.terminate()},this.workerRef.onmessage=t=>{t.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(e){var t;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(t=this.reconnectTimer)===null||t===void 0||t.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(ye.error))}_appendParams(e,t){if(Object.keys(t).length===0)return e;const r=e.match(/\?/)?"&":"?",n=new URLSearchParams(t);return`${e}${r}${n}`}_workerObjectUrl(e){let t;if(e)t=e;else{const r=new Blob([ii],{type:"application/javascript"});t=URL.createObjectURL(r)}return t}_setConnectionState(e,t=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=t)}async _performAuth(e=null){let t;e?t=e:this.accessToken?t=await this.accessToken():t=this.accessTokenValue,this.accessTokenValue!=t&&(this.accessTokenValue=t,this.channels.forEach(r=>{const n={access_token:t,version:zs};t&&r.updateJoinPayload(n),r.joinedOnce&&r._isJoined()&&r._push(ye.access_token,{access_token:t})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this.setAuth().catch(t=>{this.log("error",`error setting auth in ${e}`,t)})}_triggerStateCallbacks(e,t){try{this.stateChangeCallbacks[e].forEach(r=>{try{r(t)}catch(n){this.log("error",`error in ${e} callback`,n)}})}catch(r){this.log("error",`error triggering ${e} callbacks`,r)}}_setupReconnectionTimer(){this.reconnectTimer=new Zn(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},Et.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var t,r,n,i,o,c,u,l;if(this.transport=(t=e==null?void 0:e.transport)!==null&&t!==void 0?t:null,this.timeout=(r=e==null?void 0:e.timeout)!==null&&r!==void 0?r:lr,this.heartbeatIntervalMs=(n=e==null?void 0:e.heartbeatIntervalMs)!==null&&n!==void 0?n:Et.HEARTBEAT_INTERVAL,this.worker=(i=e==null?void 0:e.worker)!==null&&i!==void 0?i:!1,this.accessToken=(o=e==null?void 0:e.accessToken)!==null&&o!==void 0?o:null,e!=null&&e.params&&(this.params=e.params),e!=null&&e.logger&&(this.logger=e.logger),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(c=e==null?void 0:e.reconnectAfterMs)!==null&&c!==void 0?c:h=>ni[h-1]||si,this.encode=(u=e==null?void 0:e.encode)!==null&&u!==void 0?u:(h,f)=>f(JSON.stringify(h)),this.decode=(l=e==null?void 0:e.decode)!==null&&l!==void 0?l:this.serializer.decode.bind(this.serializer),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl}}}class kr extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function se(s){return typeof s=="object"&&s!==null&&"__isStorageError"in s}class ai extends kr{constructor(e,t,r){super(e),this.name="StorageApiError",this.status=t,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class fr extends kr{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}}var ui=function(s,e,t,r){function n(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function c(h){try{l(r.next(h))}catch(f){o(f)}}function u(h){try{l(r.throw(h))}catch(f){o(f)}}function l(h){h.done?i(h.value):n(h.value).then(c,u)}l((r=r.apply(s,e||[])).next())})};const rs=s=>{let e;return s?e=s:typeof fetch>"u"?e=(...t)=>Promise.resolve().then(()=>tt).then(({default:r})=>r(...t)):e=fetch,(...t)=>e(...t)},ci=()=>ui(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield Promise.resolve().then(()=>tt)).Response:Response}),pr=s=>{if(Array.isArray(s))return s.map(t=>pr(t));if(typeof s=="function"||s!==Object(s))return s;const e={};return Object.entries(s).forEach(([t,r])=>{const n=t.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[n]=pr(r)}),e},li=s=>{if(typeof s!="object"||s===null)return!1;const e=Object.getPrototypeOf(s);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in s)&&!(Symbol.iterator in s)};var Le=function(s,e,t,r){function n(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function c(h){try{l(r.next(h))}catch(f){o(f)}}function u(h){try{l(r.throw(h))}catch(f){o(f)}}function l(h){h.done?i(h.value):n(h.value).then(c,u)}l((r=r.apply(s,e||[])).next())})};const Bt=s=>s.msg||s.message||s.error_description||s.error||JSON.stringify(s),hi=(s,e,t)=>Le(void 0,void 0,void 0,function*(){const r=yield ci();s instanceof r&&!(t!=null&&t.noResolveJson)?s.json().then(n=>{const i=s.status||500,o=(n==null?void 0:n.statusCode)||i+"";e(new ai(Bt(n),i,o))}).catch(n=>{e(new fr(Bt(n),n))}):e(new fr(Bt(s),s))}),di=(s,e,t,r)=>{const n={method:s,headers:(e==null?void 0:e.headers)||{}};return s==="GET"||!r?n:(li(r)?(n.headers=Object.assign({"Content-Type":"application/json"},e==null?void 0:e.headers),n.body=JSON.stringify(r)):n.body=r,Object.assign(Object.assign({},n),t))};function ft(s,e,t,r,n,i){return Le(this,void 0,void 0,function*(){return new Promise((o,c)=>{s(t,di(e,r,n,i)).then(u=>{if(!u.ok)throw u;return r!=null&&r.noResolveJson?u:u.json()}).then(u=>o(u)).catch(u=>hi(u,c,r))})})}function Ct(s,e,t,r){return Le(this,void 0,void 0,function*(){return ft(s,"GET",e,t,r)})}function Se(s,e,t,r,n){return Le(this,void 0,void 0,function*(){return ft(s,"POST",e,r,n,t)})}function gr(s,e,t,r,n){return Le(this,void 0,void 0,function*(){return ft(s,"PUT",e,r,n,t)})}function fi(s,e,t,r){return Le(this,void 0,void 0,function*(){return ft(s,"HEAD",e,Object.assign(Object.assign({},t),{noResolveJson:!0}),r)})}function ns(s,e,t,r,n){return Le(this,void 0,void 0,function*(){return ft(s,"DELETE",e,r,n,t)})}var le=function(s,e,t,r){function n(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function c(h){try{l(r.next(h))}catch(f){o(f)}}function u(h){try{l(r.throw(h))}catch(f){o(f)}}function l(h){h.done?i(h.value):n(h.value).then(c,u)}l((r=r.apply(s,e||[])).next())})};const pi={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},cn={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class gi{constructor(e,t={},r,n){this.url=e,this.headers=t,this.bucketId=r,this.fetch=rs(n)}uploadOrUpdate(e,t,r,n){return le(this,void 0,void 0,function*(){try{let i;const o=Object.assign(Object.assign({},cn),n);let c=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(o.upsert)});const u=o.metadata;typeof Blob<"u"&&r instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),u&&i.append("metadata",this.encodeMetadata(u)),i.append("",r)):typeof FormData<"u"&&r instanceof FormData?(i=r,i.append("cacheControl",o.cacheControl),u&&i.append("metadata",this.encodeMetadata(u))):(i=r,c["cache-control"]=`max-age=${o.cacheControl}`,c["content-type"]=o.contentType,u&&(c["x-metadata"]=this.toBase64(this.encodeMetadata(u)))),n!=null&&n.headers&&(c=Object.assign(Object.assign({},c),n.headers));const l=this._removeEmptyFolders(t),h=this._getFinalPath(l),f=yield(e=="PUT"?gr:Se)(this.fetch,`${this.url}/object/${h}`,i,Object.assign({headers:c},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{data:{path:l,id:f.Id,fullPath:f.Key},error:null}}catch(i){if(se(i))return{data:null,error:i};throw i}})}upload(e,t,r){return le(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,t,r)})}uploadToSignedUrl(e,t,r,n){return le(this,void 0,void 0,function*(){const i=this._removeEmptyFolders(e),o=this._getFinalPath(i),c=new URL(this.url+`/object/upload/sign/${o}`);c.searchParams.set("token",t);try{let u;const l=Object.assign({upsert:cn.upsert},n),h=Object.assign(Object.assign({},this.headers),{"x-upsert":String(l.upsert)});typeof Blob<"u"&&r instanceof Blob?(u=new FormData,u.append("cacheControl",l.cacheControl),u.append("",r)):typeof FormData<"u"&&r instanceof FormData?(u=r,u.append("cacheControl",l.cacheControl)):(u=r,h["cache-control"]=`max-age=${l.cacheControl}`,h["content-type"]=l.contentType);const f=yield gr(this.fetch,c.toString(),u,{headers:h});return{data:{path:i,fullPath:f.Key},error:null}}catch(u){if(se(u))return{data:null,error:u};throw u}})}createSignedUploadUrl(e,t){return le(this,void 0,void 0,function*(){try{let r=this._getFinalPath(e);const n=Object.assign({},this.headers);t!=null&&t.upsert&&(n["x-upsert"]="true");const i=yield Se(this.fetch,`${this.url}/object/upload/sign/${r}`,{},{headers:n}),o=new URL(this.url+i.url),c=o.searchParams.get("token");if(!c)throw new kr("No token returned by API");return{data:{signedUrl:o.toString(),path:e,token:c},error:null}}catch(r){if(se(r))return{data:null,error:r};throw r}})}update(e,t,r){return le(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,t,r)})}move(e,t,r){return le(this,void 0,void 0,function*(){try{return{data:yield Se(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:r==null?void 0:r.destinationBucket},{headers:this.headers}),error:null}}catch(n){if(se(n))return{data:null,error:n};throw n}})}copy(e,t,r){return le(this,void 0,void 0,function*(){try{return{data:{path:(yield Se(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:r==null?void 0:r.destinationBucket},{headers:this.headers})).Key},error:null}}catch(n){if(se(n))return{data:null,error:n};throw n}})}createSignedUrl(e,t,r){return le(this,void 0,void 0,function*(){try{let n=this._getFinalPath(e),i=yield Se(this.fetch,`${this.url}/object/sign/${n}`,Object.assign({expiresIn:t},r!=null&&r.transform?{transform:r.transform}:{}),{headers:this.headers});const o=r!=null&&r.download?`&download=${r.download===!0?"":r.download}`:"";return i={signedUrl:encodeURI(`${this.url}${i.signedURL}${o}`)},{data:i,error:null}}catch(n){if(se(n))return{data:null,error:n};throw n}})}createSignedUrls(e,t,r){return le(this,void 0,void 0,function*(){try{const n=yield Se(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:t,paths:e},{headers:this.headers}),i=r!=null&&r.download?`&download=${r.download===!0?"":r.download}`:"";return{data:n.map(o=>Object.assign(Object.assign({},o),{signedUrl:o.signedURL?encodeURI(`${this.url}${o.signedURL}${i}`):null})),error:null}}catch(n){if(se(n))return{data:null,error:n};throw n}})}download(e,t){return le(this,void 0,void 0,function*(){const n=typeof(t==null?void 0:t.transform)<"u"?"render/image/authenticated":"object",i=this.transformOptsToQueryString((t==null?void 0:t.transform)||{}),o=i?`?${i}`:"";try{const c=this._getFinalPath(e);return{data:yield(yield Ct(this.fetch,`${this.url}/${n}/${c}${o}`,{headers:this.headers,noResolveJson:!0})).blob(),error:null}}catch(c){if(se(c))return{data:null,error:c};throw c}})}info(e){return le(this,void 0,void 0,function*(){const t=this._getFinalPath(e);try{const r=yield Ct(this.fetch,`${this.url}/object/info/${t}`,{headers:this.headers});return{data:pr(r),error:null}}catch(r){if(se(r))return{data:null,error:r};throw r}})}exists(e){return le(this,void 0,void 0,function*(){const t=this._getFinalPath(e);try{return yield fi(this.fetch,`${this.url}/object/${t}`,{headers:this.headers}),{data:!0,error:null}}catch(r){if(se(r)&&r instanceof fr){const n=r.originalError;if([400,404].includes(n==null?void 0:n.status))return{data:!1,error:r}}throw r}})}getPublicUrl(e,t){const r=this._getFinalPath(e),n=[],i=t!=null&&t.download?`download=${t.download===!0?"":t.download}`:"";i!==""&&n.push(i);const c=typeof(t==null?void 0:t.transform)<"u"?"render/image":"object",u=this.transformOptsToQueryString((t==null?void 0:t.transform)||{});u!==""&&n.push(u);let l=n.join("&");return l!==""&&(l=`?${l}`),{data:{publicUrl:encodeURI(`${this.url}/${c}/public/${r}${l}`)}}}remove(e){return le(this,void 0,void 0,function*(){try{return{data:yield ns(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(t){if(se(t))return{data:null,error:t};throw t}})}list(e,t,r){return le(this,void 0,void 0,function*(){try{const n=Object.assign(Object.assign(Object.assign({},pi),t),{prefix:e||""});return{data:yield Se(this.fetch,`${this.url}/object/list/${this.bucketId}`,n,{headers:this.headers},r),error:null}}catch(n){if(se(n))return{data:null,error:n};throw n}})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}}const _i="2.10.4",yi={"X-Client-Info":`storage-js/${_i}`};var ze=function(s,e,t,r){function n(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function c(h){try{l(r.next(h))}catch(f){o(f)}}function u(h){try{l(r.throw(h))}catch(f){o(f)}}function l(h){h.done?i(h.value):n(h.value).then(c,u)}l((r=r.apply(s,e||[])).next())})};class vi{constructor(e,t={},r,n){const i=new URL(e);n!=null&&n.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase.")),this.url=i.href,this.headers=Object.assign(Object.assign({},yi),t),this.fetch=rs(r)}listBuckets(){return ze(this,void 0,void 0,function*(){try{return{data:yield Ct(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(e){if(se(e))return{data:null,error:e};throw e}})}getBucket(e){return ze(this,void 0,void 0,function*(){try{return{data:yield Ct(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(t){if(se(t))return{data:null,error:t};throw t}})}createBucket(e,t={public:!1}){return ze(this,void 0,void 0,function*(){try{return{data:yield Se(this.fetch,`${this.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(r){if(se(r))return{data:null,error:r};throw r}})}updateBucket(e,t){return ze(this,void 0,void 0,function*(){try{return{data:yield gr(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(r){if(se(r))return{data:null,error:r};throw r}})}emptyBucket(e){return ze(this,void 0,void 0,function*(){try{return{data:yield Se(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(t){if(se(t))return{data:null,error:t};throw t}})}deleteBucket(e){return ze(this,void 0,void 0,function*(){try{return{data:yield ns(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(t){if(se(t))return{data:null,error:t};throw t}})}}class mi extends vi{constructor(e,t={},r,n){super(e,t,r,n)}from(e){return new gi(this.url,this.headers,e,this.fetch)}}const wi="2.54.0";let at="";typeof Deno<"u"?at="deno":typeof document<"u"?at="web":typeof navigator<"u"&&navigator.product==="ReactNative"?at="react-native":at="node";const bi={"X-Client-Info":`supabase-js-${at}/${wi}`},Ei={headers:bi},Si={schema:"public"},ki={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Ri={};var Ti=function(s,e,t,r){function n(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function c(h){try{l(r.next(h))}catch(f){o(f)}}function u(h){try{l(r.throw(h))}catch(f){o(f)}}function l(h){h.done?i(h.value):n(h.value).then(c,u)}l((r=r.apply(s,e||[])).next())})};const Ai=s=>{let e;return s?e=s:typeof fetch>"u"?e=Kn:e=fetch,(...t)=>e(...t)},Oi=()=>typeof Headers>"u"?Jn:Headers,ji=(s,e,t)=>{const r=Ai(t),n=Oi();return(i,o)=>Ti(void 0,void 0,void 0,function*(){var c;const u=(c=yield e())!==null&&c!==void 0?c:s;let l=new n(o==null?void 0:o.headers);return l.has("apikey")||l.set("apikey",s),l.has("Authorization")||l.set("Authorization",`Bearer ${u}`),r(i,Object.assign(Object.assign({},o),{headers:l}))})};var Ci=function(s,e,t,r){function n(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function c(h){try{l(r.next(h))}catch(f){o(f)}}function u(h){try{l(r.throw(h))}catch(f){o(f)}}function l(h){h.done?i(h.value):n(h.value).then(c,u)}l((r=r.apply(s,e||[])).next())})};function Pi(s){return s.endsWith("/")?s:s+"/"}function $i(s,e){var t,r;const{db:n,auth:i,realtime:o,global:c}=s,{db:u,auth:l,realtime:h,global:f}=e,_={db:Object.assign(Object.assign({},u),n),auth:Object.assign(Object.assign({},l),i),realtime:Object.assign(Object.assign({},h),o),storage:{},global:Object.assign(Object.assign(Object.assign({},f),c),{headers:Object.assign(Object.assign({},(t=f==null?void 0:f.headers)!==null&&t!==void 0?t:{}),(r=c==null?void 0:c.headers)!==null&&r!==void 0?r:{})}),accessToken:()=>Ci(this,void 0,void 0,function*(){return""})};return s.accessToken?_.accessToken=s.accessToken:delete _.accessToken,_}const ss="2.71.1",Xe=30*1e3,_r=3,Ht=_r*Xe,xi="http://localhost:9999",Ii="supabase.auth.token",Di={"X-Client-Info":`gotrue-js/${ss}`},yr="X-Supabase-Api-Version",is={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},Ni=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Ui=10*60*1e3;class Rr extends Error{constructor(e,t,r){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t,this.code=r}}function B(s){return typeof s=="object"&&s!==null&&"__isAuthError"in s}class Li extends Rr{constructor(e,t,r){super(e,t,r),this.name="AuthApiError",this.status=t,this.code=r}}function qi(s){return B(s)&&s.name==="AuthApiError"}class os extends Rr{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}}class Oe extends Rr{constructor(e,t,r,n){super(e,r,n),this.name=t,this.status=r}}class Te extends Oe{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Mi(s){return B(s)&&s.name==="AuthSessionMissingError"}class St extends Oe{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class kt extends Oe{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class Rt extends Oe{constructor(e,t=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function Bi(s){return B(s)&&s.name==="AuthImplicitGrantRedirectError"}class ln extends Oe{constructor(e,t=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class vr extends Oe{constructor(e,t){super(e,"AuthRetryableFetchError",t,void 0)}}function Wt(s){return B(s)&&s.name==="AuthRetryableFetchError"}class hn extends Oe{constructor(e,t,r){super(e,"AuthWeakPasswordError",t,"weak_password"),this.reasons=r}}class mr extends Oe{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Pt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),dn=`
9
+ \r=`.split(""),Hi=(()=>{const s=new Array(128);for(let e=0;e<s.length;e+=1)s[e]=-1;for(let e=0;e<dn.length;e+=1)s[dn[e].charCodeAt(0)]=-2;for(let e=0;e<Pt.length;e+=1)s[Pt[e].charCodeAt(0)]=e;return s})();function fn(s,e,t){if(s!==null)for(e.queue=e.queue<<8|s,e.queuedBits+=8;e.queuedBits>=6;){const r=e.queue>>e.queuedBits-6&63;t(Pt[r]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const r=e.queue>>e.queuedBits-6&63;t(Pt[r]),e.queuedBits-=6}}function as(s,e,t){const r=Hi[s];if(r>-1)for(e.queue=e.queue<<6|r,e.queuedBits+=6;e.queuedBits>=8;)t(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(r===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(s)}"`)}}function pn(s){const e=[],t=o=>{e.push(String.fromCodePoint(o))},r={utf8seq:0,codepoint:0},n={queue:0,queuedBits:0},i=o=>{Gi(o,r,t)};for(let o=0;o<s.length;o+=1)as(s.charCodeAt(o),n,i);return e.join("")}function Wi(s,e){if(s<=127){e(s);return}else if(s<=2047){e(192|s>>6),e(128|s&63);return}else if(s<=65535){e(224|s>>12),e(128|s>>6&63),e(128|s&63);return}else if(s<=1114111){e(240|s>>18),e(128|s>>12&63),e(128|s>>6&63),e(128|s&63);return}throw new Error(`Unrecognized Unicode codepoint: ${s.toString(16)}`)}function Fi(s,e){for(let t=0;t<s.length;t+=1){let r=s.charCodeAt(t);if(r>55295&&r<=56319){const n=(r-55296)*1024&65535;r=(s.charCodeAt(t+1)-56320&65535|n)+65536,t+=1}Wi(r,e)}}function Gi(s,e,t){if(e.utf8seq===0){if(s<=127){t(s);return}for(let r=1;r<6;r+=1)if((s>>7-r&1)===0){e.utf8seq=r;break}if(e.utf8seq===2)e.codepoint=s&31;else if(e.utf8seq===3)e.codepoint=s&15;else if(e.utf8seq===4)e.codepoint=s&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(s<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|s&63,e.utf8seq-=1,e.utf8seq===0&&t(e.codepoint)}}function zi(s){const e=[],t={queue:0,queuedBits:0},r=n=>{e.push(n)};for(let n=0;n<s.length;n+=1)as(s.charCodeAt(n),t,r);return new Uint8Array(e)}function Ki(s){const e=[];return Fi(s,t=>e.push(t)),new Uint8Array(e)}function Ji(s){const e=[],t={queue:0,queuedBits:0},r=n=>{e.push(n)};return s.forEach(n=>fn(n,t,r)),fn(null,t,r),e.join("")}function Yi(s){return Math.round(Date.now()/1e3)+s}function Vi(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(s){const e=Math.random()*16|0;return(s=="x"?e:e&3|8).toString(16)})}const _e=()=>typeof window<"u"&&typeof document<"u",xe={tested:!1,writable:!1},us=()=>{if(!_e())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(xe.tested)return xe.writable;const s=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(s,s),globalThis.localStorage.removeItem(s),xe.tested=!0,xe.writable=!0}catch{xe.tested=!0,xe.writable=!1}return xe.writable};function Xi(s){const e={},t=new URL(s);if(t.hash&&t.hash[0]==="#")try{new URLSearchParams(t.hash.substring(1)).forEach((n,i)=>{e[i]=n})}catch{}return t.searchParams.forEach((r,n)=>{e[n]=r}),e}const cs=s=>{let e;return s?e=s:typeof fetch>"u"?e=(...t)=>Promise.resolve().then(()=>tt).then(({default:r})=>r(...t)):e=fetch,(...t)=>e(...t)},Qi=s=>typeof s=="object"&&s!==null&&"status"in s&&"ok"in s&&"json"in s&&typeof s.json=="function",Qe=async(s,e,t)=>{await s.setItem(e,JSON.stringify(t))},Ie=async(s,e)=>{const t=await s.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch{return t}},Re=async(s,e)=>{await s.removeItem(e)};class It{constructor(){this.promise=new It.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}It.promiseConstructor=Promise;function Ft(s){const e=s.split(".");if(e.length!==3)throw new mr("Invalid JWT structure");for(let r=0;r<e.length;r++)if(!Ni.test(e[r]))throw new mr("JWT not in base64url format");return{header:JSON.parse(pn(e[0])),payload:JSON.parse(pn(e[1])),signature:zi(e[2]),raw:{header:e[0],payload:e[1]}}}async function Zi(s){return await new Promise(e=>{setTimeout(()=>e(null),s)})}function eo(s,e){return new Promise((r,n)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await s(i);if(!e(i,null,o)){r(o);return}}catch(o){if(!e(i,o)){n(o);return}}})()})}function to(s){return("0"+s.toString(16)).substr(-2)}function ro(){const e=new Uint32Array(56);if(typeof crypto>"u"){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=t.length;let n="";for(let i=0;i<56;i++)n+=t.charAt(Math.floor(Math.random()*r));return n}return crypto.getRandomValues(e),Array.from(e,to).join("")}async function no(s){const t=new TextEncoder().encode(s),r=await crypto.subtle.digest("SHA-256",t),n=new Uint8Array(r);return Array.from(n).map(i=>String.fromCharCode(i)).join("")}async function so(s){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."),s;const t=await no(s);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Ke(s,e,t=!1){const r=ro();let n=r;t&&(n+="/PASSWORD_RECOVERY"),await Qe(s,`${e}-code-verifier`,n);const i=await so(r);return[i,r===i?"plain":"s256"]}const io=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function oo(s){const e=s.headers.get(yr);if(!e||!e.match(io))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function ao(s){if(!s)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(s<=e)throw new Error("JWT has expired")}function uo(s){switch(s){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 co=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Je(s){if(!co.test(s))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Gt(){const s={};return new Proxy(s,{get:(e,t)=>{if(t==="__isUserNotAvailableProxy")return!0;if(typeof t=="symbol"){const r=t.toString();if(r==="Symbol(Symbol.toPrimitive)"||r==="Symbol(Symbol.toStringTag)"||r==="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 "${t}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function gn(s){return JSON.parse(JSON.stringify(s))}var lo=function(s,e){var t={};for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&e.indexOf(r)<0&&(t[r]=s[r]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(s);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(s,r[n])&&(t[r[n]]=s[r[n]]);return t};const De=s=>s.msg||s.message||s.error_description||s.error||JSON.stringify(s),ho=[502,503,504];async function _n(s){var e;if(!Qi(s))throw new vr(De(s),0);if(ho.includes(s.status))throw new vr(De(s),s.status);let t;try{t=await s.json()}catch(i){throw new os(De(i),i)}let r;const n=oo(s);if(n&&n.getTime()>=is["2024-01-01"].timestamp&&typeof t=="object"&&t&&typeof t.code=="string"?r=t.code:typeof t=="object"&&t&&typeof t.error_code=="string"&&(r=t.error_code),r){if(r==="weak_password")throw new hn(De(t),s.status,((e=t.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(r==="session_not_found")throw new Te}else if(typeof t=="object"&&t&&typeof t.weak_password=="object"&&t.weak_password&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.reasons.reduce((i,o)=>i&&typeof o=="string",!0))throw new hn(De(t),s.status,t.weak_password.reasons);throw new Li(De(t),s.status||500,r)}const fo=(s,e,t,r)=>{const n={method:s,headers:(e==null?void 0:e.headers)||{}};return s==="GET"?n:(n.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),n.body=JSON.stringify(r),Object.assign(Object.assign({},n),t))};async function G(s,e,t,r){var n;const i=Object.assign({},r==null?void 0:r.headers);i[yr]||(i[yr]=is["2024-01-01"].name),r!=null&&r.jwt&&(i.Authorization=`Bearer ${r.jwt}`);const o=(n=r==null?void 0:r.query)!==null&&n!==void 0?n:{};r!=null&&r.redirectTo&&(o.redirect_to=r.redirectTo);const c=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",u=await po(s,e,t+c,{headers:i,noResolveJson:r==null?void 0:r.noResolveJson},{},r==null?void 0:r.body);return r!=null&&r.xform?r==null?void 0:r.xform(u):{data:Object.assign({},u),error:null}}async function po(s,e,t,r,n,i){const o=fo(e,r,n,i);let c;try{c=await s(t,Object.assign({},o))}catch(u){throw console.error(u),new vr(De(u),0)}if(c.ok||await _n(c),r!=null&&r.noResolveJson)return c;try{return await c.json()}catch(u){await _n(u)}}function be(s){var e;let t=null;vo(s)&&(t=Object.assign({},s),s.expires_at||(t.expires_at=Yi(s.expires_in)));const r=(e=s.user)!==null&&e!==void 0?e:s;return{data:{session:t,user:r},error:null}}function yn(s){const e=be(s);return!e.error&&s.weak_password&&typeof s.weak_password=="object"&&Array.isArray(s.weak_password.reasons)&&s.weak_password.reasons.length&&s.weak_password.message&&typeof s.weak_password.message=="string"&&s.weak_password.reasons.reduce((t,r)=>t&&typeof r=="string",!0)&&(e.data.weak_password=s.weak_password),e}function Ae(s){var e;return{data:{user:(e=s.user)!==null&&e!==void 0?e:s},error:null}}function go(s){return{data:s,error:null}}function _o(s){const{action_link:e,email_otp:t,hashed_token:r,redirect_to:n,verification_type:i}=s,o=lo(s,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),c={action_link:e,email_otp:t,hashed_token:r,redirect_to:n,verification_type:i},u=Object.assign({},o);return{data:{properties:c,user:u},error:null}}function yo(s){return s}function vo(s){return s.access_token&&s.refresh_token&&s.expires_in}const zt=["global","local","others"];var mo=function(s,e){var t={};for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&e.indexOf(r)<0&&(t[r]=s[r]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(s);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(s,r[n])&&(t[r[n]]=s[r[n]]);return t};class wo{constructor({url:e="",headers:t={},fetch:r}){this.url=e,this.headers=t,this.fetch=cs(r),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)}}async signOut(e,t=zt[0]){if(zt.indexOf(t)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${zt.join(", ")}`);try{return await G(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(r){if(B(r))return{data:null,error:r};throw r}}async inviteUserByEmail(e,t={}){try{return await G(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:Ae})}catch(r){if(B(r))return{data:{user:null},error:r};throw r}}async generateLink(e){try{const{options:t}=e,r=mo(e,["options"]),n=Object.assign(Object.assign({},r),t);return"newEmail"in r&&(n.new_email=r==null?void 0:r.newEmail,delete n.newEmail),await G(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:n,headers:this.headers,xform:_o,redirectTo:t==null?void 0:t.redirectTo})}catch(t){if(B(t))return{data:{properties:null,user:null},error:t};throw t}}async createUser(e){try{return await G(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:Ae})}catch(t){if(B(t))return{data:{user:null},error:t};throw t}}async listUsers(e){var t,r,n,i,o,c,u;try{const l={nextPage:null,lastPage:0,total:0},h=await G(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(t=e==null?void 0:e.page)===null||t===void 0?void 0:t.toString())!==null&&r!==void 0?r:"",per_page:(i=(n=e==null?void 0:e.perPage)===null||n===void 0?void 0:n.toString())!==null&&i!==void 0?i:""},xform:yo});if(h.error)throw h.error;const f=await h.json(),_=(o=h.headers.get("x-total-count"))!==null&&o!==void 0?o:0,y=(u=(c=h.headers.get("link"))===null||c===void 0?void 0:c.split(","))!==null&&u!==void 0?u:[];return y.length>0&&(y.forEach(v=>{const O=parseInt(v.split(";")[0].split("=")[1].substring(0,1)),T=JSON.parse(v.split(";")[1].split("=")[1]);l[`${T}Page`]=O}),l.total=parseInt(_)),{data:Object.assign(Object.assign({},f),l),error:null}}catch(l){if(B(l))return{data:{users:[]},error:l};throw l}}async getUserById(e){Je(e);try{return await G(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Ae})}catch(t){if(B(t))return{data:{user:null},error:t};throw t}}async updateUserById(e,t){Je(e);try{return await G(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:Ae})}catch(r){if(B(r))return{data:{user:null},error:r};throw r}}async deleteUser(e,t=!1){Je(e);try{return await G(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:Ae})}catch(r){if(B(r))return{data:{user:null},error:r};throw r}}async _listFactors(e){Je(e.userId);try{const{data:t,error:r}=await G(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:n=>({data:{factors:n},error:null})});return{data:t,error:r}}catch(t){if(B(t))return{data:null,error:t};throw t}}async _deleteFactor(e){Je(e.userId),Je(e.id);try{return{data:await G(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(t){if(B(t))return{data:null,error:t};throw t}}}function vn(s={}){return{getItem:e=>s[e]||null,setItem:(e,t)=>{s[e]=t},removeItem:e=>{delete s[e]}}}function bo(){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)}}const Ye={debug:!!(globalThis&&us()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class ls extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class Eo extends ls{}async function So(s,e,t){Ye.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",s,e);const r=new globalThis.AbortController;return e>0&&setTimeout(()=>{r.abort(),Ye.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",s)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(s,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},async n=>{if(n){Ye.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",s,n.name);try{return await t()}finally{Ye.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",s,n.name)}}else{if(e===0)throw Ye.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",s),new Eo(`Acquiring an exclusive Navigator LockManager lock "${s}" immediately failed`);if(Ye.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"),await t()}}))}bo();const ko={url:xi,storageKey:Ii,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Di,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function mn(s,e,t){return await t()}const Ve={};class dt{constructor(e){var t,r;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=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,this.instanceID=dt.nextInstanceID,dt.nextInstanceID+=1,this.instanceID>0&&_e()&&console.warn("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.");const n=Object.assign(Object.assign({},ko),e);if(this.logDebugMessages=!!n.debug,typeof n.debug=="function"&&(this.logger=n.debug),this.persistSession=n.persistSession,this.storageKey=n.storageKey,this.autoRefreshToken=n.autoRefreshToken,this.admin=new wo({url:n.url,headers:n.headers,fetch:n.fetch}),this.url=n.url,this.headers=n.headers,this.fetch=cs(n.fetch),this.lock=n.lock||mn,this.detectSessionInUrl=n.detectSessionInUrl,this.flowType=n.flowType,this.hasCustomAuthorizationHeader=n.hasCustomAuthorizationHeader,n.lock?this.lock=n.lock:_e()&&(!((t=globalThis==null?void 0:globalThis.navigator)===null||t===void 0)&&t.locks)?this.lock=So:this.lock=mn,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)},this.persistSession?(n.storage?this.storage=n.storage:us()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=vn(this.memoryStorage)),n.userStorage&&(this.userStorage=n.userStorage)):(this.memoryStorage={},this.storage=vn(this.memoryStorage)),_e()&&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)}(r=this.broadcastChannel)===null||r===void 0||r.addEventListener("message",async i=>{this._debug("received broadcast notification from other tab or client",i),await this._notifyAllSubscribers(i.data.event,i.data.session,!1)})}this.initialize()}get jwks(){var e,t;return(t=(e=Ve[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&t!==void 0?t:{keys:[]}}set jwks(e){Ve[this.storageKey]=Object.assign(Object.assign({},Ve[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,t;return(t=(e=Ve[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&t!==void 0?t:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Ve[this.storageKey]=Object.assign(Object.assign({},Ve[this.storageKey]),{cachedAt:e})}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${ss}) ${new Date().toISOString()}`,...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{const t=Xi(window.location.href);let r="none";if(this._isImplicitGrantCallback(t)?r="implicit":await this._isPKCECallback(t)&&(r="pkce"),_e()&&this.detectSessionInUrl&&r!=="none"){const{data:n,error:i}=await this._getSessionFromURL(t,r);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),Bi(i)){const u=(e=i.details)===null||e===void 0?void 0:e.code;if(u==="identity_already_exists"||u==="identity_not_found"||u==="single_identity_not_deletable")return{error:i}}return await this._removeSession(),{error:i}}const{session:o,redirectType:c}=n;return this._debug("#_initialize()","detected session in URL",o,"redirect type",c),await this._saveSession(o),setTimeout(async()=>{c==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(t){return B(t)?{error:t}:{error:new os("Unexpected error during initialization",t)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var t,r,n;try{const i=await G(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(r=(t=e==null?void 0:e.options)===null||t===void 0?void 0:t.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.captchaToken}},xform:be}),{data:o,error:c}=i;if(c||!o)return{data:{user:null,session:null},error:c};const u=o.session,l=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",u)),{data:{user:l,session:u},error:null}}catch(i){if(B(i))return{data:{user:null,session:null},error:i};throw i}}async signUp(e){var t,r,n;try{let i;if("email"in e){const{email:h,password:f,options:_}=e;let y=null,v=null;this.flowType==="pkce"&&([y,v]=await Ke(this.storage,this.storageKey)),i=await G(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:_==null?void 0:_.emailRedirectTo,body:{email:h,password:f,data:(t=_==null?void 0:_.data)!==null&&t!==void 0?t:{},gotrue_meta_security:{captcha_token:_==null?void 0:_.captchaToken},code_challenge:y,code_challenge_method:v},xform:be})}else if("phone"in e){const{phone:h,password:f,options:_}=e;i=await G(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:h,password:f,data:(r=_==null?void 0:_.data)!==null&&r!==void 0?r:{},channel:(n=_==null?void 0:_.channel)!==null&&n!==void 0?n:"sms",gotrue_meta_security:{captcha_token:_==null?void 0:_.captchaToken}},xform:be})}else throw new kt("You must provide either an email or phone number and a password");const{data:o,error:c}=i;if(c||!o)return{data:{user:null,session:null},error:c};const u=o.session,l=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",u)),{data:{user:l,session:u},error:null}}catch(i){if(B(i))return{data:{user:null,session:null},error:i};throw i}}async signInWithPassword(e){try{let t;if("email"in e){const{email:i,password:o,options:c}=e;t=await G(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:o,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken}},xform:yn})}else if("phone"in e){const{phone:i,password:o,options:c}=e;t=await G(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:o,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken}},xform:yn})}else throw new kt("You must provide either an email or phone number and a password");const{data:r,error:n}=t;return n?{data:{user:null,session:null},error:n}:!r||!r.session||!r.user?{data:{user:null,session:null},error:new St}:(r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),{data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:n})}catch(t){if(B(t))return{data:{user:null,session:null},error:t};throw t}}async signInWithOAuth(e){var t,r,n,i;return await this._handleProviderSignIn(e.provider,{redirectTo:(t=e.options)===null||t===void 0?void 0:t.redirectTo,scopes:(r=e.options)===null||r===void 0?void 0:r.scopes,queryParams:(n=e.options)===null||n===void 0?void 0:n.queryParams,skipBrowserRedirect:(i=e.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:t}=e;if(t==="solana")return await this.signInWithSolana(e);throw new Error(`@supabase/auth-js: Unsupported chain "${t}"`)}async signInWithSolana(e){var t,r,n,i,o,c,u,l,h,f,_,y;let v,O;if("message"in e)v=e.message,O=e.signature;else{const{chain:T,wallet:j,statement:D,options:A}=e;let U;if(_e())if(typeof j=="object")U=j;else{const b=window;if("solana"in b&&typeof b.solana=="object"&&("signIn"in b.solana&&typeof b.solana.signIn=="function"||"signMessage"in b.solana&&typeof b.solana.signMessage=="function"))U=b.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 j!="object"||!(A!=null&&A.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");U=j}const d=new URL((t=A==null?void 0:A.url)!==null&&t!==void 0?t:window.location.href);if("signIn"in U&&U.signIn){const b=await U.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},A==null?void 0:A.signInWithSolana),{version:"1",domain:d.host,uri:d.href}),D?{statement:D}:null));let E;if(Array.isArray(b)&&b[0]&&typeof b[0]=="object")E=b[0];else if(b&&typeof b=="object"&&"signedMessage"in b&&"signature"in b)E=b;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in E&&"signature"in E&&(typeof E.signedMessage=="string"||E.signedMessage instanceof Uint8Array)&&E.signature instanceof Uint8Array)v=typeof E.signedMessage=="string"?E.signedMessage:new TextDecoder().decode(E.signedMessage),O=E.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in U)||typeof U.signMessage!="function"||!("publicKey"in U)||typeof U!="object"||!U.publicKey||!("toBase58"in U.publicKey)||typeof U.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");v=[`${d.host} wants you to sign in with your Solana account:`,U.publicKey.toBase58(),...D?["",D,""]:[""],"Version: 1",`URI: ${d.href}`,`Issued At: ${(n=(r=A==null?void 0:A.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&n!==void 0?n:new Date().toISOString()}`,...!((i=A==null?void 0:A.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${A.signInWithSolana.notBefore}`]:[],...!((o=A==null?void 0:A.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${A.signInWithSolana.expirationTime}`]:[],...!((c=A==null?void 0:A.signInWithSolana)===null||c===void 0)&&c.chainId?[`Chain ID: ${A.signInWithSolana.chainId}`]:[],...!((u=A==null?void 0:A.signInWithSolana)===null||u===void 0)&&u.nonce?[`Nonce: ${A.signInWithSolana.nonce}`]:[],...!((l=A==null?void 0:A.signInWithSolana)===null||l===void 0)&&l.requestId?[`Request ID: ${A.signInWithSolana.requestId}`]:[],...!((f=(h=A==null?void 0:A.signInWithSolana)===null||h===void 0?void 0:h.resources)===null||f===void 0)&&f.length?["Resources",...A.signInWithSolana.resources.map(E=>`- ${E}`)]:[]].join(`
10
+ `);const b=await U.signMessage(new TextEncoder().encode(v),"utf8");if(!b||!(b instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");O=b}}try{const{data:T,error:j}=await G(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:v,signature:Ji(O)},!((_=e.options)===null||_===void 0)&&_.captchaToken?{gotrue_meta_security:{captcha_token:(y=e.options)===null||y===void 0?void 0:y.captchaToken}}:null),xform:be});if(j)throw j;return!T||!T.session||!T.user?{data:{user:null,session:null},error:new St}:(T.session&&(await this._saveSession(T.session),await this._notifyAllSubscribers("SIGNED_IN",T.session)),{data:Object.assign({},T),error:j})}catch(T){if(B(T))return{data:{user:null,session:null},error:T};throw T}}async _exchangeCodeForSession(e){const t=await Ie(this.storage,`${this.storageKey}-code-verifier`),[r,n]=(t??"").split("/");try{const{data:i,error:o}=await G(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:be});if(await Re(this.storage,`${this.storageKey}-code-verifier`),o)throw o;return!i||!i.session||!i.user?{data:{user:null,session:null,redirectType:null},error:new St}:(i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),{data:Object.assign(Object.assign({},i),{redirectType:n??null}),error:o})}catch(i){if(B(i))return{data:{user:null,session:null,redirectType:null},error:i};throw i}}async signInWithIdToken(e){try{const{options:t,provider:r,token:n,access_token:i,nonce:o}=e,c=await G(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:n,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:t==null?void 0:t.captchaToken}},xform:be}),{data:u,error:l}=c;return l?{data:{user:null,session:null},error:l}:!u||!u.session||!u.user?{data:{user:null,session:null},error:new St}:(u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",u.session)),{data:u,error:l})}catch(t){if(B(t))return{data:{user:null,session:null},error:t};throw t}}async signInWithOtp(e){var t,r,n,i,o;try{if("email"in e){const{email:c,options:u}=e;let l=null,h=null;this.flowType==="pkce"&&([l,h]=await Ke(this.storage,this.storageKey));const{error:f}=await G(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:c,data:(t=u==null?void 0:u.data)!==null&&t!==void 0?t:{},create_user:(r=u==null?void 0:u.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken},code_challenge:l,code_challenge_method:h},redirectTo:u==null?void 0:u.emailRedirectTo});return{data:{user:null,session:null},error:f}}if("phone"in e){const{phone:c,options:u}=e,{data:l,error:h}=await G(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:c,data:(n=u==null?void 0:u.data)!==null&&n!==void 0?n:{},create_user:(i=u==null?void 0:u.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken},channel:(o=u==null?void 0:u.channel)!==null&&o!==void 0?o:"sms"}});return{data:{user:null,session:null,messageId:l==null?void 0:l.message_id},error:h}}throw new kt("You must provide either an email or phone number.")}catch(c){if(B(c))return{data:{user:null,session:null},error:c};throw c}}async verifyOtp(e){var t,r;try{let n,i;"options"in e&&(n=(t=e.options)===null||t===void 0?void 0:t.redirectTo,i=(r=e.options)===null||r===void 0?void 0:r.captchaToken);const{data:o,error:c}=await G(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:n,xform:be});if(c)throw c;if(!o)throw new Error("An error occurred on token verification.");const u=o.session,l=o.user;return u!=null&&u.access_token&&(await this._saveSession(u),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",u)),{data:{user:l,session:u},error:null}}catch(n){if(B(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithSSO(e){var t,r,n;try{let i=null,o=null;return this.flowType==="pkce"&&([i,o]=await Ke(this.storage,this.storageKey)),await G(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:(r=(t=e.options)===null||t===void 0?void 0:t.redirectTo)!==null&&r!==void 0?r:void 0}),!((n=e==null?void 0:e.options)===null||n===void 0)&&n.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:i,code_challenge_method:o}),headers:this.headers,xform:go})}catch(i){if(B(i))return{data:null,error:i};throw i}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:t},error:r}=e;if(r)throw r;if(!t)throw new Te;const{error:n}=await G(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return{data:{user:null,session:null},error:n}})}catch(e){if(B(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{const t=`${this.url}/resend`;if("email"in e){const{email:r,type:n,options:i}=e,{error:o}=await G(this.fetch,"POST",t,{headers:this.headers,body:{email:r,type:n,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},redirectTo:i==null?void 0:i.emailRedirectTo});return{data:{user:null,session:null},error:o}}else if("phone"in e){const{phone:r,type:n,options:i}=e,{data:o,error:c}=await G(this.fetch,"POST",t,{headers:this.headers,body:{phone:r,type:n,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return{data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:c}}throw new kt("You must provide either an email or phone number and a type")}catch(t){if(B(t))return{data:{user:null,session:null},error:t};throw t}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async t=>t))}async _acquireLock(e,t){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),n=(async()=>(await r,await t()))();return this.pendingInLock.push((async()=>{try{await n}catch{}})()),n}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const r=t();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const n=[...this.pendingInLock];await Promise.all(n),this.pendingInLock.splice(0,n.length)}return await r}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 t=await this.__loadSession();return await e(t)}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 t=await Ie(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",t),t!==null&&(this._isValidSession(t)?e=t:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const r=e.expires_at?e.expires_at*1e3-Date.now()<Ht:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",e.expires_at),!r){if(this.userStorage){const o=await Ie(this.userStorage,this.storageKey+"-user");o!=null&&o.user?e.user=o.user:e.user=Gt()}if(this.storage.isServer&&e.user){let o=this.suppressGetSessionWarning;e=new Proxy(e,{get:(u,l,h)=>(!o&&l==="user"&&(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."),o=!0,this.suppressGetSessionWarning=!0),Reflect.get(u,l,h))})}return{data:{session:e},error:null}}const{session:n,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{session:null},error:i}:{data:{session:n},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(e){try{return e?await G(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Ae}):await this._useSession(async t=>{var r,n,i;const{data:o,error:c}=t;if(c)throw c;return!(!((r=o.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Te}:await G(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(n=o.session)===null||n===void 0?void 0:n.access_token)!==null&&i!==void 0?i:void 0,xform:Ae})})}catch(t){if(B(t))return Mi(t)&&(await this._removeSession(),await Re(this.storage,`${this.storageKey}-code-verifier`)),{data:{user:null},error:t};throw t}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,t))}async _updateUser(e,t={}){try{return await this._useSession(async r=>{const{data:n,error:i}=r;if(i)throw i;if(!n.session)throw new Te;const o=n.session;let c=null,u=null;this.flowType==="pkce"&&e.email!=null&&([c,u]=await Ke(this.storage,this.storageKey));const{data:l,error:h}=await G(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:t==null?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:c,code_challenge_method:u}),jwt:o.access_token,xform:Ae});if(h)throw h;return o.user=l.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),{data:{user:o.user},error:null}})}catch(r){if(B(r))return{data:{user:null},error:r};throw r}}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new Te;const t=Date.now()/1e3;let r=t,n=!0,i=null;const{payload:o}=Ft(e.access_token);if(o.exp&&(r=o.exp,n=r<=t),n){const{session:c,error:u}=await this._callRefreshToken(e.refresh_token);if(u)return{data:{user:null,session:null},error:u};if(!c)return{data:{user:null,session:null},error:null};i=c}else{const{data:c,error:u}=await this._getUser(e.access_token);if(u)throw u;i={access_token:e.access_token,refresh_token:e.refresh_token,user:c.user,token_type:"bearer",expires_in:r-t,expires_at:r},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return{data:{user:i.user,session:i},error:null}}catch(t){if(B(t))return{data:{session:null,user:null},error:t};throw t}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async t=>{var r;if(!e){const{data:o,error:c}=t;if(c)throw c;e=(r=o.session)!==null&&r!==void 0?r:void 0}if(!(e!=null&&e.refresh_token))throw new Te;const{session:n,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{user:null,session:null},error:i}:n?{data:{user:n.user,session:n},error:null}:{data:{user:null,session:null},error:null}})}catch(t){if(B(t))return{data:{user:null,session:null},error:t};throw t}}async _getSessionFromURL(e,t){try{if(!_e())throw new Rt("No browser detected.");if(e.error||e.error_description||e.error_code)throw new Rt(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(t){case"implicit":if(this.flowType==="pkce")throw new ln("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Rt("Not a valid implicit grant flow url.");break;default:}if(t==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new ln("No code detected.");const{data:D,error:A}=await this._exchangeCodeForSession(e.code);if(A)throw A;const U=new URL(window.location.href);return U.searchParams.delete("code"),window.history.replaceState(window.history.state,"",U.toString()),{data:{session:D.session,redirectType:null},error:null}}const{provider_token:r,provider_refresh_token:n,access_token:i,refresh_token:o,expires_in:c,expires_at:u,token_type:l}=e;if(!i||!c||!o||!l)throw new Rt("No session defined in URL");const h=Math.round(Date.now()/1e3),f=parseInt(c);let _=h+f;u&&(_=parseInt(u));const y=_-h;y*1e3<=Xe&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${y}s, should have been closer to ${f}s`);const v=_-f;h-v>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",v,_,h):h-v<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",v,_,h);const{data:O,error:T}=await this._getUser(i);if(T)throw T;const j={provider_token:r,provider_refresh_token:n,access_token:i,expires_in:f,expires_at:_,refresh_token:o,token_type:l,user:O.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:j,redirectType:e.type},error:null}}catch(r){if(B(r))return{data:{session:null,redirectType:null},error:r};throw r}}_isImplicitGrantCallback(e){return!!(e.access_token||e.error_description)}async _isPKCECallback(e){const t=await Ie(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&t)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async t=>{var r;const{data:n,error:i}=t;if(i)return{error:i};const o=(r=n.session)===null||r===void 0?void 0:r.access_token;if(o){const{error:c}=await this.admin.signOut(o,e);if(c&&!(qi(c)&&(c.status===404||c.status===401||c.status===403)))return{error:c}}return e!=="others"&&(await this._removeSession(),await Re(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(e){const t=Vi(),r={id:t,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",t),this.stateChangeEmitters.delete(t)}};return this._debug("#onAuthStateChange()","registered callback with id",t),this.stateChangeEmitters.set(t,r),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(t)})))(),{data:{subscription:r}}}async _emitInitialSession(e){return await this._useSession(async t=>{var r,n;try{const{data:{session:i},error:o}=t;if(o)throw o;await((r=this.stateChangeEmitters.get(e))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",e,"session",i)}catch(i){await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",i),console.error(i)}})}async resetPasswordForEmail(e,t={}){let r=null,n=null;this.flowType==="pkce"&&([r,n]=await Ke(this.storage,this.storageKey,!0));try{return await G(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:n,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(i){if(B(i))return{data:null,error:i};throw i}}async getUserIdentities(){var e;try{const{data:t,error:r}=await this.getUser();if(r)throw r;return{data:{identities:(e=t.user.identities)!==null&&e!==void 0?e:[]},error:null}}catch(t){if(B(t))return{data:null,error:t};throw t}}async linkIdentity(e){var t;try{const{data:r,error:n}=await this._useSession(async i=>{var o,c,u,l,h;const{data:f,error:_}=i;if(_)throw _;const y=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(c=e.options)===null||c===void 0?void 0:c.scopes,queryParams:(u=e.options)===null||u===void 0?void 0:u.queryParams,skipBrowserRedirect:!0});return await G(this.fetch,"GET",y,{headers:this.headers,jwt:(h=(l=f.session)===null||l===void 0?void 0:l.access_token)!==null&&h!==void 0?h:void 0})});if(n)throw n;return _e()&&!(!((t=e.options)===null||t===void 0)&&t.skipBrowserRedirect)&&window.location.assign(r==null?void 0:r.url),{data:{provider:e.provider,url:r==null?void 0:r.url},error:null}}catch(r){if(B(r))return{data:{provider:e.provider,url:null},error:r};throw r}}async unlinkIdentity(e){try{return await this._useSession(async t=>{var r,n;const{data:i,error:o}=t;if(o)throw o;return await G(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(n=(r=i.session)===null||r===void 0?void 0:r.access_token)!==null&&n!==void 0?n:void 0})})}catch(t){if(B(t))return{data:null,error:t};throw t}}async _refreshAccessToken(e){const t=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(t,"begin");try{const r=Date.now();return await eo(async n=>(n>0&&await Zi(200*Math.pow(2,n-1)),this._debug(t,"refreshing attempt",n),await G(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:be})),(n,i)=>{const o=200*Math.pow(2,n);return i&&Wt(i)&&Date.now()+o-r<Xe})}catch(r){if(this._debug(t,"error",r),B(r))return{data:{session:null,user:null},error:r};throw r}finally{this._debug(t,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,t){const r=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:t.redirectTo,scopes:t.scopes,queryParams:t.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",t,"url",r),_e()&&!t.skipBrowserRedirect&&window.location.assign(r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e,t;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const n=await Ie(this.storage,this.storageKey);if(n&&this.userStorage){let o=await Ie(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:n.user},await Qe(this.userStorage,this.storageKey+"-user",o)),n.user=(e=o==null?void 0:o.user)!==null&&e!==void 0?e:Gt()}else if(n&&!n.user&&!n.user){const o=await Ie(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(n.user=o.user,await Re(this.storage,this.storageKey+"-user"),await Qe(this.storage,this.storageKey,n)):n.user=Gt()}if(this._debug(r,"session from storage",n),!this._isValidSession(n)){this._debug(r,"session is not valid"),n!==null&&await this._removeSession();return}const i=((t=n.expires_at)!==null&&t!==void 0?t:1/0)*1e3-Date.now()<Ht;if(this._debug(r,`session has${i?"":" not"} expired with margin of ${Ht}s`),i){if(this.autoRefreshToken&&n.refresh_token){const{error:o}=await this._callRefreshToken(n.refresh_token);o&&(console.error(o),Wt(o)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(n.user&&n.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:c}=await this._getUser(n.access_token);!c&&(o!=null&&o.user)?(n.user=o.user,await this._saveSession(n),await this._notifyAllSubscribers("SIGNED_IN",n)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(r,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",n)}catch(n){this._debug(r,"error",n),console.error(n);return}finally{this._debug(r,"end")}}async _callRefreshToken(e){var t,r;if(!e)throw new Te;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const n=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{this.refreshingDeferred=new It;const{data:i,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!i.session)throw new Te;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const c={session:i.session,error:null};return this.refreshingDeferred.resolve(c),c}catch(i){if(this._debug(n,"error",i),B(i)){const o={session:null,error:i};return Wt(i)||await this._removeSession(),(t=this.refreshingDeferred)===null||t===void 0||t.resolve(o),o}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(i),i}finally{this.refreshingDeferred=null,this._debug(n,"end")}}async _notifyAllSubscribers(e,t,r=!0){const n=`#_notifyAllSubscribers(${e})`;this._debug(n,"begin",t,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:t});const i=[],o=Array.from(this.stateChangeEmitters.values()).map(async c=>{try{await c.callback(e,t)}catch(u){i.push(u)}});if(await Promise.all(o),i.length>0){for(let c=0;c<i.length;c+=1)console.error(i[c]);throw i[0]}}finally{this._debug(n,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0;const t=Object.assign({},e),r=t.user&&t.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!r&&t.user&&await Qe(this.userStorage,this.storageKey+"-user",{user:t.user});const n=Object.assign({},t);delete n.user;const i=gn(n);await Qe(this.storage,this.storageKey,i)}else{const n=gn(t);await Qe(this.storage,this.storageKey,n)}}async _removeSession(){this._debug("#_removeSession()"),await Re(this.storage,this.storageKey),await Re(this.storage,this.storageKey+"-code-verifier"),await Re(this.storage,this.storageKey+"-user"),this.userStorage&&await Re(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&_e()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(t){console.error("removing visibilitychange callback failed",t)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),Xe);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}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 t=>{const{data:{session:r}}=t;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const n=Math.floor((r.expires_at*1e3-e)/Xe);this._debug("#_autoRefreshTokenTick()",`access token expires in ${n} ticks, a tick lasts ${Xe}ms, refresh threshold is ${_r} ticks`),n<=_r&&await this._callRefreshToken(r.refresh_token)})}catch(t){console.error("Auto refresh tick failed with error. This is likely a transient error.",t)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof ls)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!_e()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const t=`#_onVisibilityChanged(${e})`;this._debug(t,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(t,"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,t,r){const n=[`provider=${encodeURIComponent(t)}`];if(r!=null&&r.redirectTo&&n.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r!=null&&r.scopes&&n.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[i,o]=await Ke(this.storage,this.storageKey),c=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});n.push(c.toString())}if(r!=null&&r.queryParams){const i=new URLSearchParams(r.queryParams);n.push(i.toString())}return r!=null&&r.skipBrowserRedirect&&n.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${e}?${n.join("&")}`}async _unenroll(e){try{return await this._useSession(async t=>{var r;const{data:n,error:i}=t;return i?{data:null,error:i}:await G(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(r=n==null?void 0:n.session)===null||r===void 0?void 0:r.access_token})})}catch(t){if(B(t))return{data:null,error:t};throw t}}async _enroll(e){try{return await this._useSession(async t=>{var r,n;const{data:i,error:o}=t;if(o)return{data:null,error:o};const c=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:{issuer:e.issuer}),{data:u,error:l}=await G(this.fetch,"POST",`${this.url}/factors`,{body:c,headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token});return l?{data:null,error:l}:(e.factorType==="totp"&&(!((n=u==null?void 0:u.totp)===null||n===void 0)&&n.qr_code)&&(u.totp.qr_code=`data:image/svg+xml;utf-8,${u.totp.qr_code}`),{data:u,error:null})})}catch(t){if(B(t))return{data:null,error:t};throw t}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var r;const{data:n,error:i}=t;if(i)return{data:null,error:i};const{data:o,error:c}=await G(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:{code:e.code,challenge_id:e.challengeId},headers:this.headers,jwt:(r=n==null?void 0:n.session)===null||r===void 0?void 0:r.access_token});return c?{data:null,error:c}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+o.expires_in},o)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",o),{data:o,error:c})})}catch(t){if(B(t))return{data:null,error:t};throw t}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var r;const{data:n,error:i}=t;return i?{data:null,error:i}:await G(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:{channel:e.channel},headers:this.headers,jwt:(r=n==null?void 0:n.session)===null||r===void 0?void 0:r.access_token})})}catch(t){if(B(t))return{data:null,error:t};throw t}})}async _challengeAndVerify(e){const{data:t,error:r}=await this._challenge({factorId:e.factorId});return r?{data:null,error:r}:await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){const{data:{user:e},error:t}=await this.getUser();if(t)return{data:null,error:t};const r=(e==null?void 0:e.factors)||[],n=r.filter(o=>o.factor_type==="totp"&&o.status==="verified"),i=r.filter(o=>o.factor_type==="phone"&&o.status==="verified");return{data:{all:r,totp:n,phone:i},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async e=>{var t,r;const{data:{session:n},error:i}=e;if(i)return{data:null,error:i};if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=Ft(n.access_token);let c=null;o.aal&&(c=o.aal);let u=c;((r=(t=n.user.factors)===null||t===void 0?void 0:t.filter(f=>f.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(u="aal2");const h=o.amr||[];return{data:{currentLevel:c,nextLevel:u,currentAuthenticationMethods:h},error:null}}))}async fetchJwk(e,t={keys:[]}){let r=t.keys.find(c=>c.kid===e);if(r)return r;const n=Date.now();if(r=this.jwks.keys.find(c=>c.kid===e),r&&this.jwks_cached_at+Ui>n)return r;const{data:i,error:o}=await G(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=n,r=i.keys.find(c=>c.kid===e),!r)?null:r}async getClaims(e,t={}){try{let r=e;if(!r){const{data:y,error:v}=await this.getSession();if(v||!y.session)return{data:null,error:v};r=y.session.access_token}const{header:n,payload:i,signature:o,raw:{header:c,payload:u}}=Ft(r);t!=null&&t.allowExpired||ao(i.exp);const l=!n.alg||n.alg.startsWith("HS")||!n.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(n.kid,t!=null&&t.keys?{keys:t.keys}:t==null?void 0:t.jwks);if(!l){const{error:y}=await this.getUser(r);if(y)throw y;return{data:{claims:i,header:n,signature:o},error:null}}const h=uo(n.alg),f=await crypto.subtle.importKey("jwk",l,h,!0,["verify"]);if(!await crypto.subtle.verify(h,f,o,Ki(`${c}.${u}`)))throw new mr("Invalid JWT signature");return{data:{claims:i,header:n,signature:o},error:null}}catch(r){if(B(r))return{data:null,error:r};throw r}}}dt.nextInstanceID=0;const Ro=dt;class To extends Ro{constructor(e){super(e)}}var Ao=function(s,e,t,r){function n(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function c(h){try{l(r.next(h))}catch(f){o(f)}}function u(h){try{l(r.throw(h))}catch(f){o(f)}}function l(h){h.done?i(h.value):n(h.value).then(c,u)}l((r=r.apply(s,e||[])).next())})};class Oo{constructor(e,t,r){var n,i,o;if(this.supabaseUrl=e,this.supabaseKey=t,!e)throw new Error("supabaseUrl is required.");if(!t)throw new Error("supabaseKey is required.");const c=Pi(e),u=new URL(c);this.realtimeUrl=new URL("realtime/v1",u),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",u),this.storageUrl=new URL("storage/v1",u),this.functionsUrl=new URL("functions/v1",u);const l=`sb-${u.hostname.split(".")[0]}-auth-token`,h={db:Si,realtime:Ri,auth:Object.assign(Object.assign({},ki),{storageKey:l}),global:Ei},f=$i(r??{},h);this.storageKey=(n=f.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(i=f.global.headers)!==null&&i!==void 0?i:{},f.accessToken?(this.accessToken=f.accessToken,this.auth=new Proxy({},{get:(_,y)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(y)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((o=f.auth)!==null&&o!==void 0?o:{},this.headers,f.global.fetch),this.fetch=ji(t,this._getAccessToken.bind(this),f.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},f.realtime)),this.rest=new Ws(new URL("rest/v1",u).href,{headers:this.headers,schema:f.db.schema,fetch:this.fetch}),this.storage=new mi(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),f.accessToken||this._listenForAuthEvents()}get functions(){return new js(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},r={}){return this.rest.rpc(e,t,r)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){var e,t;return Ao(this,void 0,void 0,function*(){if(this.accessToken)return yield this.accessToken();const{data:r}=yield this.auth.getSession();return(t=(e=r.session)===null||e===void 0?void 0:e.access_token)!==null&&t!==void 0?t:this.supabaseKey})}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:n,storageKey:i,flowType:o,lock:c,debug:u},l,h){const f={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new To({url:this.authUrl.href,headers:Object.assign(Object.assign({},f),l),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:n,flowType:o,lock:c,debug:u,fetch:h,hasCustomAuthorizationHeader:"Authorization"in this.headers})}_initRealtimeClient(e){return new oi(this.realtimeUrl.href,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,r)=>{this._handleTokenChanged(t,"CLIENT",r==null?void 0:r.access_token)})}_handleTokenChanged(e,t,r){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==r?this.changedAccessToken=r:e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const hs=(s,e,t)=>new Oo(s,e,t);function jo(){if(typeof window<"u"||typeof process>"u")return!1;const s=process.version;if(s==null)return!1;const e=s.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}jo()&&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 Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const ds="0.6.1";var ot={},wn;function Co(){if(wn)return ot;wn=1,Object.defineProperty(ot,"__esModule",{value:!0}),ot.parse=o,ot.serialize=l;const s=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,e=/^[\u0021-\u003A\u003C-\u007E]*$/,t=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,r=/^[\u0020-\u003A\u003D-\u007E]*$/,n=Object.prototype.toString,i=(()=>{const _=function(){};return _.prototype=Object.create(null),_})();function o(_,y){const v=new i,O=_.length;if(O<2)return v;const T=(y==null?void 0:y.decode)||h;let j=0;do{const D=_.indexOf("=",j);if(D===-1)break;const A=_.indexOf(";",j),U=A===-1?O:A;if(D>U){j=_.lastIndexOf(";",D-1)+1;continue}const d=c(_,j,D),b=u(_,D,d),E=_.slice(d,b);if(v[E]===void 0){let q=c(_,D+1,U),I=u(_,U,q);const Y=T(_.slice(q,I));v[E]=Y}j=U+1}while(j<O);return v}function c(_,y,v){do{const O=_.charCodeAt(y);if(O!==32&&O!==9)return y}while(++y<v);return v}function u(_,y,v){for(;y>v;){const O=_.charCodeAt(--y);if(O!==32&&O!==9)return y+1}return v}function l(_,y,v){const O=(v==null?void 0:v.encode)||encodeURIComponent;if(!s.test(_))throw new TypeError(`argument name is invalid: ${_}`);const T=O(y);if(!e.test(T))throw new TypeError(`argument val is invalid: ${y}`);let j=_+"="+T;if(!v)return j;if(v.maxAge!==void 0){if(!Number.isInteger(v.maxAge))throw new TypeError(`option maxAge is invalid: ${v.maxAge}`);j+="; Max-Age="+v.maxAge}if(v.domain){if(!t.test(v.domain))throw new TypeError(`option domain is invalid: ${v.domain}`);j+="; Domain="+v.domain}if(v.path){if(!r.test(v.path))throw new TypeError(`option path is invalid: ${v.path}`);j+="; Path="+v.path}if(v.expires){if(!f(v.expires)||!Number.isFinite(v.expires.valueOf()))throw new TypeError(`option expires is invalid: ${v.expires}`);j+="; Expires="+v.expires.toUTCString()}if(v.httpOnly&&(j+="; HttpOnly"),v.secure&&(j+="; Secure"),v.partitioned&&(j+="; Partitioned"),v.priority)switch(typeof v.priority=="string"?v.priority.toLowerCase():void 0){case"low":j+="; Priority=Low";break;case"medium":j+="; Priority=Medium";break;case"high":j+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${v.priority}`)}if(v.sameSite)switch(typeof v.sameSite=="string"?v.sameSite.toLowerCase():v.sameSite){case!0:case"strict":j+="; SameSite=Strict";break;case"lax":j+="; SameSite=Lax";break;case"none":j+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${v.sameSite}`)}return j}function h(_){if(_.indexOf("%")===-1)return _;try{return decodeURIComponent(_)}catch{return _}}function f(_){return n.call(_)==="[object Date]"}return ot}var bn=Co();function wr(){return typeof window<"u"&&typeof window.document<"u"}const Ue={path:"/",sameSite:"lax",httpOnly:!1,maxAge:400*24*60*60},Po=3180,$o=/^(.*)[.](0|[1-9][0-9]*)$/;function $t(s,e){if(s===e)return!0;const t=s.match($o);return!!(t&&t[1]===e)}function fs(s,e,t){const r=Po;let n=encodeURIComponent(e);if(n.length<=r)return[{name:s,value:e}];const i=[];for(;n.length>0;){let o=n.slice(0,r);const c=o.lastIndexOf("%");c>r-3&&(o=o.slice(0,c));let u="";for(;o.length>0;)try{u=decodeURIComponent(o);break}catch(l){if(l instanceof URIError&&o.at(-3)==="%"&&o.length>3)o=o.slice(0,o.length-3);else throw l}i.push(u),n=n.slice(o.length)}return i.map((o,c)=>({name:`${s}.${c}`,value:o}))}async function En(s,e){const t=await e(s);if(t)return t;let r=[];for(let n=0;;n++){const i=`${s}.${n}`,o=await e(i);if(!o)break;r.push(o)}return r.length>0?r.join(""):null}const xt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Sn=`
11
+ \r=`.split(""),xo=(()=>{const s=new Array(128);for(let e=0;e<s.length;e+=1)s[e]=-1;for(let e=0;e<Sn.length;e+=1)s[Sn[e].charCodeAt(0)]=-2;for(let e=0;e<xt.length;e+=1)s[xt[e].charCodeAt(0)]=e;return s})();function ps(s){const e=[];let t=0,r=0;if(Do(s,i=>{for(t=t<<8|i,r+=8;r>=6;){const o=t>>r-6&63;e.push(xt[o]),r-=6}}),r>0)for(t=t<<6-r,r=6;r>=6;){const i=t>>r-6&63;e.push(xt[i]),r-=6}return e.join("")}function kn(s){const e=[],t=o=>{e.push(String.fromCodePoint(o))},r={utf8seq:0,codepoint:0};let n=0,i=0;for(let o=0;o<s.length;o+=1){const c=s.charCodeAt(o),u=xo[c];if(u>-1)for(n=n<<6|u,i+=6;i>=8;)No(n>>i-8&255,r,t),i-=8;else{if(u===-2)continue;throw new Error(`Invalid Base64-URL character "${s.at(o)}" at position ${o}`)}}return e.join("")}function Io(s,e){if(s<=127){e(s);return}else if(s<=2047){e(192|s>>6),e(128|s&63);return}else if(s<=65535){e(224|s>>12),e(128|s>>6&63),e(128|s&63);return}else if(s<=1114111){e(240|s>>18),e(128|s>>12&63),e(128|s>>6&63),e(128|s&63);return}throw new Error(`Unrecognized Unicode codepoint: ${s.toString(16)}`)}function Do(s,e){for(let t=0;t<s.length;t+=1){let r=s.charCodeAt(t);if(r>55295&&r<=56319){const n=(r-55296)*1024&65535;r=(s.charCodeAt(t+1)-56320&65535|n)+65536,t+=1}Io(r,e)}}function No(s,e,t){if(e.utf8seq===0){if(s<=127){t(s);return}for(let r=1;r<6;r+=1)if((s>>7-r&1)===0){e.utf8seq=r;break}if(e.utf8seq===2)e.codepoint=s&31;else if(e.utf8seq===3)e.codepoint=s&15;else if(e.utf8seq===4)e.codepoint=s&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(s<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|s&63,e.utf8seq-=1,e.utf8seq===0&&t(e.codepoint)}}const Ze="base64-";function gs(s,e){const t=s.cookies??null,r=s.cookieEncoding,n={},i={};let o,c;if(t)if("get"in t){const u=async l=>{const h=l.flatMap(_=>[_,...Array.from({length:5}).map((y,v)=>`${_}.${v}`)]),f=[];for(let _=0;_<h.length;_+=1){const y=await t.get(h[_]);!y&&typeof y!="string"||f.push({name:h[_],value:y})}return f};if(o=async l=>await u(l),"set"in t&&"remove"in t)c=async l=>{for(let h=0;h<l.length;h+=1){const{name:f,value:_,options:y}=l[h];_?await t.set(f,_,y):await t.remove(f,y)}};else if(e)c=async()=>{console.warn("@supabase/ssr: createServerClient was configured without set and remove cookie methods, but the client needs to set cookies. This can lead to issues such as random logouts, early session termination or increased token refresh requests. If in NextJS, check your middleware.ts file, route handlers and server actions for correctness. Consider switching to the getAll and setAll cookie methods instead of get, set and remove which are deprecated and can be difficult to use correctly.")};else throw new Error("@supabase/ssr: createBrowserClient requires configuring a getAll and setAll cookie method (deprecated: alternatively both get, set and remove can be used)")}else if("getAll"in t)if(o=async()=>await t.getAll(),"setAll"in t)c=t.setAll;else if(e)c=async()=>{console.warn("@supabase/ssr: createServerClient was configured without the setAll cookie method, but the client needs to set cookies. This can lead to issues such as random logouts, early session termination or increased token refresh requests. If in NextJS, check your middleware.ts file, route handlers and server actions for correctness.")};else throw new Error("@supabase/ssr: createBrowserClient requires configuring both getAll and setAll cookie methods (deprecated: alternatively both get, set and remove can be used)");else throw new Error(`@supabase/ssr: ${e?"createServerClient":"createBrowserClient"} requires configuring getAll and setAll cookie methods (deprecated: alternatively use get, set and remove).${wr()?" As this is called in a browser runtime, consider removing the cookies option object to use the document.cookie API automatically.":""}`);else if(!e&&wr()){const u=()=>{const l=bn.parse(document.cookie);return Object.keys(l).map(h=>({name:h,value:l[h]??""}))};o=()=>u(),c=l=>{l.forEach(({name:h,value:f,options:_})=>{document.cookie=bn.serialize(h,f,_)})}}else{if(e)throw new Error("@supabase/ssr: createServerClient must be initialized with cookie options that specify getAll and setAll functions (deprecated, not recommended: alternatively use get, set and remove)");o=()=>[],c=()=>{throw new Error("@supabase/ssr: createBrowserClient in non-browser runtimes (including Next.js pre-rendering mode) was not initialized cookie options that specify getAll and setAll functions (deprecated: alternatively use get, set and remove), but they were needed")}}return e?{getAll:o,setAll:c,setItems:n,removedItems:i,storage:{isServer:!0,getItem:async u=>{if(typeof n[u]=="string")return n[u];if(i[u])return null;const l=await o([u]),h=await En(u,async _=>{const y=(l==null?void 0:l.find(({name:v})=>v===_))||null;return y?y.value:null});if(!h)return null;let f=h;return typeof h=="string"&&h.startsWith(Ze)&&(f=kn(h.substring(Ze.length))),f},setItem:async(u,l)=>{u.endsWith("-code-verifier")&&await _s({getAll:o,setAll:c,setItems:{[u]:l},removedItems:{}},{cookieOptions:(s==null?void 0:s.cookieOptions)??null,cookieEncoding:r}),n[u]=l,delete i[u]},removeItem:async u=>{delete n[u],i[u]=!0}}}:{getAll:o,setAll:c,setItems:n,removedItems:i,storage:{isServer:!1,getItem:async u=>{const l=await o([u]),h=await En(u,async _=>{const y=(l==null?void 0:l.find(({name:v})=>v===_))||null;return y?y.value:null});if(!h)return null;let f=h;return h.startsWith(Ze)&&(f=kn(h.substring(Ze.length))),f},setItem:async(u,l)=>{const h=await o([u]),f=(h==null?void 0:h.map(({name:D})=>D))||[],_=new Set(f.filter(D=>$t(D,u)));let y=l;r==="base64url"&&(y=Ze+ps(l));const v=fs(u,y);v.forEach(({name:D})=>{_.delete(D)});const O={...Ue,...s==null?void 0:s.cookieOptions,maxAge:0},T={...Ue,...s==null?void 0:s.cookieOptions,maxAge:Ue.maxAge};delete O.name,delete T.name;const j=[...[..._].map(D=>({name:D,value:"",options:O})),...v.map(({name:D,value:A})=>({name:D,value:A,options:T}))];j.length>0&&await c(j)},removeItem:async u=>{const l=await o([u]),f=((l==null?void 0:l.map(({name:y})=>y))||[]).filter(y=>$t(y,u)),_={...Ue,...s==null?void 0:s.cookieOptions,maxAge:0};delete _.name,f.length>0&&await c(f.map(y=>({name:y,value:"",options:_})))}}}}async function _s({getAll:s,setAll:e,setItems:t,removedItems:r},n){const i=n.cookieEncoding,o=n.cookieOptions??null,c=await s([...t?Object.keys(t):[],...r?Object.keys(r):[]]),u=(c==null?void 0:c.map(({name:y})=>y))||[],l=Object.keys(r).flatMap(y=>u.filter(v=>$t(v,y))),h=Object.keys(t).flatMap(y=>{const v=new Set(u.filter(j=>$t(j,y)));let O=t[y];i==="base64url"&&(O=Ze+ps(O));const T=fs(y,O);return T.forEach(j=>{v.delete(j.name)}),l.push(...v),T}),f={...Ue,...o,maxAge:0},_={...Ue,...o,maxAge:Ue.maxAge};delete f.name,delete _.name,await e([...l.map(y=>({name:y,value:"",options:f})),...h.map(({name:y,value:v})=>({name:y,value:v,options:_}))])}function Uo(s,e,t){var l,h;if(!s||!e)throw new Error(`Your project's URL and Key are required to create a Supabase client!
12
+
13
+ Check your Supabase project's API settings to find these values
14
+
15
+ https://supabase.com/dashboard/project/_/settings/api`);const{storage:r,getAll:n,setAll:i,setItems:o,removedItems:c}=gs({...t,cookieEncoding:(t==null?void 0:t.cookieEncoding)??"base64url"},!0),u=hs(s,e,{...t,global:{...t==null?void 0:t.global,headers:{...(l=t==null?void 0:t.global)==null?void 0:l.headers,"X-Client-Info":`supabase-ssr/${ds} createServerClient`}},auth:{...(h=t==null?void 0:t.cookieOptions)!=null&&h.name?{storageKey:t.cookieOptions.name}:null,...t==null?void 0:t.auth,flowType:"pkce",autoRefreshToken:!1,detectSessionInUrl:!1,persistSession:!0,storage:r}});return u.auth.onAuthStateChange(async f=>{(Object.keys(o).length>0||Object.keys(c).length>0)&&(f==="SIGNED_IN"||f==="TOKEN_REFRESHED"||f==="USER_UPDATED"||f==="PASSWORD_RECOVERY"||f==="SIGNED_OUT"||f==="MFA_CHALLENGE_VERIFIED")&&await _s({getAll:n,setAll:i,setItems:o,removedItems:c},{cookieOptions:(t==null?void 0:t.cookieOptions)??null,cookieEncoding:(t==null?void 0:t.cookieEncoding)??"base64url"})}),u}var Kt={},Jt,Rn;function Lo(){if(Rn)return Jt;Rn=1;var s=Object.defineProperty,e=Object.getOwnPropertyDescriptor,t=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,n=(d,b)=>{for(var E in b)s(d,E,{get:b[E],enumerable:!0})},i=(d,b,E,q)=>{if(b&&typeof b=="object"||typeof b=="function")for(let I of t(b))!r.call(d,I)&&I!==E&&s(d,I,{get:()=>b[I],enumerable:!(q=e(b,I))||q.enumerable});return d},o=d=>i(s({},"__esModule",{value:!0}),d),c={};n(c,{RequestCookies:()=>j,ResponseCookies:()=>D,parseCookie:()=>l,parseSetCookie:()=>h,stringifyCookie:()=>u}),Jt=o(c);function u(d){var b;const E=["path"in d&&d.path&&`Path=${d.path}`,"expires"in d&&(d.expires||d.expires===0)&&`Expires=${(typeof d.expires=="number"?new Date(d.expires):d.expires).toUTCString()}`,"maxAge"in d&&typeof d.maxAge=="number"&&`Max-Age=${d.maxAge}`,"domain"in d&&d.domain&&`Domain=${d.domain}`,"secure"in d&&d.secure&&"Secure","httpOnly"in d&&d.httpOnly&&"HttpOnly","sameSite"in d&&d.sameSite&&`SameSite=${d.sameSite}`,"partitioned"in d&&d.partitioned&&"Partitioned","priority"in d&&d.priority&&`Priority=${d.priority}`].filter(Boolean),q=`${d.name}=${encodeURIComponent((b=d.value)!=null?b:"")}`;return E.length===0?q:`${q}; ${E.join("; ")}`}function l(d){const b=new Map;for(const E of d.split(/; */)){if(!E)continue;const q=E.indexOf("=");if(q===-1){b.set(E,"true");continue}const[I,Y]=[E.slice(0,q),E.slice(q+1)];try{b.set(I,decodeURIComponent(Y??"true"))}catch{}}return b}function h(d){if(!d)return;const[[b,E],...q]=l(d),{domain:I,expires:Y,httponly:he,maxage:te,path:ae,samesite:fe,secure:pe,partitioned:oe,priority:ge}=Object.fromEntries(q.map(([X,g])=>[X.toLowerCase().replace(/-/g,""),g])),ke={name:b,value:decodeURIComponent(E),domain:I,...Y&&{expires:new Date(Y)},...he&&{httpOnly:!0},...typeof te=="string"&&{maxAge:Number(te)},path:ae,...fe&&{sameSite:y(fe)},...pe&&{secure:!0},...ge&&{priority:O(ge)},...oe&&{partitioned:!0}};return f(ke)}function f(d){const b={};for(const E in d)d[E]&&(b[E]=d[E]);return b}var _=["strict","lax","none"];function y(d){return d=d.toLowerCase(),_.includes(d)?d:void 0}var v=["low","medium","high"];function O(d){return d=d.toLowerCase(),v.includes(d)?d:void 0}function T(d){if(!d)return[];var b=[],E=0,q,I,Y,he,te;function ae(){for(;E<d.length&&/\s/.test(d.charAt(E));)E+=1;return E<d.length}function fe(){return I=d.charAt(E),I!=="="&&I!==";"&&I!==","}for(;E<d.length;){for(q=E,te=!1;ae();)if(I=d.charAt(E),I===","){for(Y=E,E+=1,ae(),he=E;E<d.length&&fe();)E+=1;E<d.length&&d.charAt(E)==="="?(te=!0,E=he,b.push(d.substring(q,Y)),q=E):E=Y+1}else E+=1;(!te||E>=d.length)&&b.push(d.substring(q,d.length))}return b}var j=class{constructor(d){this._parsed=new Map,this._headers=d;const b=d.get("cookie");if(b){const E=l(b);for(const[q,I]of E)this._parsed.set(q,{name:q,value:I})}}[Symbol.iterator](){return this._parsed[Symbol.iterator]()}get size(){return this._parsed.size}get(...d){const b=typeof d[0]=="string"?d[0]:d[0].name;return this._parsed.get(b)}getAll(...d){var b;const E=Array.from(this._parsed);if(!d.length)return E.map(([I,Y])=>Y);const q=typeof d[0]=="string"?d[0]:(b=d[0])==null?void 0:b.name;return E.filter(([I])=>I===q).map(([I,Y])=>Y)}has(d){return this._parsed.has(d)}set(...d){const[b,E]=d.length===1?[d[0].name,d[0].value]:d,q=this._parsed;return q.set(b,{name:b,value:E}),this._headers.set("cookie",Array.from(q).map(([I,Y])=>u(Y)).join("; ")),this}delete(d){const b=this._parsed,E=Array.isArray(d)?d.map(q=>b.delete(q)):b.delete(d);return this._headers.set("cookie",Array.from(b).map(([q,I])=>u(I)).join("; ")),E}clear(){return this.delete(Array.from(this._parsed.keys())),this}[Symbol.for("edge-runtime.inspect.custom")](){return`RequestCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(d=>`${d.name}=${encodeURIComponent(d.value)}`).join("; ")}},D=class{constructor(d){this._parsed=new Map;var b,E,q;this._headers=d;const I=(q=(E=(b=d.getSetCookie)==null?void 0:b.call(d))!=null?E:d.get("set-cookie"))!=null?q:[],Y=Array.isArray(I)?I:T(I);for(const he of Y){const te=h(he);te&&this._parsed.set(te.name,te)}}get(...d){const b=typeof d[0]=="string"?d[0]:d[0].name;return this._parsed.get(b)}getAll(...d){var b;const E=Array.from(this._parsed.values());if(!d.length)return E;const q=typeof d[0]=="string"?d[0]:(b=d[0])==null?void 0:b.name;return E.filter(I=>I.name===q)}has(d){return this._parsed.has(d)}set(...d){const[b,E,q]=d.length===1?[d[0].name,d[0].value,d[0]]:d,I=this._parsed;return I.set(b,U({name:b,value:E,...q})),A(I,this._headers),this}delete(...d){const[b,E]=typeof d[0]=="string"?[d[0]]:[d[0].name,d[0]];return this.set({...E,name:b,value:"",expires:new Date(0)})}[Symbol.for("edge-runtime.inspect.custom")](){return`ResponseCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(u).join("; ")}};function A(d,b){b.delete("set-cookie");for(const[,E]of d){const q=u(E);b.append("set-cookie",q)}}function U(d={name:"",value:""}){return typeof d.expires=="number"&&(d.expires=new Date(d.expires)),d.maxAge&&(d.expires=new Date(Date.now()+d.maxAge*1e3)),(d.path===null||d.path===void 0)&&(d.path="/"),d}return Jt}var Tn;function qo(){return Tn||(Tn=1,function(s){Object.defineProperty(s,"__esModule",{value:!0});function e(r,n){for(var i in n)Object.defineProperty(r,i,{enumerable:!0,get:n[i]})}e(s,{RequestCookies:function(){return t.RequestCookies},ResponseCookies:function(){return t.ResponseCookies},stringifyCookie:function(){return t.stringifyCookie}});const t=Lo()}(Kt)),Kt}var Yt={},An;function Mo(){return An||(An=1,function(s){Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"ReflectAdapter",{enumerable:!0,get:function(){return e}});class e{static get(r,n,i){const o=Reflect.get(r,n,i);return typeof o=="function"?o.bind(r):o}static set(r,n,i,o){return Reflect.set(r,n,i,o)}static has(r,n){return Reflect.has(r,n)}static deleteProperty(r,n){return Reflect.deleteProperty(r,n)}}}(Yt)),Yt}var Vt={},Xt={},Qt={},On;function Tr(){return On||(On=1,function(s){Object.defineProperty(s,"__esModule",{value:!0});function e(u,l){for(var h in l)Object.defineProperty(u,h,{enumerable:!0,get:l[h]})}e(s,{bindSnapshot:function(){return o},createAsyncLocalStorage:function(){return i},createSnapshot:function(){return c}});const t=Object.defineProperty(new Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available"),"__NEXT_ERROR_CODE",{value:"E504",enumerable:!1,configurable:!0});class r{disable(){throw t}getStore(){}run(){throw t}exit(){throw t}enterWith(){throw t}static bind(l){return l}}const n=typeof globalThis<"u"&&globalThis.AsyncLocalStorage;function i(){return n?new n:new r}function o(u){return n?n.bind(u):r.bind(u)}function c(){return n?n.snapshot():function(u,...l){return u(...l)}}}(Qt)),Qt}var jn;function Bo(){return jn||(jn=1,function(s){Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"workAsyncStorageInstance",{enumerable:!0,get:function(){return t}});const t=(0,Tr().createAsyncLocalStorage)()}(Xt)),Xt}var Cn;function ys(){return Cn||(Cn=1,function(s){Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"workAsyncStorage",{enumerable:!0,get:function(){return e.workAsyncStorageInstance}});const e=Bo()}(Vt)),Vt}var Zt={},er={},Pn;function Ho(){return Pn||(Pn=1,function(s){Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"workUnitAsyncStorageInstance",{enumerable:!0,get:function(){return t}});const t=(0,Tr().createAsyncLocalStorage)()}(er)),er}var Tt={exports:{}},$n;function Wo(){return $n||($n=1,function(s,e){Object.defineProperty(e,"__esModule",{value:!0});function t(U,d){for(var b in d)Object.defineProperty(U,b,{enumerable:!0,get:d[b]})}t(e,{ACTION_HEADER:function(){return n},FLIGHT_HEADERS:function(){return _},NEXT_ACTION_NOT_FOUND_HEADER:function(){return A},NEXT_DID_POSTPONE_HEADER:function(){return O},NEXT_HMR_REFRESH_HASH_COOKIE:function(){return l},NEXT_HMR_REFRESH_HEADER:function(){return u},NEXT_IS_PRERENDER_HEADER:function(){return D},NEXT_REWRITTEN_PATH_HEADER:function(){return T},NEXT_REWRITTEN_QUERY_HEADER:function(){return j},NEXT_ROUTER_PREFETCH_HEADER:function(){return o},NEXT_ROUTER_SEGMENT_PREFETCH_HEADER:function(){return c},NEXT_ROUTER_STALE_TIME_HEADER:function(){return v},NEXT_ROUTER_STATE_TREE_HEADER:function(){return i},NEXT_RSC_UNION_QUERY:function(){return y},NEXT_URL:function(){return h},RSC_CONTENT_TYPE_HEADER:function(){return f},RSC_HEADER:function(){return r}});const r="RSC",n="Next-Action",i="Next-Router-State-Tree",o="Next-Router-Prefetch",c="Next-Router-Segment-Prefetch",u="Next-HMR-Refresh",l="__next_hmr_refresh_hash__",h="Next-Url",f="text/x-component",_=[r,i,o,u,c],y="_rsc",v="x-nextjs-stale-time",O="x-nextjs-postponed",T="x-nextjs-rewritten-path",j="x-nextjs-rewritten-query",D="x-nextjs-prerender",A="x-nextjs-action-not-found";(typeof e.default=="function"||typeof e.default=="object"&&e.default!==null)&&typeof e.default.__esModule>"u"&&(Object.defineProperty(e.default,"__esModule",{value:!0}),Object.assign(e.default,e),s.exports=e.default)}(Tt,Tt.exports)),Tt.exports}var xn;function vs(){return xn||(xn=1,function(s){Object.defineProperty(s,"__esModule",{value:!0});function e(h,f){for(var _ in f)Object.defineProperty(h,_,{enumerable:!0,get:f[_]})}e(s,{getDraftModeProviderForCacheScope:function(){return l},getExpectedRequestStore:function(){return n},getHmrRefreshHash:function(){return u},getPrerenderResumeDataCache:function(){return o},getRenderResumeDataCache:function(){return c},throwForMissingRequestStore:function(){return i},workUnitAsyncStorage:function(){return t.workUnitAsyncStorageInstance}});const t=Ho(),r=Wo();function n(h){const f=t.workUnitAsyncStorageInstance.getStore();switch(f||i(h),f.type){case"request":return f;case"prerender":case"prerender-client":case"prerender-ppr":case"prerender-legacy":throw Object.defineProperty(new Error(`\`${h}\` cannot be called inside a prerender. This is a bug in Next.js.`),"__NEXT_ERROR_CODE",{value:"E401",enumerable:!1,configurable:!0});case"cache":throw Object.defineProperty(new Error(`\`${h}\` cannot be called inside "use cache". Call it outside and pass an argument instead. Read more: https://nextjs.org/docs/messages/next-request-in-use-cache`),"__NEXT_ERROR_CODE",{value:"E37",enumerable:!1,configurable:!0});case"unstable-cache":throw Object.defineProperty(new Error(`\`${h}\` cannot be called inside unstable_cache. Call it outside and pass an argument instead. Read more: https://nextjs.org/docs/app/api-reference/functions/unstable_cache`),"__NEXT_ERROR_CODE",{value:"E69",enumerable:!1,configurable:!0});default:return f}}function i(h){throw Object.defineProperty(new Error(`\`${h}\` was called outside a request scope. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context`),"__NEXT_ERROR_CODE",{value:"E251",enumerable:!1,configurable:!0})}function o(h){return h.type==="prerender"||h.type==="prerender-client"||h.type==="prerender-ppr"?h.prerenderResumeDataCache:null}function c(h){switch(h.type){case"request":return h.renderResumeDataCache;case"prerender":case"prerender-client":if(h.renderResumeDataCache)return h.renderResumeDataCache;case"prerender-ppr":return h.prerenderResumeDataCache;default:return null}}function u(h,f){var _;if(h.dev)return f.type==="cache"||f.type==="prerender"?f.hmrRefreshHash:f.type==="request"?(_=f.cookies.get(r.NEXT_HMR_REFRESH_HASH_COOKIE))==null?void 0:_.value:void 0}function l(h,f){if(h.isDraftMode)switch(f.type){case"cache":case"unstable-cache":case"request":return f.draftMode;default:return}}}(Zt)),Zt}var tr={},At={exports:{}},H={};/**
16
+ * @license React
17
+ * react.production.js
18
+ *
19
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
20
+ *
21
+ * This source code is licensed under the MIT license found in the
22
+ * LICENSE file in the root directory of this source tree.
23
+ */var In;function Fo(){if(In)return H;In=1;var s=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),n=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),o=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),l=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),f=Symbol.iterator;function _(g){return g===null||typeof g!="object"?null:(g=f&&g[f]||g["@@iterator"],typeof g=="function"?g:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,O={};function T(g,S,N){this.props=g,this.context=S,this.refs=O,this.updater=N||y}T.prototype.isReactComponent={},T.prototype.setState=function(g,S){if(typeof g!="object"&&typeof g!="function"&&g!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,g,S,"setState")},T.prototype.forceUpdate=function(g){this.updater.enqueueForceUpdate(this,g,"forceUpdate")};function j(){}j.prototype=T.prototype;function D(g,S,N){this.props=g,this.context=S,this.refs=O,this.updater=N||y}var A=D.prototype=new j;A.constructor=D,v(A,T.prototype),A.isPureReactComponent=!0;var U=Array.isArray,d={H:null,A:null,T:null,S:null},b=Object.prototype.hasOwnProperty;function E(g,S,N,L,F,V){return N=V.ref,{$$typeof:s,type:g,key:S,ref:N!==void 0?N:null,props:V}}function q(g,S){return E(g.type,S,void 0,void 0,void 0,g.props)}function I(g){return typeof g=="object"&&g!==null&&g.$$typeof===s}function Y(g){var S={"=":"=0",":":"=2"};return"$"+g.replace(/[=:]/g,function(N){return S[N]})}var he=/\/+/g;function te(g,S){return typeof g=="object"&&g!==null&&g.key!=null?Y(""+g.key):S.toString(36)}function ae(){}function fe(g){switch(g.status){case"fulfilled":return g.value;case"rejected":throw g.reason;default:switch(typeof g.status=="string"?g.then(ae,ae):(g.status="pending",g.then(function(S){g.status==="pending"&&(g.status="fulfilled",g.value=S)},function(S){g.status==="pending"&&(g.status="rejected",g.reason=S)})),g.status){case"fulfilled":return g.value;case"rejected":throw g.reason}}throw g}function pe(g,S,N,L,F){var V=typeof g;(V==="undefined"||V==="boolean")&&(g=null);var M=!1;if(g===null)M=!0;else switch(V){case"bigint":case"string":case"number":M=!0;break;case"object":switch(g.$$typeof){case s:case e:M=!0;break;case h:return M=g._init,pe(M(g._payload),S,N,L,F)}}if(M)return F=F(g),M=L===""?"."+te(g,0):L,U(F)?(N="",M!=null&&(N=M.replace(he,"$&/")+"/"),pe(F,S,N,"",function(je){return je})):F!=null&&(I(F)&&(F=q(F,N+(F.key==null||g&&g.key===F.key?"":(""+F.key).replace(he,"$&/")+"/")+M)),S.push(F)),1;M=0;var de=L===""?".":L+":";if(U(g))for(var Z=0;Z<g.length;Z++)L=g[Z],V=de+te(L,Z),M+=pe(L,S,N,V,F);else if(Z=_(g),typeof Z=="function")for(g=Z.call(g),Z=0;!(L=g.next()).done;)L=L.value,V=de+te(L,Z++),M+=pe(L,S,N,V,F);else if(V==="object"){if(typeof g.then=="function")return pe(fe(g),S,N,L,F);throw S=String(g),Error("Objects are not valid as a React child (found: "+(S==="[object Object]"?"object with keys {"+Object.keys(g).join(", ")+"}":S)+"). If you meant to render a collection of children, use an array instead.")}return M}function oe(g,S,N){if(g==null)return g;var L=[],F=0;return pe(g,L,"","",function(V){return S.call(N,V,F++)}),L}function ge(g){if(g._status===-1){var S=g._result;S=S(),S.then(function(N){(g._status===0||g._status===-1)&&(g._status=1,g._result=N)},function(N){(g._status===0||g._status===-1)&&(g._status=2,g._result=N)}),g._status===-1&&(g._status=0,g._result=S)}if(g._status===1)return g._result.default;throw g._result}var ke=typeof reportError=="function"?reportError:function(g){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var S=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof g=="object"&&g!==null&&typeof g.message=="string"?String(g.message):String(g),error:g});if(!window.dispatchEvent(S))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",g);return}console.error(g)};function X(){}return H.Children={map:oe,forEach:function(g,S,N){oe(g,function(){S.apply(this,arguments)},N)},count:function(g){var S=0;return oe(g,function(){S++}),S},toArray:function(g){return oe(g,function(S){return S})||[]},only:function(g){if(!I(g))throw Error("React.Children.only expected to receive a single React element child.");return g}},H.Component=T,H.Fragment=t,H.Profiler=n,H.PureComponent=D,H.StrictMode=r,H.Suspense=u,H.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=d,H.act=function(){throw Error("act(...) is not supported in production builds of React.")},H.cache=function(g){return function(){return g.apply(null,arguments)}},H.cloneElement=function(g,S,N){if(g==null)throw Error("The argument must be a React element, but you passed "+g+".");var L=v({},g.props),F=g.key,V=void 0;if(S!=null)for(M in S.ref!==void 0&&(V=void 0),S.key!==void 0&&(F=""+S.key),S)!b.call(S,M)||M==="key"||M==="__self"||M==="__source"||M==="ref"&&S.ref===void 0||(L[M]=S[M]);var M=arguments.length-2;if(M===1)L.children=N;else if(1<M){for(var de=Array(M),Z=0;Z<M;Z++)de[Z]=arguments[Z+2];L.children=de}return E(g.type,F,void 0,void 0,V,L)},H.createContext=function(g){return g={$$typeof:o,_currentValue:g,_currentValue2:g,_threadCount:0,Provider:null,Consumer:null},g.Provider=g,g.Consumer={$$typeof:i,_context:g},g},H.createElement=function(g,S,N){var L,F={},V=null;if(S!=null)for(L in S.key!==void 0&&(V=""+S.key),S)b.call(S,L)&&L!=="key"&&L!=="__self"&&L!=="__source"&&(F[L]=S[L]);var M=arguments.length-2;if(M===1)F.children=N;else if(1<M){for(var de=Array(M),Z=0;Z<M;Z++)de[Z]=arguments[Z+2];F.children=de}if(g&&g.defaultProps)for(L in M=g.defaultProps,M)F[L]===void 0&&(F[L]=M[L]);return E(g,V,void 0,void 0,null,F)},H.createRef=function(){return{current:null}},H.forwardRef=function(g){return{$$typeof:c,render:g}},H.isValidElement=I,H.lazy=function(g){return{$$typeof:h,_payload:{_status:-1,_result:g},_init:ge}},H.memo=function(g,S){return{$$typeof:l,type:g,compare:S===void 0?null:S}},H.startTransition=function(g){var S=d.T,N={};d.T=N;try{var L=g(),F=d.S;F!==null&&F(N,L),typeof L=="object"&&L!==null&&typeof L.then=="function"&&L.then(X,ke)}catch(V){ke(V)}finally{d.T=S}},H.unstable_useCacheRefresh=function(){return d.H.useCacheRefresh()},H.use=function(g){return d.H.use(g)},H.useActionState=function(g,S,N){return d.H.useActionState(g,S,N)},H.useCallback=function(g,S){return d.H.useCallback(g,S)},H.useContext=function(g){return d.H.useContext(g)},H.useDebugValue=function(){},H.useDeferredValue=function(g,S){return d.H.useDeferredValue(g,S)},H.useEffect=function(g,S){return d.H.useEffect(g,S)},H.useId=function(){return d.H.useId()},H.useImperativeHandle=function(g,S,N){return d.H.useImperativeHandle(g,S,N)},H.useInsertionEffect=function(g,S){return d.H.useInsertionEffect(g,S)},H.useLayoutEffect=function(g,S){return d.H.useLayoutEffect(g,S)},H.useMemo=function(g,S){return d.H.useMemo(g,S)},H.useOptimistic=function(g,S){return d.H.useOptimistic(g,S)},H.useReducer=function(g,S,N){return d.H.useReducer(g,S,N)},H.useRef=function(g){return d.H.useRef(g)},H.useState=function(g){return d.H.useState(g)},H.useSyncExternalStore=function(g,S,N){return d.H.useSyncExternalStore(g,S,N)},H.useTransition=function(){return d.H.useTransition()},H.version="19.0.0",H}var ut={exports:{}};/**
24
+ * @license React
25
+ * react.development.js
26
+ *
27
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
28
+ *
29
+ * This source code is licensed under the MIT license found in the
30
+ * LICENSE file in the root directory of this source tree.
31
+ */ut.exports;var Dn;function Go(){return Dn||(Dn=1,function(s,e){process.env.NODE_ENV!=="production"&&function(){function t(a,p){Object.defineProperty(i.prototype,a,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",p[0],p[1])}})}function r(a){return a===null||typeof a!="object"?null:(a=ie&&a[ie]||a["@@iterator"],typeof a=="function"?a:null)}function n(a,p){a=(a=a.constructor)&&(a.displayName||a.name)||"ReactClass";var m=a+"."+p;Or[m]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",p,a),Or[m]=!0)}function i(a,p,m){this.props=a,this.context=p,this.refs=Dt,this.updater=m||jr}function o(){}function c(a,p,m){this.props=a,this.context=p,this.refs=Dt,this.updater=m||jr}function u(a){return""+a}function l(a){try{u(a);var p=!1}catch{p=!0}if(p){p=console;var m=p.error,R=typeof Symbol=="function"&&Symbol.toStringTag&&a[Symbol.toStringTag]||a.constructor.name||"Object";return m.call(p,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",R),u(a)}}function h(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===Ss?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case Z:return"Fragment";case de:return"Portal";case rt:return"Profiler";case je:return"StrictMode";case w:return"Suspense";case k:return"SuspenseList"}if(typeof a=="object")switch(typeof a.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),a.$$typeof){case Ce:return(a.displayName||"Context")+".Provider";case qe:return(a._context.displayName||"Context")+".Consumer";case Me:var p=a.render;return a=a.displayName,a||(a=p.displayName||p.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case C:return p=a.displayName||null,p!==null?p:h(a.type)||"Memo";case z:p=a._payload,a=a._init;try{return h(a(p))}catch{}}return null}function f(a){return typeof a=="string"||typeof a=="function"||a===Z||a===rt||a===je||a===w||a===k||a===ue||typeof a=="object"&&a!==null&&(a.$$typeof===z||a.$$typeof===C||a.$$typeof===Ce||a.$$typeof===qe||a.$$typeof===Me||a.$$typeof===ks||a.getModuleId!==void 0)}function _(){}function y(){if(nt===0){Cr=console.log,Pr=console.info,$r=console.warn,xr=console.error,Ir=console.group,Dr=console.groupCollapsed,Nr=console.groupEnd;var a={configurable:!0,enumerable:!0,value:_,writable:!0};Object.defineProperties(console,{info:a,log:a,warn:a,error:a,group:a,groupCollapsed:a,groupEnd:a})}nt++}function v(){if(nt--,nt===0){var a={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:me({},a,{value:Cr}),info:me({},a,{value:Pr}),warn:me({},a,{value:$r}),error:me({},a,{value:xr}),group:me({},a,{value:Ir}),groupCollapsed:me({},a,{value:Dr}),groupEnd:me({},a,{value:Nr})})}0>nt&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}function O(a){if(Nt===void 0)try{throw Error()}catch(m){var p=m.stack.trim().match(/\n( *(at )?)/);Nt=p&&p[1]||"",Ur=-1<m.stack.indexOf(`
32
+ at`)?" (<anonymous>)":-1<m.stack.indexOf("@")?"@unknown:0:0":""}return`
33
+ `+Nt+a+Ur}function T(a,p){if(!a||Ut)return"";var m=Lt.get(a);if(m!==void 0)return m;Ut=!0,m=Error.prepareStackTrace,Error.prepareStackTrace=void 0;var R=null;R=W.H,W.H=null,y();try{var P={DetermineComponentFrameRoot:function(){try{if(p){var ve=function(){throw Error()};if(Object.defineProperty(ve.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ve,[])}catch(we){var wt=we}Reflect.construct(a,[],ve)}else{try{ve.call()}catch(we){wt=we}a.call(ve.prototype)}}else{try{throw Error()}catch(we){wt=we}(ve=a())&&typeof ve.catch=="function"&&ve.catch(function(){})}}catch(we){if(we&&wt&&typeof we.stack=="string")return[we.stack,wt.stack]}return[null,null]}};P.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var x=Object.getOwnPropertyDescriptor(P.DetermineComponentFrameRoot,"name");x&&x.configurable&&Object.defineProperty(P.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var $=P.DetermineComponentFrameRoot(),J=$[0],K=$[1];if(J&&K){var ee=J.split(`
34
+ `),ce=K.split(`
35
+ `);for($=x=0;x<ee.length&&!ee[x].includes("DetermineComponentFrameRoot");)x++;for(;$<ce.length&&!ce[$].includes("DetermineComponentFrameRoot");)$++;if(x===ee.length||$===ce.length)for(x=ee.length-1,$=ce.length-1;1<=x&&0<=$&&ee[x]!==ce[$];)$--;for(;1<=x&&0<=$;x--,$--)if(ee[x]!==ce[$]){if(x!==1||$!==1)do if(x--,$--,0>$||ee[x]!==ce[$]){var $e=`
36
+ `+ee[x].replace(" at new "," at ");return a.displayName&&$e.includes("<anonymous>")&&($e=$e.replace("<anonymous>",a.displayName)),typeof a=="function"&&Lt.set(a,$e),$e}while(1<=x&&0<=$);break}}}finally{Ut=!1,W.H=R,v(),Error.prepareStackTrace=m}return ee=(ee=a?a.displayName||a.name:"")?O(ee):"",typeof a=="function"&&Lt.set(a,ee),ee}function j(a){if(a==null)return"";if(typeof a=="function"){var p=a.prototype;return T(a,!(!p||!p.isReactComponent))}if(typeof a=="string")return O(a);switch(a){case w:return O("Suspense");case k:return O("SuspenseList")}if(typeof a=="object")switch(a.$$typeof){case Me:return a=T(a.render,!1),a;case C:return j(a.type);case z:p=a._payload,a=a._init;try{return j(a(p))}catch{}}return""}function D(){var a=W.A;return a===null?null:a.getOwner()}function A(a){if(_t.call(a,"key")){var p=Object.getOwnPropertyDescriptor(a,"key").get;if(p&&p.isReactWarning)return!1}return a.key!==void 0}function U(a,p){function m(){Lr||(Lr=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",p))}m.isReactWarning=!0,Object.defineProperty(a,"key",{get:m,configurable:!0})}function d(){var a=h(this.type);return Mr[a]||(Mr[a]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),a=this.props.ref,a!==void 0?a:null}function b(a,p,m,R,P,x){return m=x.ref,a={$$typeof:M,type:a,key:p,props:x,_owner:P},(m!==void 0?m:null)!==null?Object.defineProperty(a,"ref",{enumerable:!1,get:d}):Object.defineProperty(a,"ref",{enumerable:!1,value:null}),a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(a,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a}function E(a,p){return p=b(a.type,p,void 0,void 0,a._owner,a.props),p._store.validated=a._store.validated,p}function q(a,p){if(typeof a=="object"&&a&&a.$$typeof!==Rs){if(gt(a))for(var m=0;m<a.length;m++){var R=a[m];I(R)&&Y(R,p)}else if(I(a))a._store&&(a._store.validated=1);else if(m=r(a),typeof m=="function"&&m!==a.entries&&(m=m.call(a),m!==a))for(;!(a=m.next()).done;)I(a.value)&&Y(a.value,p)}}function I(a){return typeof a=="object"&&a!==null&&a.$$typeof===M}function Y(a,p){if(a._store&&!a._store.validated&&a.key==null&&(a._store.validated=1,p=he(p),!Br[p])){Br[p]=!0;var m="";a&&a._owner!=null&&a._owner!==D()&&(m=null,typeof a._owner.tag=="number"?m=h(a._owner.type):typeof a._owner.name=="string"&&(m=a._owner.name),m=" It was passed a child from "+m+".");var R=W.getCurrentStack;W.getCurrentStack=function(){var P=j(a.type);return R&&(P+=R()||""),P},console.error('Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.',p,m),W.getCurrentStack=R}}function he(a){var p="",m=D();return m&&(m=h(m.type))&&(p=`
37
+
38
+ Check the render method of \``+m+"`."),p||(a=h(a))&&(p=`
39
+
40
+ Check the top-level render call using <`+a+">."),p}function te(a){var p={"=":"=0",":":"=2"};return"$"+a.replace(/[=:]/g,function(m){return p[m]})}function ae(a,p){return typeof a=="object"&&a!==null&&a.key!=null?(l(a.key),te(""+a.key)):p.toString(36)}function fe(){}function pe(a){switch(a.status){case"fulfilled":return a.value;case"rejected":throw a.reason;default:switch(typeof a.status=="string"?a.then(fe,fe):(a.status="pending",a.then(function(p){a.status==="pending"&&(a.status="fulfilled",a.value=p)},function(p){a.status==="pending"&&(a.status="rejected",a.reason=p)})),a.status){case"fulfilled":return a.value;case"rejected":throw a.reason}}throw a}function oe(a,p,m,R,P){var x=typeof a;(x==="undefined"||x==="boolean")&&(a=null);var $=!1;if(a===null)$=!0;else switch(x){case"bigint":case"string":case"number":$=!0;break;case"object":switch(a.$$typeof){case M:case de:$=!0;break;case z:return $=a._init,oe($(a._payload),p,m,R,P)}}if($){$=a,P=P($);var J=R===""?"."+ae($,0):R;return gt(P)?(m="",J!=null&&(m=J.replace(Wr,"$&/")+"/"),oe(P,p,m,"",function(ee){return ee})):P!=null&&(I(P)&&(P.key!=null&&($&&$.key===P.key||l(P.key)),m=E(P,m+(P.key==null||$&&$.key===P.key?"":(""+P.key).replace(Wr,"$&/")+"/")+J),R!==""&&$!=null&&I($)&&$.key==null&&$._store&&!$._store.validated&&(m._store.validated=2),P=m),p.push(P)),1}if($=0,J=R===""?".":R+":",gt(a))for(var K=0;K<a.length;K++)R=a[K],x=J+ae(R,K),$+=oe(R,p,m,x,P);else if(K=r(a),typeof K=="function")for(K===a.entries&&(Hr||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),Hr=!0),a=K.call(a),K=0;!(R=a.next()).done;)R=R.value,x=J+ae(R,K++),$+=oe(R,p,m,x,P);else if(x==="object"){if(typeof a.then=="function")return oe(pe(a),p,m,R,P);throw p=String(a),Error("Objects are not valid as a React child (found: "+(p==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":p)+"). If you meant to render a collection of children, use an array instead.")}return $}function ge(a,p,m){if(a==null)return a;var R=[],P=0;return oe(a,R,"","",function(x){return p.call(m,x,P++)}),R}function ke(a){if(a._status===-1){var p=a._result;p=p(),p.then(function(m){(a._status===0||a._status===-1)&&(a._status=1,a._result=m)},function(m){(a._status===0||a._status===-1)&&(a._status=2,a._result=m)}),a._status===-1&&(a._status=0,a._result=p)}if(a._status===1)return p=a._result,p===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
41
+
42
+ Your code should look like:
43
+ const MyComponent = lazy(() => import('./MyComponent'))
44
+
45
+ Did you accidentally put curly braces around the import?`,p),"default"in p||console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
46
+
47
+ Your code should look like:
48
+ const MyComponent = lazy(() => import('./MyComponent'))`,p),p.default;throw a._result}function X(){var a=W.H;return a===null&&console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
49
+ 1. You might have mismatching versions of React and the renderer (such as React DOM)
50
+ 2. You might be breaking the Rules of Hooks
51
+ 3. You might have more than one copy of React in the same app
52
+ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),a}function g(){}function S(a){if(yt===null)try{var p=("require"+Math.random()).slice(0,7);yt=(s&&s[p]).call(s,"timers").setImmediate}catch{yt=function(R){Gr===!1&&(Gr=!0,typeof MessageChannel>"u"&&console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var P=new MessageChannel;P.port1.onmessage=R,P.port2.postMessage(void 0)}}return yt(a)}function N(a){return 1<a.length&&typeof AggregateError=="function"?new AggregateError(a):a[0]}function L(a,p){p!==vt-1&&console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),vt=p}function F(a,p,m){var R=W.actQueue;if(R!==null)if(R.length!==0)try{V(R),S(function(){return F(a,p,m)});return}catch(P){W.thrownErrors.push(P)}else W.actQueue=null;0<W.thrownErrors.length?(R=N(W.thrownErrors),W.thrownErrors.length=0,m(R)):p(a)}function V(a){if(!qt){qt=!0;var p=0;try{for(;p<a.length;p++){var m=a[p];do{W.didUsePromise=!1;var R=m(!1);if(R!==null){if(W.didUsePromise){a[p]=m,a.splice(0,p);return}m=R}else break}while(!0)}a.length=0}catch(P){a.splice(0,p+1),W.thrownErrors.push(P)}finally{qt=!1}}}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var M=Symbol.for("react.transitional.element"),de=Symbol.for("react.portal"),Z=Symbol.for("react.fragment"),je=Symbol.for("react.strict_mode"),rt=Symbol.for("react.profiler"),qe=Symbol.for("react.consumer"),Ce=Symbol.for("react.context"),Me=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),C=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),ue=Symbol.for("react.offscreen"),ie=Symbol.iterator,Or={},jr={isMounted:function(){return!1},enqueueForceUpdate:function(a){n(a,"forceUpdate")},enqueueReplaceState:function(a){n(a,"replaceState")},enqueueSetState:function(a){n(a,"setState")}},me=Object.assign,Dt={};Object.freeze(Dt),i.prototype.isReactComponent={},i.prototype.setState=function(a,p){if(typeof a!="object"&&typeof a!="function"&&a!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,a,p,"setState")},i.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate")};var Pe={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]},pt;for(pt in Pe)Pe.hasOwnProperty(pt)&&t(pt,Pe[pt]);o.prototype=i.prototype,Pe=c.prototype=new o,Pe.constructor=c,me(Pe,i.prototype),Pe.isPureReactComponent=!0;var gt=Array.isArray,Ss=Symbol.for("react.client.reference"),W={H:null,A:null,T:null,S:null,actQueue:null,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1,didUsePromise:!1,thrownErrors:[],getCurrentStack:null},_t=Object.prototype.hasOwnProperty,ks=Symbol.for("react.client.reference"),nt=0,Cr,Pr,$r,xr,Ir,Dr,Nr;_.__reactDisabledLog=!0;var Nt,Ur,Ut=!1,Lt=new(typeof WeakMap=="function"?WeakMap:Map),Rs=Symbol.for("react.client.reference"),Lr,qr,Mr={},Br={},Hr=!1,Wr=/\/+/g,Fr=typeof reportError=="function"?reportError:function(a){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var p=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof a=="object"&&a!==null&&typeof a.message=="string"?String(a.message):String(a),error:a});if(!window.dispatchEvent(p))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",a);return}console.error(a)},Gr=!1,yt=null,vt=0,mt=!1,qt=!1,zr=typeof queueMicrotask=="function"?function(a){queueMicrotask(function(){return queueMicrotask(a)})}:S;e.Children={map:ge,forEach:function(a,p,m){ge(a,function(){p.apply(this,arguments)},m)},count:function(a){var p=0;return ge(a,function(){p++}),p},toArray:function(a){return ge(a,function(p){return p})||[]},only:function(a){if(!I(a))throw Error("React.Children.only expected to receive a single React element child.");return a}},e.Component=i,e.Fragment=Z,e.Profiler=rt,e.PureComponent=c,e.StrictMode=je,e.Suspense=w,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=W,e.act=function(a){var p=W.actQueue,m=vt;vt++;var R=W.actQueue=p!==null?p:[],P=!1;try{var x=a()}catch(K){W.thrownErrors.push(K)}if(0<W.thrownErrors.length)throw L(p,m),a=N(W.thrownErrors),W.thrownErrors.length=0,a;if(x!==null&&typeof x=="object"&&typeof x.then=="function"){var $=x;return zr(function(){P||mt||(mt=!0,console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),{then:function(K,ee){P=!0,$.then(function(ce){if(L(p,m),m===0){try{V(R),S(function(){return F(ce,K,ee)})}catch(ve){W.thrownErrors.push(ve)}if(0<W.thrownErrors.length){var $e=N(W.thrownErrors);W.thrownErrors.length=0,ee($e)}}else K(ce)},function(ce){L(p,m),0<W.thrownErrors.length&&(ce=N(W.thrownErrors),W.thrownErrors.length=0),ee(ce)})}}}var J=x;if(L(p,m),m===0&&(V(R),R.length!==0&&zr(function(){P||mt||(mt=!0,console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"))}),W.actQueue=null),0<W.thrownErrors.length)throw a=N(W.thrownErrors),W.thrownErrors.length=0,a;return{then:function(K,ee){P=!0,m===0?(W.actQueue=R,S(function(){return F(J,K,ee)})):K(J)}}},e.cache=function(a){return function(){return a.apply(null,arguments)}},e.cloneElement=function(a,p,m){if(a==null)throw Error("The argument must be a React element, but you passed "+a+".");var R=me({},a.props),P=a.key,x=a._owner;if(p!=null){var $;e:{if(_t.call(p,"ref")&&($=Object.getOwnPropertyDescriptor(p,"ref").get)&&$.isReactWarning){$=!1;break e}$=p.ref!==void 0}$&&(x=D()),A(p)&&(l(p.key),P=""+p.key);for(J in p)!_t.call(p,J)||J==="key"||J==="__self"||J==="__source"||J==="ref"&&p.ref===void 0||(R[J]=p[J])}var J=arguments.length-2;if(J===1)R.children=m;else if(1<J){$=Array(J);for(var K=0;K<J;K++)$[K]=arguments[K+2];R.children=$}for(R=b(a.type,P,void 0,void 0,x,R),P=2;P<arguments.length;P++)q(arguments[P],R.type);return R},e.createContext=function(a){return a={$$typeof:Ce,_currentValue:a,_currentValue2:a,_threadCount:0,Provider:null,Consumer:null},a.Provider=a,a.Consumer={$$typeof:qe,_context:a},a._currentRenderer=null,a._currentRenderer2=null,a},e.createElement=function(a,p,m){if(f(a))for(var R=2;R<arguments.length;R++)q(arguments[R],a);else{if(R="",(a===void 0||typeof a=="object"&&a!==null&&Object.keys(a).length===0)&&(R+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),a===null)var P="null";else gt(a)?P="array":a!==void 0&&a.$$typeof===M?(P="<"+(h(a.type)||"Unknown")+" />",R=" Did you accidentally export a JSX literal instead of a component?"):P=typeof a;console.error("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",P,R)}var x;if(R={},P=null,p!=null)for(x in qr||!("__self"in p)||"key"in p||(qr=!0,console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")),A(p)&&(l(p.key),P=""+p.key),p)_t.call(p,x)&&x!=="key"&&x!=="__self"&&x!=="__source"&&(R[x]=p[x]);var $=arguments.length-2;if($===1)R.children=m;else if(1<$){for(var J=Array($),K=0;K<$;K++)J[K]=arguments[K+2];Object.freeze&&Object.freeze(J),R.children=J}if(a&&a.defaultProps)for(x in $=a.defaultProps,$)R[x]===void 0&&(R[x]=$[x]);return P&&U(R,typeof a=="function"?a.displayName||a.name||"Unknown":a),b(a,P,void 0,void 0,D(),R)},e.createRef=function(){var a={current:null};return Object.seal(a),a},e.forwardRef=function(a){a!=null&&a.$$typeof===C?console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof a!="function"?console.error("forwardRef requires a render function but was given %s.",a===null?"null":typeof a):a.length!==0&&a.length!==2&&console.error("forwardRef render functions accept exactly two parameters: props and ref. %s",a.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),a!=null&&a.defaultProps!=null&&console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");var p={$$typeof:Me,render:a},m;return Object.defineProperty(p,"displayName",{enumerable:!1,configurable:!0,get:function(){return m},set:function(R){m=R,a.name||a.displayName||(Object.defineProperty(a,"name",{value:R}),a.displayName=R)}}),p},e.isValidElement=I,e.lazy=function(a){return{$$typeof:z,_payload:{_status:-1,_result:a},_init:ke}},e.memo=function(a,p){f(a)||console.error("memo: The first argument must be a component. Instead received: %s",a===null?"null":typeof a),p={$$typeof:C,type:a,compare:p===void 0?null:p};var m;return Object.defineProperty(p,"displayName",{enumerable:!1,configurable:!0,get:function(){return m},set:function(R){m=R,a.name||a.displayName||(Object.defineProperty(a,"name",{value:R}),a.displayName=R)}}),p},e.startTransition=function(a){var p=W.T,m={};W.T=m,m._updatedFibers=new Set;try{var R=a(),P=W.S;P!==null&&P(m,R),typeof R=="object"&&R!==null&&typeof R.then=="function"&&R.then(g,Fr)}catch(x){Fr(x)}finally{p===null&&m._updatedFibers&&(a=m._updatedFibers.size,m._updatedFibers.clear(),10<a&&console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")),W.T=p}},e.unstable_useCacheRefresh=function(){return X().useCacheRefresh()},e.use=function(a){return X().use(a)},e.useActionState=function(a,p,m){return X().useActionState(a,p,m)},e.useCallback=function(a,p){return X().useCallback(a,p)},e.useContext=function(a){var p=X();return a.$$typeof===qe&&console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"),p.useContext(a)},e.useDebugValue=function(a,p){return X().useDebugValue(a,p)},e.useDeferredValue=function(a,p){return X().useDeferredValue(a,p)},e.useEffect=function(a,p){return X().useEffect(a,p)},e.useId=function(){return X().useId()},e.useImperativeHandle=function(a,p,m){return X().useImperativeHandle(a,p,m)},e.useInsertionEffect=function(a,p){return X().useInsertionEffect(a,p)},e.useLayoutEffect=function(a,p){return X().useLayoutEffect(a,p)},e.useMemo=function(a,p){return X().useMemo(a,p)},e.useOptimistic=function(a,p){return X().useOptimistic(a,p)},e.useReducer=function(a,p,m){return X().useReducer(a,p,m)},e.useRef=function(a){return X().useRef(a)},e.useState=function(a){return X().useState(a)},e.useSyncExternalStore=function(a,p,m){return X().useSyncExternalStore(a,p,m)},e.useTransition=function(){return X().useTransition()},e.version="19.0.0",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()}(ut,ut.exports)),ut.exports}var Nn;function ms(){return Nn||(Nn=1,process.env.NODE_ENV==="production"?At.exports=Fo():At.exports=Go()),At.exports}var Ot={exports:{}},Un;function ws(){return Un||(Un=1,function(s,e){Object.defineProperty(e,"__esModule",{value:!0});function t(o,c){for(var u in c)Object.defineProperty(o,u,{enumerable:!0,get:c[u]})}t(e,{DynamicServerError:function(){return n},isDynamicServerError:function(){return i}});const r="DYNAMIC_SERVER_USAGE";class n extends Error{constructor(c){super("Dynamic server usage: "+c),this.description=c,this.digest=r}}function i(o){return typeof o!="object"||o===null||!("digest"in o)||typeof o.digest!="string"?!1:o.digest===r}(typeof e.default=="function"||typeof e.default=="object"&&e.default!==null)&&typeof e.default.__esModule>"u"&&(Object.defineProperty(e.default,"__esModule",{value:!0}),Object.assign(e.default,e),s.exports=e.default)}(Ot,Ot.exports)),Ot.exports}var jt={exports:{}},Ln;function Ar(){return Ln||(Ln=1,function(s,e){Object.defineProperty(e,"__esModule",{value:!0});function t(o,c){for(var u in c)Object.defineProperty(o,u,{enumerable:!0,get:c[u]})}t(e,{StaticGenBailoutError:function(){return n},isStaticGenBailoutError:function(){return i}});const r="NEXT_STATIC_GEN_BAILOUT";class n extends Error{constructor(...c){super(...c),this.code=r}}function i(o){return typeof o!="object"||o===null||!("code"in o)?!1:o.code===r}(typeof e.default=="function"||typeof e.default=="object"&&e.default!==null)&&typeof e.default.__esModule>"u"&&(Object.defineProperty(e.default,"__esModule",{value:!0}),Object.assign(e.default,e),s.exports=e.default)}(jt,jt.exports)),jt.exports}var rr={},qn;function bs(){return qn||(qn=1,function(s){Object.defineProperty(s,"__esModule",{value:!0});function e(u,l){for(var h in l)Object.defineProperty(u,h,{enumerable:!0,get:l[h]})}e(s,{isHangingPromiseRejectionError:function(){return t},makeHangingPromise:function(){return o}});function t(u){return typeof u!="object"||u===null||!("digest"in u)?!1:u.digest===r}const r="HANGING_PROMISE_REJECTION";class n extends Error{constructor(l){super(`During prerendering, ${l} rejects when the prerender is complete. Typically these errors are handled by React but if you move ${l} to a different context by using \`setTimeout\`, \`after\`, or similar functions you may observe this error and you should handle it in that context.`),this.expression=l,this.digest=r}}const i=new WeakMap;function o(u,l){if(u.aborted)return Promise.reject(new n(l));{const h=new Promise((f,_)=>{const y=_.bind(null,new n(l));let v=i.get(u);if(v)v.push(y);else{const O=[y];i.set(u,O),u.addEventListener("abort",()=>{for(let T=0;T<O.length;T++)O[T]()},{once:!0})}});return h.catch(c),h}}function c(){}}(rr)),rr}var nr={},Mn;function zo(){return Mn||(Mn=1,function(s){Object.defineProperty(s,"__esModule",{value:!0});function e(i,o){for(var c in o)Object.defineProperty(i,c,{enumerable:!0,get:o[c]})}e(s,{METADATA_BOUNDARY_NAME:function(){return t},OUTLET_BOUNDARY_NAME:function(){return n},VIEWPORT_BOUNDARY_NAME:function(){return r}});const t="__next_metadata_boundary__",r="__next_viewport_boundary__",n="__next_outlet_boundary__"}(nr)),nr}var sr={},Bn;function Es(){return Bn||(Bn=1,function(s){Object.defineProperty(s,"__esModule",{value:!0});function e(o,c){for(var u in c)Object.defineProperty(o,u,{enumerable:!0,get:c[u]})}e(s,{atLeastOneTask:function(){return n},scheduleImmediate:function(){return r},scheduleOnNextTick:function(){return t},waitAtLeastOneReactRenderTask:function(){return i}});const t=o=>{Promise.resolve().then(()=>{process.env.NEXT_RUNTIME==="edge"?setTimeout(o,0):process.nextTick(o)})},r=o=>{process.env.NEXT_RUNTIME==="edge"?setTimeout(o,0):setImmediate(o)};function n(){return new Promise(o=>r(o))}function i(){return process.env.NEXT_RUNTIME==="edge"?new Promise(o=>setTimeout(o,0)):new Promise(o=>setImmediate(o))}}(sr)),sr}var Hn;function Ko(){return Hn||(Hn=1,function(s){Object.defineProperty(s,"__esModule",{value:!0});function e(w,k){for(var C in k)Object.defineProperty(w,C,{enumerable:!0,get:k[C]})}e(s,{Postpone:function(){return q},PreludeState:function(){return qe},abortAndThrowOnSynchronousRequestDataAccess:function(){return b},abortOnSynchronousPlatformIOAccess:function(){return U},accessedDynamicData:function(){return oe},annotateDynamicAccess:function(){return N},consumeDynamicAccess:function(){return ge},createDynamicTrackingState:function(){return _},createDynamicValidationState:function(){return y},createHangingInputAbortSignal:function(){return S},createPostponedAbortSignal:function(){return g},formatDynamicAPIAccesses:function(){return ke},getFirstDynamicReason:function(){return v},isDynamicPostpone:function(){return he},isPrerenderInterruptedError:function(){return pe},markCurrentScopeAsDynamic:function(){return O},postponeWithTracking:function(){return I},throwIfDisallowedDynamic:function(){return Me},throwToInterruptStaticGeneration:function(){return j},trackAllowedDynamicAccess:function(){return je},trackDynamicDataInDynamicRender:function(){return D},trackFallbackParamAccessed:function(){return T},trackSynchronousPlatformIOAccessInDev:function(){return d},trackSynchronousRequestDataAccessInDev:function(){return E},useDynamicRouteParams:function(){return L}});const t=h(ms()),r=ws(),n=Ar(),i=vs(),o=ys(),c=bs(),u=zo(),l=Es();function h(w){return w&&w.__esModule?w:{default:w}}const f=typeof t.default.unstable_postpone=="function";function _(w){return{isDebugDynamicAccesses:w,dynamicAccesses:[],syncDynamicErrorWithStack:null}}function y(){return{hasSuspenseAboveBody:!1,hasDynamicMetadata:!1,hasDynamicViewport:!1,hasAllowedDynamic:!1,dynamicErrors:[]}}function v(w){var k;return(k=w.dynamicAccesses[0])==null?void 0:k.expression}function O(w,k,C){if(!(k&&(k.type==="cache"||k.type==="unstable-cache"))&&!(w.forceDynamic||w.forceStatic)){if(w.dynamicShouldError)throw Object.defineProperty(new n.StaticGenBailoutError(`Route ${w.route} with \`dynamic = "error"\` couldn't be rendered statically because it used \`${C}\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`),"__NEXT_ERROR_CODE",{value:"E553",enumerable:!1,configurable:!0});if(k)if(k.type==="prerender-ppr")I(w.route,C,k.dynamicTracking);else if(k.type==="prerender-legacy"){k.revalidate=0;const z=Object.defineProperty(new r.DynamicServerError(`Route ${w.route} couldn't be rendered statically because it used ${C}. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`),"__NEXT_ERROR_CODE",{value:"E550",enumerable:!1,configurable:!0});throw w.dynamicUsageDescription=C,w.dynamicUsageStack=z.stack,z}else process.env.NODE_ENV==="development"&&k&&k.type==="request"&&(k.usedDynamic=!0)}}function T(w,k){const C=i.workUnitAsyncStorage.getStore();!C||C.type!=="prerender-ppr"||I(w.route,k,C.dynamicTracking)}function j(w,k,C){const z=Object.defineProperty(new r.DynamicServerError(`Route ${k.route} couldn't be rendered statically because it used \`${w}\`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`),"__NEXT_ERROR_CODE",{value:"E558",enumerable:!1,configurable:!0});throw C.revalidate=0,k.dynamicUsageDescription=w,k.dynamicUsageStack=z.stack,z}function D(w,k){if(k){if(k.type==="cache"||k.type==="unstable-cache")return;(k.type==="prerender"||k.type==="prerender-client"||k.type==="prerender-legacy")&&(k.revalidate=0),process.env.NODE_ENV==="development"&&k.type==="request"&&(k.usedDynamic=!0)}}function A(w,k,C){const z=`Route ${w} needs to bail out of prerendering at this point because it used ${k}.`,ue=fe(z);C.controller.abort(ue);const ie=C.dynamicTracking;ie&&ie.dynamicAccesses.push({stack:ie.isDebugDynamicAccesses?new Error().stack:void 0,expression:k})}function U(w,k,C,z){const ue=z.dynamicTracking;A(w,k,z),ue&&ue.syncDynamicErrorWithStack===null&&(ue.syncDynamicErrorWithStack=C)}function d(w){w.prerenderPhase=!1}function b(w,k,C,z){if(z.controller.signal.aborted===!1){A(w,k,z);const ie=z.dynamicTracking;ie&&ie.syncDynamicErrorWithStack===null&&(ie.syncDynamicErrorWithStack=C)}throw fe(`Route ${w} needs to bail out of prerendering at this point because it used ${k}.`)}const E=d;function q({reason:w,route:k}){const C=i.workUnitAsyncStorage.getStore(),z=C&&C.type==="prerender-ppr"?C.dynamicTracking:null;I(k,w,z)}function I(w,k,C){X(),C&&C.dynamicAccesses.push({stack:C.isDebugDynamicAccesses?new Error().stack:void 0,expression:k}),t.default.unstable_postpone(Y(w,k))}function Y(w,k){return`Route ${w} needs to bail out of prerendering at this point because it used ${k}. React throws this special object to indicate where. It should not be caught by your own try/catch. Learn more: https://nextjs.org/docs/messages/ppr-caught-error`}function he(w){return typeof w=="object"&&w!==null&&typeof w.message=="string"?te(w.message):!1}function te(w){return w.includes("needs to bail out of prerendering at this point because it used")&&w.includes("Learn more: https://nextjs.org/docs/messages/ppr-caught-error")}if(te(Y("%%%","^^^"))===!1)throw Object.defineProperty(new Error("Invariant: isDynamicPostpone misidentified a postpone reason. This is a bug in Next.js"),"__NEXT_ERROR_CODE",{value:"E296",enumerable:!1,configurable:!0});const ae="NEXT_PRERENDER_INTERRUPTED";function fe(w){const k=Object.defineProperty(new Error(w),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return k.digest=ae,k}function pe(w){return typeof w=="object"&&w!==null&&w.digest===ae&&"name"in w&&"message"in w&&w instanceof Error}function oe(w){return w.length>0}function ge(w,k){return w.dynamicAccesses.push(...k.dynamicAccesses),w.dynamicAccesses}function ke(w){return w.filter(k=>typeof k.stack=="string"&&k.stack.length>0).map(({expression:k,stack:C})=>(C=C.split(`
53
+ `).slice(4).filter(z=>!(z.includes("node_modules/next/")||z.includes(" (<anonymous>)")||z.includes(" (node:"))).join(`
54
+ `),`Dynamic API Usage Debug - ${k}:
55
+ ${C}`))}function X(){if(!f)throw Object.defineProperty(new Error("Invariant: React.unstable_postpone is not defined. This suggests the wrong version of React was loaded. This is a bug in Next.js"),"__NEXT_ERROR_CODE",{value:"E224",enumerable:!1,configurable:!0})}function g(w){X();const k=new AbortController;try{t.default.unstable_postpone(w)}catch(C){k.abort(C)}return k.signal}function S(w){const k=new AbortController;return w.cacheSignal?w.cacheSignal.inputReady().then(()=>{k.abort()}):(0,l.scheduleOnNextTick)(()=>k.abort()),k.signal}function N(w,k){const C=k.dynamicTracking;C&&C.dynamicAccesses.push({stack:C.isDebugDynamicAccesses?new Error().stack:void 0,expression:w})}function L(w){const k=o.workAsyncStorage.getStore();if(k&&k.isStaticGeneration&&k.fallbackRouteParams&&k.fallbackRouteParams.size>0){const C=i.workUnitAsyncStorage.getStore();C&&(C.type==="prerender-client"?t.default.use((0,c.makeHangingPromise)(C.renderSignal,w)):C.type==="prerender-ppr"?I(k.route,w,C.dynamicTracking):C.type==="prerender-legacy"&&j(w,k,C))}}const F=/\n\s+at Suspense \(<anonymous>\)/,V=/\n\s+at (?:body|html) \(<anonymous>\)[\s\S]*?\n\s+at Suspense \(<anonymous>\)/,M=new RegExp(`\\n\\s+at ${u.METADATA_BOUNDARY_NAME}[\\n\\s]`),de=new RegExp(`\\n\\s+at ${u.VIEWPORT_BOUNDARY_NAME}[\\n\\s]`),Z=new RegExp(`\\n\\s+at ${u.OUTLET_BOUNDARY_NAME}[\\n\\s]`);function je(w,k,C,z){if(!Z.test(k))if(M.test(k)){C.hasDynamicMetadata=!0;return}else if(de.test(k)){C.hasDynamicViewport=!0;return}else if(V.test(k)){C.hasAllowedDynamic=!0,C.hasSuspenseAboveBody=!0;return}else if(F.test(k)){C.hasAllowedDynamic=!0;return}else if(z.syncDynamicErrorWithStack){C.dynamicErrors.push(z.syncDynamicErrorWithStack);return}else{const ue=`Route "${w.route}": A component accessed data, headers, params, searchParams, or a short-lived cache without a Suspense boundary nor a "use cache" above it. See more info: https://nextjs.org/docs/messages/next-prerender-missing-suspense`,ie=rt(ue,k);C.dynamicErrors.push(ie);return}}function rt(w,k){const C=process.env.NODE_ENV!=="production"&&t.default.captureOwnerStack?t.default.captureOwnerStack():null,z=Object.defineProperty(new Error(w),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return z.stack=z.name+": "+w+(C??k),z}var qe=function(w){return w[w.Full=0]="Full",w[w.Empty=1]="Empty",w[w.Errored=2]="Errored",w}({});function Ce(w,k){console.error(k),w.dev||(w.hasReadableErrorStacks?console.error(`To get a more detailed stack trace and pinpoint the issue, start the app in development mode by running \`next dev\`, then open "${w.route}" in your browser to investigate the error.`):console.error(`To get a more detailed stack trace and pinpoint the issue, try one of the following:
56
+ - Start the app in development mode by running \`next dev\`, then open "${w.route}" in your browser to investigate the error.
57
+ - Rerun the production build with \`next build --debug-prerender\` to generate better stack traces.`))}function Me(w,k,C,z){if(w.invalidDynamicUsageError)throw Ce(w,w.invalidDynamicUsageError),new n.StaticGenBailoutError;if(k!==0){if(C.hasSuspenseAboveBody)return;if(z.syncDynamicErrorWithStack)throw Ce(w,z.syncDynamicErrorWithStack),new n.StaticGenBailoutError;const ue=C.dynamicErrors;if(ue.length>0){for(let ie=0;ie<ue.length;ie++)Ce(w,ue[ie]);throw new n.StaticGenBailoutError}if(C.hasDynamicViewport)throw console.error(`Route "${w.route}" has a \`generateViewport\` that depends on Request data (\`cookies()\`, etc...) or uncached external data (\`fetch(...)\`, etc...) without explicitly allowing fully dynamic rendering. See more info here: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport`),new n.StaticGenBailoutError;if(k===1)throw console.error(`Route "${w.route}" did not produce a static shell and Next.js was unable to determine a reason. This is a bug in Next.js.`),new n.StaticGenBailoutError}else if(C.hasAllowedDynamic===!1&&C.hasDynamicMetadata)throw console.error(`Route "${w.route}" has a \`generateMetadata\` that depends on Request data (\`cookies()\`, etc...) or uncached external data (\`fetch(...)\`, etc...) when the rest of the route does not. See more info here: https://nextjs.org/docs/messages/next-prerender-dynamic-metadata`),new n.StaticGenBailoutError}}(tr)),tr}var ir={},or={},ar={},Wn;function Jo(){return Wn||(Wn=1,function(s){Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"afterTaskAsyncStorageInstance",{enumerable:!0,get:function(){return t}});const t=(0,Tr().createAsyncLocalStorage)()}(ar)),ar}var Fn;function Yo(){return Fn||(Fn=1,function(s){Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"afterTaskAsyncStorage",{enumerable:!0,get:function(){return e.afterTaskAsyncStorageInstance}});const e=Jo()}(or)),or}var Gn;function Vo(){return Gn||(Gn=1,function(s){Object.defineProperty(s,"__esModule",{value:!0});function e(u,l){for(var h in l)Object.defineProperty(u,h,{enumerable:!0,get:l[h]})}e(s,{isRequestAPICallableInsideAfter:function(){return c},throwForSearchParamsAccessInUseCache:function(){return o},throwWithStaticGenerationBailoutError:function(){return n},throwWithStaticGenerationBailoutErrorWithDynamicError:function(){return i}});const t=Ar(),r=Yo();function n(u,l){throw Object.defineProperty(new t.StaticGenBailoutError(`Route ${u} couldn't be rendered statically because it used ${l}. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`),"__NEXT_ERROR_CODE",{value:"E576",enumerable:!1,configurable:!0})}function i(u,l){throw Object.defineProperty(new t.StaticGenBailoutError(`Route ${u} with \`dynamic = "error"\` couldn't be rendered statically because it used ${l}. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`),"__NEXT_ERROR_CODE",{value:"E543",enumerable:!1,configurable:!0})}function o(u,l){const h=Object.defineProperty(new Error(`Route ${u.route} used "searchParams" inside "use cache". Accessing Dynamic data sources inside a cache scope is not supported. If you need this data inside a cached function use "searchParams" outside of the cached function and pass the required dynamic data in as an argument. See more info here: https://nextjs.org/docs/messages/next-request-in-use-cache`),"__NEXT_ERROR_CODE",{value:"E634",enumerable:!1,configurable:!0});throw Error.captureStackTrace(h,l),u.invalidDynamicUsageError??(u.invalidDynamicUsageError=h),h}function c(){const u=r.afterTaskAsyncStorage.getStore();return(u==null?void 0:u.rootTaskSpawnPhase)==="action"}}(ir)),ir}var ur={},zn;function Xo(){return zn||(zn=1,function(s){Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"InvariantError",{enumerable:!0,get:function(){return e}});class e extends Error{constructor(r,n){super("Invariant: "+(r.endsWith(".")?r:r+".")+" This is a bug in Next.js.",n),this.name="InvariantError"}}}(ur)),ur}exports.VERSION=ds;exports.createClient=hs;exports.createServerClient=Uo;exports.createStorageFromOptions=gs;exports.isBrowser=wr;exports.requireCookies=qo;exports.requireDynamicRendering=Ko;exports.requireDynamicRenderingUtils=bs;exports.requireHooksServerContext=ws;exports.requireInvariantError=Xo;exports.requireReact=ms;exports.requireReflect=Mo;exports.requireScheduler=Es;exports.requireStaticGenerationBailout=Ar;exports.requireUtils=Vo;exports.requireWorkAsyncStorage_external=ys;exports.requireWorkUnitAsyncStorage_external=vs;