PageSourceSearch

https://www.lectio.one/_next/static/chunks/44dcf666d1c36271.js?dpl=dpl_F4VQaXf1GqnNshtyM1xSi1WMnUFf

js lectio.one collected 2026-10-02 00:39:02 UTC 232,718 bytes, 1 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,154385,(e,t,r)=>{"use strict";var n=e.r(507655),s=e.r(995075),i=e.r(887502),a=e.r(302623);Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){function t(e){var r;return s._(this,t),(r=n._(this,t,[e.message])).name="PostgrestError",r.details=e.details,r.hint=e.hint,r.code=e.code,r}return i._(t,e),t}(a._(Error))},343173,(e,t,r)=>{"use strict";var n=e.r(986172),s=e.r(995075),i=e.r(882372),a=e.r(221280),o=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});var u=o(e.r(906085)),c=o(e.r(154385));r.default=function(){function e(t){var r,n;s._(this,e),this.shouldThrowOnError=!1,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=null!=(r=t.shouldThrowOnError)&&r,this.signal=t.signal,this.isMaybeSingle=null!=(n=t.isMaybeSingle)&&n,t.fetch?this.fetch=t.fetch:"u"<typeof fetch?this.fetch=u.default:this.fetch=fetch}return i._(e,[{key:"throwOnError",value:function(){return this.shouldThrowOnError=!0,this}},{key:"setHeader",value:function(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}},{key:"then",value:function(e,t){var r=this;void 0===this.schema||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),"GET"!==this.method&&"HEAD"!==this.method&&this.headers.set("Content-Type","application/json");var s=(0,this.fetch)(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(function(e){return n._(function(){var t,r,n,s,i,o,u,l,h,f,d,p,v;return a._(this,function(a){switch(a.label){case 0:if(i=null,o=null,u=null,l=e.status,h=e.statusText,!e.ok)return[3,3];if("HEAD"===this.method)return[3,2];return[4,e.text()];case 1:""===(f=a.sent())||(o="text/csv"===this.headers.get("Accept")||this.headers.get("Accept")&&(null==(t=this.headers.get("Accept"))?void 0:t.includes("application/vnd.pgrst.plan+text"))?f:JSON.parse(f)),a.label=2;case 2:return d=null==(r=this.headers.get("Prefer"))?void 0:r.match(/count=(exact|planned|estimated)/),p=null==(n=e.headers.get("content-range"))?void 0:n.split("/"),d&&p&&p.length>1&&(u=parseInt(p[1])),this.isMaybeSingle&&"GET"===this.method&&Array.isArray(o)&&(o.length>1?(i={code:"PGRST116",details:"Results contain ".concat(o.length," rows, application/vnd.pgrst.object+json requires 1 row"),hint:null,message:"JSON object requested, multiple (or no) rows returned"},o=null,u=null,l=406,h="Not Acceptable"):o=1===o.length?o[0]:null),[3,5];case 3:return[4,e.text()];case 4:v=a.sent();try{i=JSON.parse(v),Array.isArray(i)&&404===e.status&&(o=[],i=null,l=200,h="OK")}catch(t){404===e.status&&""===v?(l=204,h="No Content"):i={message:v}}if(i&&this.isMaybeSingle&&(null==(s=null==i?void 0:i.details)?void 0:s.includes("0 rows"))&&(i=null,l=200,h="OK"),i&&this.shouldThrowOnError)throw new c.default(i);a.label=5;case 5:return[2,{error:i,data:o,count:u,status:l,statusText:h}]}})}).call(r)});return this.shouldThrowOnError||(s=s.catch(function(e){var t,r,n;return{error:{message:"".concat(null!=(t=null==e?void 0:e.name)?t:"FetchError",": ").concat(null==e?void 0:e.message),details:"".concat(null!=(r=null==e?void 0:e.stack)?r:""),hint:"",code:"".concat(null!=(n=null==e?void 0:e.code)?n:"")},data:null,count:null,status:0,statusText:""}})),s.then(e,t)}},{key:"returns",value:function(){return this}},{key:"overrideTypes",value:function(){return this}}]),e}()},782191,(e,t,r)=>{"use strict";var n=e.r(507655),s=e.r(995075),i=e.r(882372),a=e.r(887502),o=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){function t(){return s._(this,t),n._(this,t,arguments)}return a._(t,e),i._(t,[{key:"select",value:function(e){var t=!1,r=(null!=e?e:"*").split("").map(function(e){return/\s/.test(e)&&!t?"":('"'===e&&(t=!t),e)}).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}},{key:"order",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.ascending,n=t.nullsFirst,s=t.foreignTable,i=t.referencedTable,a=void 0===i?s:i,o=a?"".concat(a,".order"):"order",u=this.url.searchParams.get(o);return this.url.searchParams.set(o,"".concat(u?"".concat(u,","):"").concat(e,".").concat(void 0===r||r?"asc":"desc").concat(void 0===n?"":n?".nullsfirst":".nullslast")),this}},{key:"limit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.foreignTable,n=t.referencedTable,s=void 0===n?r:n;return this.url.searchParams.set(void 0===s?"limit":"".concat(s,".limit"),"".concat(e)),this}},{key:"range",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.foreignTable,s=r.referencedTable,i=void 0===s?n:s,a=void 0===i?"offset":"".concat(i,".offset"),o=void 0===i?"limit":"".concat(i,".limit");return this.url.searchParams.set(a,"".concat(e)),this.url.searchParams.set(o,"".concat(t-e+1)),this}},{key:"abortSignal",value:function(e){return this.signal=e,this}},{key:"single",value:function(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}},{key:"maybeSingle",value:function(){return"GET"===this.method?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}},{key:"csv",value:function(){return this.headers.set("Accept","text/csv"),this}},{key:"geojson",value:function(){return this.headers.set("Accept","application/geo+json"),this}},{key:"explain",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.analyze,n=t.verbose,s=t.settings,i=t.buffers,a=t.wal,o=t.format,u=void 0===o?"text":o,c=[void 0!==r&&r?"analyze":null,void 0!==n&&n?"verbose":null,void 0!==s&&s?"settings":null,void 0!==i&&i?"buffers":null,void 0!==a&&a?"wal":null].filter(
1Boolean).join("|"),l=null!=(e=this.headers.get("Accept"))?e:"application/json";return this.headers.set("Accept","application/vnd.pgrst.plan+".concat(u,'; for="').concat(l,'"; options=').concat(c,";")),this}},{key:"rollback",value:function(){return this.headers.append("Prefer","tx=rollback"),this}},{key:"returns",value:function(){return this}},{key:"maxAffected",value:function(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer","max-affected=".concat(e)),this}}]),t}(o(e.r(343173)).default)},714633,(e,t,r)=>{"use strict";var n=e.r(507655),s=e.r(995075),i=e.r(882372),a=e.r(887502),o=e.r(891470),u=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){function t(){return s._(this,t),n._(this,t,arguments)}return a._(t,e),i._(t,[{key:"eq",value:function(e,t){return this.url.searchParams.append(e,"eq.".concat(t)),this}},{key:"neq",value:function(e,t){return this.url.searchParams.append(e,"neq.".concat(t)),this}},{key:"gt",value:function(e,t){return this.url.searchParams.append(e,"gt.".concat(t)),this}},{key:"gte",value:function(e,t){return this.url.searchParams.append(e,"gte.".concat(t)),this}},{key:"lt",value:function(e,t){return this.url.searchParams.append(e,"lt.".concat(t)),this}},{key:"lte",value:function(e,t){return this.url.searchParams.append(e,"lte.".concat(t)),this}},{key:"like",value:function(e,t){return this.url.searchParams.append(e,"like.".concat(t)),this}},{key:"likeAllOf",value:function(e,t){return this.url.searchParams.append(e,"like(all).{".concat(t.join(","),"}")),this}},{key:"likeAnyOf",value:function(e,t){return this.url.searchParams.append(e,"like(any).{".concat(t.join(","),"}")),this}},{key:"ilike",value:function(e,t){return this.url.searchParams.append(e,"ilike.".concat(t)),this}},{key:"ilikeAllOf",value:function(e,t){return this.url.searchParams.append(e,"ilike(all).{".concat(t.join(","),"}")),this}},{key:"ilikeAnyOf",value:function(e,t){return this.url.searchParams.append(e,"ilike(any).{".concat(t.join(","),"}")),this}},{key:"is",value:function(e,t){return this.url.searchParams.append(e,"is.".concat(t)),this}},{key:"in",value:function(e,t){var r=Array.from(new Set(t)).map(function(e){return"string"==typeof e&&RegExp("[,()]").test(e)?'"'.concat(e,'"'):"".concat(e)}).join(",");return this.url.searchParams.append(e,"in.(".concat(r,")")),this}},{key:"contains",value:function(e,t){return"string"==typeof t?this.url.searchParams.append(e,"cs.".concat(t)):Array.isArray(t)?this.url.searchParams.append(e,"cs.{".concat(t.join(","),"}")):this.url.searchParams.append(e,"cs.".concat(JSON.stringify(t))),this}},{key:"containedBy",value:function(e,t){return"string"==typeof t?this.url.searchParams.append(e,"cd.".concat(t)):Array.isArray(t)?this.url.searchParams.append(e,"cd.{".concat(t.join(","),"}")):this.url.searchParams.append(e,"cd.".concat(JSON.stringify(t))),this}},{key:"rangeGt",value:function(e,t){return this.url.searchParams.append(e,"sr.".concat(t)),this}},{key:"rangeGte",value:function(e,t){return this.url.searchParams.append(e,"nxl.".concat(t)),this}},{key:"rangeLt",value:function(e,t){return this.url.searchParams.append(e,"sl.".concat(t)),this}},{key:"rangeLte",value:function(e,t){return this.url.searchParams.append(e,"nxr.".concat(t)),this}},{key:"rangeAdjacent",value:function(e,t){return this.url.searchParams.append(e,"adj.".concat(t)),this}},{key:"overlaps",value:function(e,t){return"string"==typeof t?this.url.searchParams.append(e,"ov.".concat(t)):this.url.searchParams.append(e,"ov.{".concat(t.join(","),"}")),this}},{key:"textSearch",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.config,s=r.type,i="";return"plain"===s?i="pl":"phrase"===s?i="ph":"websearch"===s&&(i="w"),this.url.searchParams.append(e,"".concat(i,"fts").concat(void 0===n?"":"(".concat(n,")"),".").concat(t)),this}},{key:"match",value:function(e){var t=this;return Object.entries(e).forEach(function(e){var r=o._(e,2),n=r[0],s=r[1];t.url.searchParams.append(n,"eq.".concat(s))}),this}},{key:"not",value:function(e,t,r){return this.url.searchParams.append(e,"not.".concat(t,".").concat(r)),this}},{key:"or",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.foreignTable,n=t.referencedTable,s=void 0===n?r:n;return this.url.searchParams.append(s?"".concat(s,".or"):"or","(".concat(e,")")),this}},{key:"filter",value:function(e,t,r){return this.url.searchParams.append(e,"".concat(t,".").concat(r)),this}}]),t}(u(e.r(782191)).default)},838290,(e,t,r)=>{"use strict";var n=e.r(995075),s=e.r(882372),i=e.r(621991),a=e.e&&e.e.__importDefault||function(e){return e&&e.__esMo
1dule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});var o=a(e.r(714633));r.default=function(){function e(t,r){var s=r.headers,i=r.schema,a=r.fetch;n._(this,e),this.url=t,this.headers=new Headers(void 0===s?{}:s),this.schema=i,this.fetch=a}return s._(e,[{key:"select",value:function(e,t){var r=null!=t?t:{},n=r.head,s=r.count,i=!1,a=(null!=e?e:"*").split("").map(function(e){return/\s/.test(e)&&!i?"":('"'===e&&(i=!i),e)}).join("");return this.url.searchParams.set("select",a),s&&this.headers.append("Prefer","count=".concat(s)),new o.default({method:void 0!==n&&n?"HEAD":"GET",url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}},{key:"insert",value:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.count,s=r.defaultToNull;if(n&&this.headers.append("Prefer","count=".concat(n)),void 0===s||s||this.headers.append("Prefer","missing=default"),Array.isArray(e)){var a=e.reduce(function(e,t){return e.concat(Object.keys(t))},[]);if(a.length>0){var u=i._(new Set(a)).map(function(e){return'"'.concat(e,'"')});this.url.searchParams.set("columns",u.join(","))}}return new o.default({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:null!=(t=this.fetch)?t:fetch})}},{key:"upsert",value:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.onConflict,s=r.ignoreDuplicates,a=r.count,u=r.defaultToNull;if(this.headers.append("Prefer","resolution=".concat(void 0!==s&&s?"ignore":"merge","-duplicates")),void 0!==n&&this.url.searchParams.set("on_conflict",n),a&&this.headers.append("Prefer","count=".concat(a)),void 0===u||u||this.headers.append("Prefer","missing=default"),Array.isArray(e)){var c=e.reduce(function(e,t){return e.concat(Object.keys(t))},[]);if(c.length>0){var l=i._(new Set(c)).map(function(e){return'"'.concat(e,'"')});this.url.searchParams.set("columns",l.join(","))}}return new o.default({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:null!=(t=this.fetch)?t:fetch})}},{key:"update",value:function(e){var t,r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).count;return r&&this.headers.append("Prefer","count=".concat(r)),new o.default({method:"PATCH",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:null!=(t=this.fetch)?t:fetch})}},{key:"delete",value:function(){var e,t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).count;return t&&this.headers.append("Prefer","count=".concat(t)),new o.default({method:"DELETE",url:this.url,headers:this.headers,schema:this.schema,fetch:null!=(e=this.fetch)?e:fetch})}}]),e}()},902259,(e,t,r)=>{"use strict";var n=e.r(995075),s=e.r(882372),i=e.r(891470),a=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});var o=a(e.r(838290)),u=a(e.r(714633));r.default=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=r.headers,i=r.schema,a=r.fetch;n._(this,e),this.url=t,this.headers=new Headers(void 0===s?{}:s),this.schemaName=i,this.fetch=a}return s._(e,[{key:"from",value:function(e){var t=new URL("".concat(this.url,"/").concat(e));return new o.default(t,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}},{key:"schema",value:function(t){return new e(this.url,{headers:this.headers,schema:t,fetch:this.fetch})}},{key:"rpc",value:function(e){var t,r,n,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=a.head,c=void 0!==o&&o,l=a.get,h=a.count,f=new URL("".concat(this.url,"/rpc/").concat(e));c||void 0!==l&&l?(r=c?"HEAD":"GET",Object.entries(s).filter(function(e){var t=i._(e,2);return void 0!==(t[0],t[1])}).map(function(e){var t=i._(e,2),r=t[0],n=t[1];return[r,Array.isArray(n)?"{".concat(n.join(","),"}"):"".concat(n)]}).forEach(function(e){var t=i._(e,2),r=t[0],n=t[1];f.searchParams.append(r,n)})):(r="POST",n=s);var d=new Headers(this.headers);return h&&d.set("Prefer","count=".concat(h)),new u.default({method:r,url:f,headers:d,schema:this.schemaName,body:n,fetch:null!=(t=this.fetch)?t:fetch})}}]),e}()},82215,(e,t,r)=>{"use strict";
1var n=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.PostgrestError=r.PostgrestBuilder=r.PostgrestTransformBuilder=r.PostgrestFilterBuilder=r.PostgrestQueryBuilder=r.PostgrestClient=void 0;var s=n(e.r(902259));r.PostgrestClient=s.default;var i=n(e.r(838290));r.PostgrestQueryBuilder=i.default;var a=n(e.r(714633));r.PostgrestFilterBuilder=a.default;var o=n(e.r(782191));r.PostgrestTransformBuilder=o.default;var u=n(e.r(343173));r.PostgrestBuilder=u.default;var c=n(e.r(154385));r.PostgrestError=c.default,r.default={PostgrestClient:s.default,PostgrestQueryBuilder:i.default,PostgrestFilterBuilder:a.default,PostgrestTransformBuilder:o.default,PostgrestBuilder:u.default,PostgrestError:c.default}},467034,(e,t,r)=>{var n=e.r(115240),s=e.r(368996),i={675:function(e,t){"use strict";t.byteLength=function(e){var t=u(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,i=u(e),a=i[0],o=i[1],c=new s((a+o)*3/4-o),l=0,h=o>0?a-4:a;for(r=0;r<h;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],c[l++]=t>>16&255,c[l++]=t>>8&255,c[l++]=255&t;return 2===o&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,c[l++]=255&t),1===o&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t),c},t.fromByteArray=function(e){for(var t,n=e.length,s=n%3,i=[],a=0,o=n-s;a<o;a+=16383)i.push(function(e,t,n){for(var s,i=[],a=t;a<n;a+=3)s=(e[a]<<16&0xff0000)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(r[s>>18&63]+r[s>>12&63]+r[s>>6&63]+r[63&s]);return i.join("")}(e,a,a+16383>o?o:a+16383));return 1===s?i.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===s&&i.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),i.join("")};for(var r=[],n=[],s="u">typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,o=i.length;a<o;++a)r[a]=i[a],n[i.charCodeAt(a)]=a;function u(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}n[45]=62,n[95]=63},72:function(e,t,r){"use strict";var i=r(675),a=r(783),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function u(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return f(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e){var n=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!c.isEncoding(i))throw TypeError("Unknown encoding: "+i);var a=0|v(n,i),o=u(a),l=o.write(n,i);return l!==a&&(o=o.slice(0,l)),o}if(ArrayBuffer.isView(e))return d(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+(void 0===e?"undefined":s._(e)));if(P(e,ArrayBuffer)||e&&P(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(P(e,SharedArrayBuffer)||e&&P(e.buffer,SharedArrayBuffer)))return function(e,t,r){var n;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),c.prototype),n}(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var h=e.valueOf&&e.valueOf();if(null!=h&&h!==e)return c.from(h,t,r);var f=function(e){if(c.isBuffer(e)){var t=0|p(e.length),r=u(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?u(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(f)return f;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+(void 0===e?"undefined":s._(e)))}function h(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');
vendor: 16,555 bytes, line 1
1if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function f(e){return h(e),u(e<0?0:0|p(e))}function d(e){for(var t=e.length<0?0:0|p(e.length),r=u(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}t.Buffer=c,t.SlowBuffer=function(e){return+e!=e&&(e=0),c.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=0x7fffffff,c.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),!c.TYPED_ARRAY_SUPPORT&&"u">typeof console&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(e,t,r){return(h(e),e<=0)?u(e):void 0!==t?"string"==typeof r?u(e).fill(t,r):u(e).fill(t):u(e)},c.allocUnsafe=function(e){return f(e)},c.allocUnsafeSlow=function(e){return f(e)};function p(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function v(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||P(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+(void 0===e?"undefined":s._(e)));var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return A(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return I(e).length;default:if(i)return n?-1:A(e).length;t=(""+t).toLowerCase(),i=!0}}function g(e,t,r){var n,s,a,o=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var s="",i=t;i<r;++i)s+=C[e[i]];return s}(this,t,r);case"utf8":case"utf-8":return m(this,t,r);case"ascii":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var s=t;s<r;++s)n+=String.fromCharCode(127&e[s]);return n}(this,t,r);case"latin1":case"binary":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var s=t;s<r;++s)n+=String.fromCharCode(e[s]);return n}(this,t,r);case"base64":return n=this,s=t,a=r,0===s&&a===n.length?i.fromByteArray(n):i.fromByteArray(n.slice(s,a));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var n=e.slice(t,r),s="",i=0;i<n.length;i+=2)s+=String.fromCharCode(n[i]+256*n[i+1]);return s}(this,t,r);default:if(o)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}function _(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function y(e,t,r,n,s){var i;if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(i=r*=1)!=i&&(r=s?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(s)return -1;else r=e.length-1;else if(r<0)if(!s)return -1;else r=0;if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:b(e,t,r,n,s);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(s)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return b(e,[t],r,n,s)}throw TypeError("val must be string, number or Buffer")}function b(e,t,r,n,s){var i,a=1,o=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;a=2,o/=2,u/=2,r/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(s){var l=-1;for(i=r;i<o;i++)if(c(e,i)===c(t,-1===l?0:i-l)){if(-1===l&&(l=i),i-l+1===u)return l*a}else -1!==l&&(i-=i-l),l=-1}else for(r+u>o&&(r=o-u),i=r;i>=0;i--){for(var h=!0,f=0;f<u;f++)if(c(e,i+f)!==c(t,f)){h=!1;break}if(h)return i}return -1}c.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==c.prototype},c.compare=function(e,t){if(P(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),P(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(e)||!c.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,s=0,i=Math.min(r,n);s<i;++s)if(e[s]!==t[s]){r=e[s],n=t[s];break}return r<n?-1:+(n<r)},c.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,n=c.allocUnsafe(t),s=0;for(r=0;r<e.length;++r){var i=e[r];if(P(i,Uint8Array)&&(i=c.from(i)),!c.isBuffer(i))throw TypeError('"list" argument must be an Array of Buffers');i.copy(n,s),s+=i.length}return n},c.byteLength=v,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)_(this,t,t+1);return this},c.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)_(this,t,t+3),_(this,t+1,t+2);return this},c.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)_(this,t,t+7),_(this,t+1,t+6),_(this,t+2,t+5),_(this,t+3,t+4);return this},c.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?m(this,0,e):g.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(e){if(!c.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,r,n,i){if(P(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+(void 0===e?"undefined":s._(e)));if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var a=i-n,o=r-t,u=Math.min(a,o),l=this.slice(n,i),h=e.slice(t,r),f=0;f<u;++f)if(l[f]!==h[f]){a=l[f],o=h[f];break}return a<o?-1:+(o<a)},c.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},c.prototype.indexOf=function(e,t,r){return y(this,e,t,r,!0)},c.prototype.lastIndexOf=function(e,t,r){return y(this,e,t,r,!1)};function m(e,t,r){r=Math.min(e.length,r);for(var n=[],s=t;s<r;){var i,a,o,u,c=e[s],l=null,h=c>239?4:c>223?3:c>191?2:1;if(s+h<=r)switch(h){case 1:c<128&&(l=c);break;case 2:(192&(i=e[s+1]))==128&&(u=(31&c)<<6|63&i)>127&&(l=u);break;case 3:i=e[s+1],a=e[s+2],(192&i)==128&&(192&a)==128&&(u=(15&c)<<12|(63&i)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:i=e[s+1],a=e[s+2],o=e[s+3],(192&i)==128&&(192&a)==128&&(192&o)==128&&(u=(15&c)<<18|(63&i)<<12|(63&a)<<6|63&o)>65535&&u<1114112&&(l=u)}null===l?(l=65533,h=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),s+=h}var f=n,d=f.length;if(d<=4096)return String.fromCharCode.apply(String,f);for(var p="",v=0;v<d;)p+=String.fromCharCode.apply(String,f.slice(v,v+=4096));return p}function w(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function k(e,t,r,n,s,i){if(!c.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>s||t<i)throw RangeError('"value" argument is out of bounds');if(r+n>e.length)throw RangeError("Index out of range")}function S(e,t,r,n,s,i){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function E(e,t,r,n,s){return t*=1,r>>>=0,s||S(e,t,r,4,34028234663852886e22,-34028234663852886e22),a.write(e,t,r,n,23,4),r+4}function T(e,t,r,n,s){return t*=1,r>>>=0,s||S(e,t,r,8,17976931348623157e292,-17976931348623157e292),a.write(e,t,r,n,52,8),r+8}c.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s,i,a,o,u,c,l,h,f=this.length-t;if((void 0===r||r>f)&&(r=f),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var d=!1;;)switch(n){case"hex":return function(e,t,r,n){r=Number(r)||0;var s=e.length-r;n?(n=Number(n))>s&&(n=s):n=s;var i=t.length;n>i/2&&(n=i/2);for(var a=0;a<n;++a){var o,u=parseInt(t.substr(2*a,2),16);if((o=u)!=o)break;e[r+a]=u}return a}(this,e,t,r);case"utf8":case"utf-8":return s=t,i=r,R(A(e,this.length-s),this,s,i);case"ascii":return a=t,o=r,R(j(e),this,a,o);case"latin1":case"binary":return function(e,t,r,n){return R(j(t),e,r,n)}(this,e,t,r);case"base64":return u=t,c=r,R(I(e),this,u,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return l=t,h=r,R(function(e,t){for(var r,n,s=[],i=0;i<e.length&&!((t-=2)<0);++i)n=(r=e.charCodeAt(i))>>8,s.push(r%256),s.push(n);return s}(e,this.length-l),this,l,h);default:if(d)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),d=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},c.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,c.prototype),n},c.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);for(var n=this[e],s=1,i=0;++i<t&&(s*=256);)n+=this[e+i]*s;return n},c.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);for(var n=this[e+--t],s=1;t>0&&(s*=256);)n+=this[e+--t]*s;return n},c.prototype.readUInt8=function(e,t){return e>>>=0,t||w(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||w(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||w(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||w(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||w(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);for(var n=this[e],s=1,i=0;++i<t&&(s*=256);)n+=this[e+i]*s;return n>=(s*=128)&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);for(var n=t,s=1,i=this[e+--n];n>0&&(s*=256);)i+=this[e+--n]*s;return i>=(s*=128)&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return(e>>>=0,t||w(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||w(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},c.prototype.readInt16BE=function(e,t){e>>>=0,t||w(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||w(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||w(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return e>>>=0,t||w(e,4,this.length),a.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||w(e,4,this.length),a.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||w(e,8,this.length),a.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||w(e,8,this.length),a.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var s=Math.pow(2,8*r)-1;k(this,e,t,r,s,0)}var i=1,a=0;for(this[t]=255&e;++a<r&&(i*=256);)this[t+a]=e/i&255;return t+r},c.prototype.writeUIntBE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var s=Math.pow(2,8*r)-1;k(this,e,t,r,s,0)}var i=r-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+r},c.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||k(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||k(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||k(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||k(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||k(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeIntLE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var s=Math.pow(2,8*r-1);k(this,e,t,r,s-1,-s)}var i=0,a=1,o=0;for(this[t]=255&e;++i<r&&(a*=256);)e<0&&0===o&&0!==this[t+i-1]&&(o=1),this[t+i]=(e/a|0)-o&255;return t+r},c.prototype.writeIntBE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var s=Math.pow(2,8*r-1);k(this,e,t,r,s-1,-s)}var i=r-1,a=1,o=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===o&&0!==this[t+i+1]&&(o=1),this[t+i]=(e/a|0)-o&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||k(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||k(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||k(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||k(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||k(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeFloatLE=function(e,t,r){return E(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return E(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return T(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return T(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(!c.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var s=n-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,n);else if(this===e&&r<t&&t<n)for(var i=s-1;i>=0;--i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return s},c.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw TypeError("encoding must be a string");if("string"==typeof n&&!c.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===e.length){var s,i=e.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(e=i)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(s=t;s<r;++s)this[s]=e;else{var a=c.isBuffer(e)?e:c.from(e,n),o=a.length;
1if(0===o)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<r-t;++s)this[s+t]=a[s%o]}return this};var O=/[^+/0-9A-Za-z-_]/g;function A(e,t){t=t||1/0;for(var r,n=e.length,s=null,i=[],a=0;a<n;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!s){if(r>56319||a+1===n){(t-=3)>-1&&i.push(239,191,189);continue}s=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),s=r;continue}r=(s-55296<<10|r-56320)+65536}else s&&(t-=3)>-1&&i.push(239,191,189);if(s=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return i}function j(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function I(e){return i.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(O,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function R(e,t,r,n){for(var s=0;s<n&&!(s+r>=t.length)&&!(s>=e.length);++s)t[s+r]=e[s];return s}function P(e,t){return n._(e,t)||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var C=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var n=16*r,s=0;s<16;++s)t[n+s]=e[r]+e[s];return t}()},783:function(e,t){t.read=function(e,t,r,n,s){var i,a,o=8*s-n-1,u=(1<<o)-1,c=u>>1,l=-7,h=r?s-1:0,f=r?-1:1,d=e[t+h];for(h+=f,i=d&(1<<-l)-1,d>>=-l,l+=o;l>0;i=256*i+e[t+h],h+=f,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=n;l>0;a=256*a+e[t+h],h+=f,l-=8);if(0===i)i=1-c;else{if(i===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),i-=c}return(d?-1:1)*a*Math.pow(2,i-n)},t.write=function(e,t,r,n,s,i){var a,o,u,c=8*i-s-1,l=(1<<c)-1,h=l>>1,f=5960464477539062e-23*(23===s),d=n?0:i-1,p=n?1:-1,v=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(o=+!!isNaN(t),a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+h>=1?t+=f/u:t+=f*Math.pow(2,1-h),t*u>=2&&(a++,u/=2),a+h>=l?(o=0,a=l):a+h>=1?(o=(t*u-1)*Math.pow(2,s),a+=h):(o=t*Math.pow(2,h-1)*Math.pow(2,s),a=0));s>=8;e[r+d]=255&o,d+=p,o/=256,s-=8);for(a=a<<s|o,c+=s;c>0;e[r+d]=255&a,d+=p,a/=256,c-=8);e[r+d-p]|=128*v}}},a={};function o(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={exports:{}},n=!0;try{i[e](r,r.exports,o),n=!1}finally{n&&delete a[e]}return r.exports}o.ab="/ROOT/node_modules/next/dist/compiled/buffer/",t.exports=o(72)},909156,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.parse=function(e,t){var r=new c,n=e.length;if(n<2)return r;var s=(null==t?void 0:t.decode)||f,i=0;do{var a=e.indexOf("=",i);if(-1===a)break;var o=e.indexOf(";",i),u=-1===o?n:o;if(a>u){i=e.lastIndexOf(";",a-1)+1;continue}var d=l(e,i,a),p=h(e,a,d),v=e.slice(d,p);if(void 0===r[v]){var g=l(e,a+1,u),_=h(e,u,g),y=s(e.slice(g,_));r[v]=y}i=u+1}while(i<n)return r},r.serialize=function(e,t,r){var n,c=(null==r?void 0:r.encode)||encodeURIComponent;if(!s.test(e))throw TypeError("argument name is invalid: ".concat(e));var l=c(t);if(!i.test(l))throw TypeError("argument val is invalid: ".concat(t));var h=e+"="+l;if(!r)return h;if(void 0!==r.maxAge){if(!Number.isInteger(r.maxAge))throw TypeError("option maxAge is invalid: ".concat(r.maxAge));h+="; Max-Age="+r.maxAge}if(r.domain){if(!a.test(r.domain))throw TypeError("option domain is invalid: ".concat(r.domain));h+="; Domain="+r.domain}if(r.path){if(!o.test(r.path))throw TypeError("option path is invalid: ".concat(r.path));h+="; Path="+r.path}if(r.expires){if(n=r.expires,"[object Date]"!==u.call(n)||!Number.isFinite(r.expires.valueOf()))throw TypeError("option expires is invali
1d: ".concat(r.expires));h+="; Expires="+r.expires.toUTCString()}if(r.httpOnly&&(h+="; HttpOnly"),r.secure&&(h+="; Secure"),r.partitioned&&(h+="; Partitioned"),r.priority)switch("string"==typeof r.priority?r.priority.toLowerCase():void 0){case"low":h+="; Priority=Low";break;case"medium":h+="; Priority=Medium";break;case"high":h+="; Priority=High";break;default:throw TypeError("option priority is invalid: ".concat(r.priority))}if(r.sameSite)switch("string"==typeof r.sameSite?r.sameSite.toLowerCase():r.sameSite){case!0:case"strict":h+="; SameSite=Strict";break;case"lax":h+="; SameSite=Lax";break;case"none":h+="; SameSite=None";break;default:throw TypeError("option sameSite is invalid: ".concat(r.sameSite))}return h};var n,s=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,i=/^[\u0021-\u003A\u003C-\u007E]*$/,a=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,o=/^[\u0020-\u003A\u003D-\u007E]*$/,u=Object.prototype.toString,c=((n=function(){}).prototype=Object.create(null),n);function l(e,t,r){do{var n=e.charCodeAt(t);if(32!==n&&9!==n)return t}while(++t<r)return r}function h(e,t,r){for(;t>r;){var n=e.charCodeAt(--t);if(32!==n&&9!==n)return t+1}return r}function f(e){if(-1===e.indexOf("%"))return e;try{return decodeURIComponent(e)}catch(t){return e}}},752683,(e,t,r)=>{},529225,972390,e=>{"use strict";var t,r,n,s,i,a,o,u,c,l,h,f,d,p,v,g,_,y,b,m,w,k,S=e.i(120786),E=e.i(92808),T=e.i(247167),O=e.i(292955),A=e.i(780646),j=e.i(108487),I=e.i(296137),R=e.i(540316),P=function(t){var r;return r=t||("u"<typeof fetch?function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.A(611737).then(function(e){return e.default.apply(void 0,(0,R._)(r))})}:fetch),function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.apply(void 0,(0,R._)(t))}},C=e.i(38981),x=e.i(64217),U=e.i(302393),N=function(e){function t(e){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"FunctionsError",s=arguments.length>2?arguments[2]:void 0;return(0,O._)(this,t),(r=(0,C._)(this,t,[e])).name=n,r.context=s,r}return(0,x._)(t,e),t}((0,U._)(Error)),L=function(e){function t(e){return(0,O._)(this,t),(0,C._)(this,t,["Failed to send a request to the Edge Function","FunctionsFetchError",e])}return(0,x._)(t,e),t}(N),B=function(e){function t(e){return(0,O._)(this,t),(0,C._)(this,t,["Relay Error invoking the Edge Function","FunctionsRelayError",e])}return(0,x._)(t,e),t}(N),D=function(e){function t(e){return(0,O._)(this,t),(0,C._)(this,t,["Edge Function returned a non-2xx status code","FunctionsHttpError",e])}return(0,x._)(t,e),t}(N);(t=h||(h={})).Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2";var q=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.headers,s=r.customFetch,i=r.region,a=void 0===i?h.Any:i;(0,O._)(this,e),this.url=t,this.headers=void 0===n?{}:n,this.region=a,this.fetch=P(s)}return(0,A._)(e,[{key:"setAuth",value:function(e){this.headers.Authorization="Bearer ".concat(e)}},{key:"invoke",value:function(e){var t,r,n,s;return t=this,r=arguments,n=void 0,s=function(e){var t,r,n,s,i,a,o,u,c,l,h,f,d,p,v,g=arguments;return(0,I._)(this,function(_){switch(_.label){case 0:t=g.length>1&&void 0!==g[1]?g[1]:{},_.label=1;case 1:return _.trys.push([1,12,,13]),n=t.headers,s=t.method,i=t.body,a=t.signal,o={},(u=t.region)||(u=this.region),c=new URL("".concat(this.url,"/").concat(e)),u&&"any"!==u&&(o["x-region"]=u,c.searchParams.set("forceFunctionRegion",u)),i&&(n&&!Object.prototype.hasOwnProperty.call(n,"Content-Type")||!n)&&("u">typeof Blob&&(0,j._)(i,Blob)||(0,j._)(i,ArrayBuffer)?(o["Content-Type"]="application/octet-stream",l=i):"string"==typeof i?(o["Content-Type"]="text/plain",l=i):"u">typeof FormData&&(0,j._)(i,FormData)?l=i:(o["Content-Type"]="application/json",l=JSON.stringify(i))),[4,this.fetch(c.toString(),{method:s||"POST",headers:Object.assign(Object.assign(Object.assign({},o),this.headers),n),body:l,signal:a}).catch(function(e){if("AbortError"===e.name)throw e;throw new L(e)})];case 2:if((f=(h=_.sent()).headers.get("x-relay-error"))&&"true"===f)throw new B(h);if(!h.ok)throw new D(h);if("application/json"!==(d=(null!=(r=h.headers.get("Content-Type"))?r:"text/plain").split(";")[0].trim()))return[3,4];return[4,h.json()];case 3:case 5:case 8:return p=_.sent(),[3,11];case 4:if("application/octet-stream"!==d)return[3,6];return[4,h.blob()];case 6:if("text/event-stream"!==d)return[3,7];return p=h,[3,11];case 7:if("multipart/form-data"!==d)return[3,9];return[4,h.formData()];case 9:return[4,h.text()];case 10:p=_.sent(),_.label=11;case 11:return[2,{data:p,error:null,response:h}];case 12:if(v=_.sent(),(0,j._)(v,Error)&&"AbortError"===v.name)return[2,{data:null,error:new L(v)}];return[2,{data:null,error:v,response:(0,j._)(v,D)||(0,j._)(v,B)?v.context:void 0}];case 13:return[2]}})}
1,new(n||(n=Promise))(function(e,i){function a(e){try{u(s.next(e))}catch(e){i(e)}}function o(e){try{u(s.throw(e))}catch(e){i(e)}}function u(t){var r;t.done?e(t.value):(r=t.value,(0,j._)(r,n)?r:new n(function(e){e(r)})).then(a,o)}u((s=s.apply(t,r||[])).next())})}}]),e}(),M=e.i(82215),W=M.default.PostgrestClient;M.default.PostgrestQueryBuilder,M.default.PostgrestFilterBuilder,M.default.PostgrestTransformBuilder,M.default.PostgrestBuilder,M.default.PostgrestError;var K=e.i(991865),F=function(){function t(){(0,O._)(this,t)}return(0,A._)(t,null,[{key:"detectEnvironment",value:function(){var t;if("u">typeof WebSocket)return{type:"native",constructor:WebSocket};if("u">typeof globalThis&&void 0!==globalThis.WebSocket)return{type:"native",constructor:globalThis.WebSocket};if(void 0!==e.g.WebSocket)return{type:"native",constructor:e.g.WebSocket};if("u">typeof globalThis&&void 0!==globalThis.WebSocketPair&&void 0===globalThis.WebSocket)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("u">typeof globalThis&&globalThis.EdgeRuntime||"u">typeof navigator&&(null==(t=navigator.userAgent)?void 0:t.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(void 0!==T.default){var r=T.default.versions;if(r&&r.node){var n=parseInt(r.node.replace(/^v/,"").split(".")[0]);return n>=22?void 0!==globalThis.WebSocket?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:"Node.js ".concat(n," detected but native WebSocket not found."),workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:"Node.js ".concat(n," detected without native WebSocket support."),workaround:'For Node.js < 22, install "ws" package and provide it via the transport option:\nimport ws from "ws"\nnew RealtimeClient(url, { transport: ws })'}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}},{key:"getWebSocketConstructor",value:function(){var e=this.detectEnvironment();if(e.constructor)return e.constructor;var t=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(t+="\n\nSuggested solution: ".concat(e.workaround)),Error(t)}},{key:"createWebSocket",value:function(e,t){return new(this.getWebSocketConstructor())(e,t)}},{key:"isWebSocketSupported",value:function(){try{var e=this.detectEnvironment();return"native"===e.type||"ws"===e.type}catch(e){return!1}}}]),t}(),z="realtime-js/".concat("2.75.0");(r=f||(f={}))[r.connecting=0]="connecting",r[r.open=1]="open",r[r.closing=2]="closing",r[r.closed=3]="closed",(n=d||(d={})).closed="closed",n.errored="errored",n.joined="joined",n.joining="joining",n.leaving="leaving",(s=p||(p={})).close="phx_close",s.error="phx_error",s.join="phx_join",s.reply="phx_reply",s.leave="phx_leave",s.access_token="access_token",(v||(v={})).websocket="websocket",(i=g||(g={})).Connecting="connecting",i.Open="open",i.Closing="closing",i.Closed="closed";var J=function(){function e(){(0,O._)(this,e),this.HEADER_LENGTH=1}return(0,A._)(e,[{key:"decode",value:function(e,t){return t(e.constructor===ArrayBuffer?this._binaryDecode(e):"string"==typeof e?JSON.parse(e):{})}},{key:"_binaryDecode",value:function(e){var t=new DataView(e),r=new TextDecoder;return this._decodeBroadcast(e,t,r)}},{key:"_decodeBroadcast",value:function(e,t,r){var n=t.getUint8(1),s=t.getUint8(2),i=this.HEADER_LENGTH+2,a=r.decode(e.slice(i,i+n));i+=n;var o=r.decode(e.slice(i,i+s));return i+=s,{ref:null,topic:a,event:o,payload:JSON.parse(r.decode(e.slice(i,e.byteLength)))}}}]),e}(),H=function(){function e(t,r){(0,O._)(this,e),this.callback=t,this.timerCalc=r,this.timer=void 0,this.tries=0,this.callback=t,this.timerCalc=r}return(0,A._)(e,[{key:"reset",value:function(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}},{key:"scheduleTimeout",value:function(){var e=this;clearTimeout(this.timer),this.timer=setTimeout(function(){e.tries=e.tries+1,e.callback()},this.timerCalc(this.tries+1))}}]),e}();(a=_||(_={})).abstime="abstime",a.bool="bool",a.date="date",a.daterange="daterange",a.float4="float4",a.float8="float8",a.int2="int2",a.int4="int4",a.int4range="int4range",a.int8="int8",a.int8range="int8range",a.json="json",a.jsonb="jsonb",a.money="money",a.numeric="numeric",a.oid="oid",a.reltime="reltime",a.text="text",a.time="time",a.timestamp="timestamp",a.timestamptz="timestamptz",a.timetz="timetz",a.tsrange="tsrange",a.tstzrange="tstzrange";var G=function(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=null!=(r=n.skipTypes)?r:[];return t?Object.keys(t).reduce(function(r,n){return r[n]=V(n,e,t,s),r},{}):{}},V=function(e,t,r,n){var s=t.find(function(t){return t.name===e}),i=null==s?void 0:s.type,a=r[e];return i&&!n.includes(i)?Y(i,a):$(a)},Y=function(e,t){if("_"===e.charAt(0))return ee(t,e.slice(1,e.length));switch(e){case _.bool:return Q(t);case _.float4:case _.float8:case _.int2:case _.int4:case _.int8:case _.numeric:case _.oid:return X(t);case _.json:case _.jsonb:return Z(t);case _.timestamp:return et(t);case _.abstime:case _.date:case _.daterange:case _.int4range:case _.int8range:case _.money:case _.reltime:case _.text:case _.time:case _.timestamptz:case _.timetz:case _.tsrange:case _.tstzrange:default:return $(t)}},$=function(e){return e},Q=function(e){switch(e){case"t":return!0;case"f":return!1;default:return e}},X=function(e){if("string"==typeof e){var t=parseFloat(e);
1if(!Number.isNaN(t))return t}return e},Z=function(e){if("string"==typeof e)try{return JSON.parse(e)}catch(e){console.log("JSON parse error: ".concat(e))}return e},ee=function(e,t){if("string"!=typeof e)return e;var r=e.length-1,n=e[r];if("{"===e[0]&&"}"===n){var s,i=e.slice(1,r);try{s=JSON.parse("["+i+"]")}catch(e){s=i?i.split(","):[]}return s.map(function(e){return Y(t,e)})}return e},et=function(e){return"string"==typeof e?e.replace(" ","T"):e},er=function(e){var t=e;return(t=(t=t.replace(/^ws/i,"http")).replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,"")).replace(/\/+$/,"")+"/api/broadcast"},en=e.i(500075),es=function(){function e(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e4;(0,O._)(this,e),this.channel=t,this.event=r,this.payload=n,this.timeout=s,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}return(0,A._)(e,[{key:"resend",value:function(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}},{key:"send",value:function(){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()}))}},{key:"updatePayload",value:function(e){this.payload=Object.assign(Object.assign({},this.payload),e)}},{key:"receive",value:function(e,t){var r;return this._hasReceived(e)&&t(null==(r=this.receivedResp)?void 0:r.response),this.recHooks.push({status:e,callback:t}),this}},{key:"startTimeout",value:function(){var e=this;this.timeoutTimer||(this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref),this.channel._on(this.refEvent,{},function(t){e._cancelRefEvent(),e._cancelTimeout(),e.receivedResp=t,e._matchReceive(t)}),this.timeoutTimer=setTimeout(function(){e.trigger("timeout",{})},this.timeout))}},{key:"trigger",value:function(e,t){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:t})}},{key:"destroy",value:function(){this._cancelRefEvent(),this._cancelTimeout()}},{key:"_cancelRefEvent",value:function(){this.refEvent&&this.channel._off(this.refEvent,{})}},{key:"_cancelTimeout",value:function(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}},{key:"_matchReceive",value:function(e){var t=e.status,r=e.response;this.recHooks.filter(function(e){return e.status===t}).forEach(function(e){return e.callback(r)})}},{key:"_hasReceived",value:function(e){return this.receivedResp&&this.receivedResp.status===e}}]),e}();(o=y||(y={})).SYNC="sync",o.JOIN="join",o.LEAVE="leave";var ei=function(){function e(t,r){var n=this;(0,O._)(this,e),this.channel=t,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}};var s=(null==r?void 0:r.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(s.state,{},function(t){var r=n.caller,s=r.onJoin,i=r.onLeave,a=r.onSync;n.joinRef=n.channel._joinRef(),n.state=e.syncState(n.state,t,s,i),n.pendingDiffs.forEach(function(t){n.state=e.syncDiff(n.state,t,s,i)}),n.pendingDiffs=[],a()}),this.channel._on(s.diff,{},function(t){var r=n.caller,s=r.onJoin,i=r.onLeave,a=r.onSync;n.inPendingSyncState()?n.pendingDiffs.push(t):(n.state=e.syncDiff(n.state,t,s,i),a())}),this.onJoin(function(e,t,r){n.channel._trigger("presence",{event:"join",key:e,currentPresences:t,newPresences:r})}),this.onLeave(function(e,t,r){n.channel._trigger("presence",{event:"leave",key:e,currentPresences:t,leftPresences:r})}),this.onSync(function(){n.channel._trigger("presence",{event:"sync"})})}return(0,A._)(e,[{key:"onJoin",value:function(e){this.caller.onJoin=e}},{key:"onLeave",value:function(e){this.caller.onLeave=e}},{key:"onSync",value:function(e){this.caller.onSync=e}},{key:"inPendingSyncState",value:function(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}],[{key:"syncState",value:function(e,t,r,n){var s=this.cloneDeep(e),i=this.transformState(t),a={},o={};return this.map(s,function(e,t){i[e]||(o[e]=t)}),this.map(i,function(e,t){var r=s[e];if(r){var n=t.map(function(e){return e.presence_ref}),i=r.map(function(e){return e.presence_ref}),u=t.filter(function(e){return 0>i.indexOf(e.presence_ref)}),c=r.filter(function(e){return 0>n.indexOf(e.presence_ref)});u.length>0&&(a[e]=u),c.length>0&&(o[e]=c)}else a[e]=t}),this.syncDiff(s,{joins:a,leaves:o}
1,r,n)}},{key:"syncDiff",value:function(e,t,r,n){var s=this,i={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)},a=i.joins,o=i.leaves;return r||(r=function(){}),n||(n=function(){}),this.map(a,function(t,n){var i=null!=(a=e[t])?a:[];if(e[t]=s.cloneDeep(n),i.length>0){var a,o,u=e[t].map(function(e){return e.presence_ref}),c=i.filter(function(e){return 0>u.indexOf(e.presence_ref)});(o=e[t]).unshift.apply(o,(0,R._)(c))}r(t,i,n)}),this.map(o,function(t,r){var s=e[t];if(s){var i=r.map(function(e){return e.presence_ref});s=s.filter(function(e){return 0>i.indexOf(e.presence_ref)}),e[t]=s,n(t,s,r),0===s.length&&delete e[t]}}),e}},{key:"map",value:function(e,t){return Object.getOwnPropertyNames(e).map(function(r){return t(r,e[r])})}},{key:"transformState",value:function(e){return Object.getOwnPropertyNames(e=this.cloneDeep(e)).reduce(function(t,r){var n=e[r];return"metas"in n?t[r]=n.metas.map(function(e){return e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e}):t[r]=n,t},{})}},{key:"cloneDeep",value:function(e){return JSON.parse(JSON.stringify(e))}}]),e}();(u=b||(b={})).ALL="*",u.INSERT="INSERT",u.UPDATE="UPDATE",u.DELETE="DELETE",(c=m||(m={})).BROADCAST="broadcast",c.PRESENCE="presence",c.POSTGRES_CHANGES="postgres_changes",c.SYSTEM="system",(l=w||(w={})).SUBSCRIBED="SUBSCRIBED",l.TIMED_OUT="TIMED_OUT",l.CLOSED="CLOSED",l.CHANNEL_ERROR="CHANNEL_ERROR";var ea=function(){function e(t){var r,n,s=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{config:{}},a=arguments.length>2?arguments[2]:void 0;if((0,O._)(this,e),this.topic=t,this.params=i,this.socket=a,this.bindings={},this.state=d.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},i.config),this.timeout=this.socket.timeout,this.joinPush=new es(this,p.join,this.params,this.timeout),this.rejoinTimer=new H(function(){return s._rejoinUntilConnected()},this.socket.reconnectAfterMs),this.joinPush.receive("ok",function(){s.state=d.joined,s.rejoinTimer.reset(),s.pushBuffer.forEach(function(e){return e.send()}),s.pushBuffer=[]}),this._onClose(function(){s.rejoinTimer.reset(),s.socket.log("channel","close ".concat(s.topic," ").concat(s._joinRef())),s.state=d.closed,s.socket._remove(s)}),this._onError(function(e){s._isLeaving()||s._isClosed()||(s.socket.log("channel","error ".concat(s.topic),e),s.state=d.errored,s.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",function(){s._isJoining()&&(s.socket.log("channel","timeout ".concat(s.topic),s.joinPush.timeout),s.state=d.errored,s.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",function(e){s._isLeaving()||s._isClosed()||(s.socket.log("channel","error ".concat(s.topic),e),s.state=d.errored,s.rejoinTimer.scheduleTimeout())}),this._on(p.reply,{},function(e,t){s._trigger(s._replyEventName(t),e)}),this.presence=new ei(this),this.broadcastEndpointURL=er(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(null==(n=null==(r=this.params.config)?void 0:r.broadcast)?void 0:n.replay))throw"tried to use replay on public channel '".concat(this.topic,"'. It must be a private channel.")}return(0,A._)(e,[{key:"subscribe",value:function(e){var t,r,n,s=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.timeout;if(this.socket.isConnected()||this.socket.connect(),this.state==d.closed){var a=this.params.config,o=a.broadcast,u=a.presence,c=a.private,l=null!=(r=null==(t=this.bindings.postgres_changes)?void 0:t.map(function(e){return e.filter}))?r:[],h=!!this.bindings[m.PRESENCE]&&this.bindings[m.PRESENCE].length>0||(null==(n=this.params.config.presence)?void 0:n.enabled)===!0,f={},p={broadcast:o,presence:Object.assign(Object.assign({},u),{enabled:h}),postgres_changes:l,private:c};this.socket.accessTokenValue&&(f.access_token=this.socket.accessTokenValue),this._onError(function(t){return null==e?void 0:e(w.CHANNEL_ERROR,t)}),this._onClose(function(){return null==e?void 0:e(w.CLOSED)}),this.updateJoinPayload(Object.assign({config:p},f)),this.joinedOnce=!0,this._rejoin(i),this.joinPush.receive("ok",function(t){var r=t.postgres_changes;return(0,K._)(function(){var t,n,s,i,a,o,u,c,l,h,f,p;return(0,I._)(this,function(v){if(this.socket.setAuth(),void 0===r)return null==e||e(w.SUBSCRIBED),[2];for(a=0,s=null!=(t=null==(n=this.bindings.postgres_changes)?void 0:n.length)?t:0,i=[];a<s;a++){if(c=(u=(o=n[a]).filter).event,l=u.schema,h=u.table,f=u.filter,!(p=r&&r[a])||p.event!==c||p.schema!==l||p.table!==h||p.filter!==f)return this.unsubscribe(),this.state=d.errored,null==e||e(w.CHANNEL_ERROR,Error("mismatch between server and client bindings for postgres changes")),[2];i.push(Object.assign(Object.assign({},o),{id:p.id}))}return this.bindings.postgres_changes=i,e&&e(w.SUBSCRIBED),[2]})}).call(s)}).receive("error",function(t){s.state=d.errored,null==e||e(w.CHANNEL_ERROR,Error(JSON.stringify(Object.values(t).join(", ")||"error")))}).receive("timeout",function(){null==e||e(w.TIMED_OUT)})}return this}},{key:"presenceState",value:function(){return this.presence.state}},{key:"track",value:function(e){return(0,K._)(function(e){var t,r=arguments;return(0,I._)(this,function(n){switch(n.label){case 0:return t=r.length>1&&void 0!==r[1]?r[1]:{},[4,this.send({type:"presence",event:"track",payload:e},t.timeout||this.timeout)];case 1:return[2,n.sent()]}})}).apply(this,arguments)}},{key:"untrack",value:function(){return(0,K._)(function(){var e,t=arguments;return(0,I._)(this,function(r){switch(r.label){case 0:return e=t.length>0&&void 0!==t[0]?t[0]:{},[4,this.send({type:"presence",event:"untrack"},e)];case 1:return[2,r.sent()]}})}).apply(this,arguments)}},{key:"on",value:function(e,t,r){var n=this;return this.state===d.joined&&e===m.PRESENCE&&(this.socket.log("channel","resubscribe to ".concat(this.topic," due to change in presence callbacks on joined channel")),this.unsubscribe().then(function(){return n.subscribe()})),this._on(e,t,r)}},{key:"send",value:function(e){return(0,K._)(function(e){var t,r,n,s,i,a,o,u,c=arguments;return(0,I._)(this,function(l){switch(l.label){case 0:if(t=this,r=c.length>1&&void 0!==c[1]?c[1]:{},!(!this._canPush()&&"broadcast"===e.type))return[3,6];i=e.event,a=e.payload,o={method:"POST",headers:{Authorization:this.socket.accessTokenValue?"Bearer ".concat(this.socket.accessTokenValue):"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:a,private:this.private}]})},l.label=1;case 1:return l.trys.push([1,4,,5]),[4,this._fetchWithTimeout(this.broadcastEndpointURL,o,null!=(n=r.timeout)?n:this.timeout)];case 2:return[4,null==(s=(u=l.sent()).body)?void 0:s.cancel()];case 3:return l.sent(),[2,u.ok?"ok":"error"];case 4:if("AbortError"===l.sent().name)return[2,"timed out"];return[2,"error"];case 5:return[3,7];case 6:return[2,new Promise(function(n){var s,i,a,o=t._push(e.type,e,r.timeout||t.timeout);"broadcast"!==e.type||(null==(a=null==(i=null==(s=t.params)?void 0:s.config)?void 0:i.broadcast)?void 0:a.ack)||n("ok"),o.receive("ok",function(){return n("ok")}),o.receive("error",function(){return n("error")}),o.receive("timeout",function(){return n("timed out")})})];case 7:return[2]}})}).apply(this,arguments)}},{key:"updateJoinPayload",value:function(e){this.joinPush.updatePayload(e)}},{key:"unsubscribe",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.timeout;this.state=d.leaving;var r=function(){e.socket.log("channel","leave ".concat(e.topic)),e._trigger(p.close,"leave",e._joinRef())};this.joinPush.destroy();var n=null;return new Promise(function(s){(n=new es(e,p.leave,{},t)).receive("ok",function(){r(),s("ok")}).receive("timeout",function(){r(),s("timed out")}).receive("error",function(){s("error")}),n.send(),e._canPush()||n.trigger("ok",{})}).finally(function(){null==n||n.destroy()})}},{key:"teardown",value:function(){this.pushBuffer.forEach(function(e){return e.destroy()}),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=d.closed,this.bindings={}}},{key:"_fetchWithTimeout",value:function(e,t,r){return(0,K._)(function(){var n,s,i;return(0,I._)(this,function(a){switch(a.label){case 0:return n=new AbortController,s=setTimeout(function(){return n.abort()},r),[4,this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:n.signal}))];case 1:return i=a.sent(),clearTimeout(s),[2,i]}})}).call(this)}},{key:"_push",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.timeout;if(!this.joinedOnce)throw"tried to push '".concat(e,"' to '").concat(this.topic,"' before joining. Use channel.subscribe() before pushing events");var n=new es(this,e,t,r);return this._canPush()?n.send():this._addToPushBuffer(n),n}},{key:"_addToPushBuffer",value:function(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>100){var t=this.pushBuffer.shift();t&&(t.destroy(),this.socket.log("channel","discarded push due to buffer overflow: ".concat(t.event),t.payload))}}},{key:"_onMessage",value:function(e,t,r){return t}},{key:"_isMember",value:function(e){return this.topic===e}},{key:"_joinRef",value:function(){return this.joinPush.ref}},{key:"_trigger",value:function(e,t,r){var n,s,i=this,a=e.toLocaleLowerCase(),o=p.close,u=p.error,c=p.leave,l=p.join;if(!(r&&[o,u,c,l].indexOf(a)>=0)||r===this._joinRef()){var h=this._onMessage(a,t,r);if(t&&!h)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(a)?null==(n=this.bindings.postgres_changes)||n.filter(function(e){var t,r,n;return(null==(t=e.filter)?void 0:t.event)==="*"||(null==(n=null==(r=e.filter)?void 0:r.event)?void 0:n.toLocaleLowerCase())===a}).map(function(e){return e.callback(h,r)}):null==(s=this.bindings[a])||s.filter(function(e){if(!["broadcast","presence","postgres_changes"].includes(a))return e.type.toLocaleLowerCase()===a;if("id"in e){var r,n,s,i,o,u,c=e.id,l=null==(r=e.filter)?void 0:r.event;return c&&(null==(n=t.ids)?void 0:n.includes(c))&&("*"===l||(null==l?void 0:l.toLocaleLowerCase())===(null==(s=t.data)?void 0:s.type.toLocaleLowerCase()))}var h=null==(o=null==(i=null==e?void 0:e.filter)?void 0:i.event)?void 0:o.toLocaleLowerCase();return"*"===h||h===(null==(u=null==t?void 0:t.event)?void 0:u.toLocaleLowerCase())}).map(function(e){if((void 0===h?"undefined":(0,en._)(h))==="object"&&"ids"in h){var t=h.data;h=Object.assign(Object.assign({},{schema:t.schema,table:t.table,commit_timestamp:t.commit_timestamp,eventType:t.type,new:{},old:{},errors:t.errors}),i._getPayloadRecords(t))}e.callback(h,r)})}}},{key:"_isClosed",value:function(){return this.state===d.closed}},{key:"_isJoined",value:function(){return this.state===d.joined}},{key:"_isJoining",value:function(){return this.state===d.joining}},{key:"_isLeaving",value:function(){return this.state===d.leaving}},{key:"_replyEventName",value:function(e){return"chan_reply_".concat(e)}},{key:"_on",value:function(e,t,r){var n=e.toLocaleLowerCase(),s={type:n,filter:t,callback:r};return this.bindings[n]?this.bindings[n].push(s):this.bindings[n]=[s],this}},{key:"_off",value:function(t,r){var n=t.toLocaleLowerCase();return this.bindings[n]&&(this.bindings[n]=this.bindings[n].filter(function(t){var s;return!((null==(s=t.type)?void 0:s.toLocaleLowerCase())===n&&e.isEqual(t.filter,r))})),this}},{key:"_rejoinUntilConnected",value:function(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}},{key:"_onClose",value:function(e){this._on(p.close,{},e)}},{key:"_onError",value:function(e){this._on(p.error,{},function(t){return e(t)})}},{key:"_canPush",value:function(){return this.socket.isConnected()&&this._isJoined()}},{key:"_rejoin",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.timeout;this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=d.joining,this.joinPush.resend(e))}},{key:"_getPayloadRecords",value:function(e){var t={new:{},old:{}};return("INSERT"===e.type||"UPDATE"===e.type)&&(t.new=G(e.columns,e.record)),("UPDATE"===e.type||"DELET
1E"===e.type)&&(t.old=G(e.columns,e.old_record)),t}}],[{key:"isEqual",value:function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var r in e)if(e[r]!==t[r])return!1;return!0}}]),e}(),eo=function(){},eu=[1e3,2e3,5e3,1e4],ec=function(){function t(r,n){var s;if((0,O._)(this,t),this.accessTokenValue=null,this.apiKey=null,this.channels=[],this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=1e4,this.transport=null,this.heartbeatIntervalMs=25e3,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=eo,this.ref=0,this.reconnectTimer=null,this.logger=eo,this.conn=null,this.sendBuffer=[],this.serializer=new J,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=function(t){var r;return r=t||("u"<typeof fetch?function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.A(611737).then(function(e){return e.default.apply(void 0,(0,R._)(r))}).catch(function(e){throw Error("Failed to load @supabase/node-fetch: ".concat(e.message,". ")+"This is required for HTTP requests in Node.js environments without native fetch.")})}:fetch),function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.apply(void 0,(0,R._)(t))}},!(null==(s=null==n?void 0:n.params)?void 0:s.apikey))throw Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey,this.endPoint="".concat(r,"/").concat(v.websocket),this.httpEndpoint=er(r),this._initializeOptions(n),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(null==n?void 0:n.fetch)}
1return(0,A._)(t,[{key:"connect",value:function(){if(!(this.isConnecting()||this.isDisconnecting()||null!==this.conn&&this.isConnected())){if(this._setConnectionState("connecting"),this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=F.createWebSocket(this.endpointURL())}catch(t){this._setConnectionState("disconnected");var e=t.message;if(e.includes("Node.js"))throw Error("".concat(e,"\n\n")+'To use Realtime in Node.js, you need to provide a WebSocket implementation:\n\nOption 1: Use Node.js 22+ which has native WebSocket support\nOption 2: Install and provide the "ws" package:\n\n  npm install ws\n\n  import ws from "ws"\n  const client = new RealtimeClient(url, {\n    ...options,\n    transport: ws\n  })');throw Error("WebSocket not available: ".concat(e))}this._setupConnectionHandlers()}}},{key:"endpointURL",value:function(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:"1.0.0"}))}},{key:"disconnect",value:function(e,t){var r=this;if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){var n=setTimeout(function(){r._setConnectionState("disconnected")},100);this.conn.onclose=function(){clearTimeout(n),r._setConnectionState("disconnected")},e?this.conn.close(e,null!=t?t:""):this.conn.close(),this._teardownConnection()}else this._setConnectionState("disconnected")}},{key:"getChannels",value:function(){return this.channels}},{key:"removeChannel",value:function(e){return(0,K._)(function(){var t;return(0,I._)(this,function(r){switch(r.label){case 0:return[4,e.unsubscribe()];case 1:return t=r.sent(),0===this.channels.length&&this.disconnect(),[2,t]}})}).call(this)}},{key:"removeAllChannels",value:function(){return(0,K._)(function(){var e;return(0,I._)(this,function(t){switch(t.label){case 0:return[4,Promise.all(this.channels.map(function(e){return e.unsubscribe()}))];case 1:return e=t.sent(),this.channels=[],this.disconnect(),[2,e]}})}).call(this)}},{key:"log",value:function(e,t,r){this.logger(e,t,r)}},{key:"connectionState",value:function(){switch(this.conn&&this.conn.readyState){case f.connecting:return g.Connecting;case f.open:return g.Open;case f.closing:return g.Closing;default:return g.Closed}}},{key:"isConnected",value:function(){return this.connectionState()===g.Open}},{key:"isConnecting",value:function(){return"connecting"===this._connectionState}},{key:"isDisconnecting",value:function(){return"disconnecting"===this._connectionState}},{key:"channel",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{config:{}},r="realtime:".concat(e),n=this.getChannels().find(function(e){return e.topic===r});if(n)return n;var s=new ea("realtime:".concat(e),t,this);return this.channels.push(s),s}},{key:"push",value:function(e){var t=this,r=e.topic,n=e.event,s=e.payload,i=e.ref,a=function(){t.encode(e,function(e){var r;null==(r=t.conn)||r.send(e)})};this.log("push","".concat(r," ").concat(n," (").concat(i,")"),s),this.isConnected()?a():this.sendBuffer.push(a)}},{key:"setAuth",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return(0,K._)(function(){return(0,I._)(this,function(t){switch(t.label){case 0:this._authPromise=this._performAuth(e),t.label=1;case 1:return t.trys.push([1,,3,4]),[4,this._authPromise];case 2:return t.sent(),[3,4];case 3:return this._authPromise=null,[7];case 4:return[2]}})}).call(this)}},{key:"sendHeartbeat",value:function(){return(0,K._)(function(){var e,t;return(0,I._)(this,function(r){if(e=this,!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}return[2]}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(e){this.log("error","error in heartbeat callback",e)}return this._wasManualDisconnect=!1,null==(t=this.conn)||t.close(1e3,"heartbeat timeout"),setTimeout(function(){var t;e.isConnected()||null==(t=e.reconnectTimer)||t.scheduleTimeout()},100),[2]}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}return this._setAuthSafely("heartbeat"),[2]})}).call(this)}},{key:"onHeartbeat",value:function(e){this.heartbeatCallback=e}},{key:"flushSendBuffer",value:function(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(function(e){return e()}),this.sendBuffer=[])}},{key:"_makeRef",value:function(){var e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}},{key:"_leaveOpenTopic",value:function(e){var t=this.channels.find(function(t){return t.topic===e&&(t._isJoined()||t._isJoining())});t&&(this.log("transport",'leaving duplicate topic "'.concat(e,'"')),t.unsubscribe())}},{key:"_remove",value:function(e){this.channels=this.channels.filter(function(t){return t.topic!==e.topic})}},{key:"_onConnMessage",value:function(e){var t=this;this.decode(e.data,function(e){if("phoenix"===e.topic&&"phx_reply"===e.event)try{t.heartbeatCallback("ok"===e.payload.status?"ok":"error")}catch(e){t.log("error","error in heartbeat callback",e)}
1e.ref&&e.ref===t.pendingHeartbeatRef&&(t.pendingHeartbeatRef=null);var r=e.topic,n=e.event,s=e.payload,i=e.ref,a=s.status||"";t.log("receive","".concat(a," ").concat(r," ").concat(n," ").concat(i?"(".concat(i,")"):"").trim(),s),t.channels.filter(function(e){return e._isMember(r)}).forEach(function(e){return e._trigger(n,s,i)}),t._triggerStateCallbacks("message",e)})}},{key:"_clearTimer",value:function(e){var t;"heartbeat"===e&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):"reconnect"===e&&(null==(t=this.reconnectTimer)||t.reset())}},{key:"_clearAllTimers",value:function(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}},{key:"_setupConnectionHandlers",value:function(){var e=this;this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=function(){return e._onConnOpen()},this.conn.onerror=function(t){return e._onConnError(t)},this.conn.onmessage=function(t){return e._onConnMessage(t)},this.conn.onclose=function(t){return e._onConnClose(t)})}},{key:"_teardownConnection",value:function(){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(function(e){return e.teardown()})}},{key:"_onConnOpen",value:function(){this._setConnectionState("connected"),this.log("transport","connected to ".concat(this.endpointURL())),this.flushSendBuffer(),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}},{key:"_startHeartbeat",value:function(){var e=this;this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(function(){return e.sendHeartbeat()},this.heartbeatIntervalMs)}},{key:"_startWorkerHeartbeat",value:function(){var e=this;this.workerUrl?this.log("worker","starting worker for from ".concat(this.workerUrl)):this.log("worker","starting default worker");var t=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(t),this.workerRef.onerror=function(t){e.log("worker","worker error",t.message),e.workerRef.terminate()},this.workerRef.onmessage=function(t){"keepAlive"===t.data.event&&e.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}},{key:"_onConnClose",value:function(e){var t;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||null==(t=this.reconnectTimer)||t.scheduleTimeout(),this._triggerStateCallbacks("close",e)}},{key:"_onConnError",value:function(e){this._setConnectionState("disconnected"),this.log("transport","".concat(e)),this._triggerChanError(),this._triggerStateCallbacks("error",e)}},{key:"_triggerChanError",value:function(){this.channels.forEach(function(e){return e._trigger(p.error)})}},{key:"_appendParams",value:function(e,t){if(0===Object.keys(t).length)return e;var r=e.match(/\?/)?"&":"?",n=new URLSearchParams(t);return"".concat(e).concat(r).concat(n)}},{key:"_workerObjectUrl",value:function(e){var t;if(e)t=e;else{var r=new Blob(['\n  addEventListener("message", (e) => {\n    if (e.data.event === "start") {\n      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);\n    }\n  });'],{type:"application/javascript"});t=URL.createObjectURL(r)}return t}},{key:"_setConnectionState",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._connectionState=e,"connecting"===e?this._wasManualDisconnect=!1:"disconnecting"===e&&(this._wasManualDisconnect=t)}},{key:"_performAuth",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return(0,K._)(function(){var t;return(0,I._)(this,function(r){switch(r.label){case 0:if(!e)return[3,1];return t=e,[3,4];case 1:if(!this.accessToken)return[3,3];return[4,this.accessToken()];case 2:return t=r.sent(),[3,4];case 3:t=this.accessTokenValue,r.label=4;case 4:return this.accessTokenValue!=t&&(this.accessTokenValue=t,this.channels.forEach(function(e){var r={access_token:t,version:z};t&&e.updateJoinPayload(r),e.joinedOnce&&e._isJoined()&&e._push(p.access_token,{access_token:t})})),[2]}})}).call(this)}},{key:"_waitForAuthIfNeeded",value:function(){return(0,K._)(function(){return(0,I._)(this,function(e){switch(e.label){case 0:if(!this._authPromise)return[3,2];return[4,this._authPromise];case 1:e.sent(),e.label=2;case 2:return[2]}})}).call(this)}},{key:"_setAuthSafely",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"general";this.setAuth().catch(function(r){e.log("error","error setting auth in ".concat(t),r)})}},{key:"_triggerStateCallbacks",value:function(e,t){var r=this;try{this.stateChangeCallbacks[e].forEach(function(n){try{n(t)}catch(t){r.log("error","error in ".concat(e," callback"),t)}})}catch(t){this.log("error","error triggering ".concat(e," callbacks"),t)}}},{key:"_setupReconnectionTimer",value:function(){var e=this;this.reconnectTimer=new H(function(){return(0,K._)(function(){var e;return(0,I._)(this,function(t){return e=this,setTimeout(function(){return(0,K._)(function(){return(0,I._)(this,function(e){switch(e.label){case 0:return[4,this._waitForAuthIfNeeded()];case 1:return e.sent(),this.isConnected()||this.connect(),[2]}})}).call(e)},10),[2]})}).call(e)},this.reconnectAfterMs)}},{key:"_initializeOptions",value:function(e){var t,r,n,s,i,a,o,u,c;if(this.transport=null!=(t=null==e?void 0:e.transport)?t:null,this.timeout=null!=(r=null==e?void 0:e.timeout)?r:1e4,this.heartbeatIntervalMs=null!=(n=null==e?void 0:e.heartbeatIntervalMs)?n:25e3,this.worker=null!=(s=null==e?void 0:e.worker)&&s,this.accessToken=null!=(i=null==e?void 0:e.accessToken)?i:null,this.heartbeatCallback=null!=(a=null==e?void 0:e.heartbeatCallback)?a:eo,(null==e?void 0:e.params)&&(this.params=e.params),(null==e?void 0:e.logger)&&(this.logger=e.logger),((null==e?void 0:e.logLevel)||(null==e?void 0:e.log_level))&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=null!=(o=null==e?void 0:e.reconnectAfterMs)?o:function(e){return eu[e-1]||1e4},this.encode=null!=(u=null==e?void 0:e.encode)?u:function(e,t){return t(JSON.stringify(e))},this.decode=null!=(c=null==e?void 0:e.decode)?c:this.serializer.decode.bind(this.serializer),this.worker){if("u">typeof window&&!window.Worker)throw Error("Web Worker is not supported");this.workerUrl=null==e?void 0:e.workerUrl}}}]),t}(),el=e.i(467034),eh=function(e){function t(e){var r;return(0,O._)(this,t),(r=(0,C._)(this,t,[e])).__isStorageError=!0,r.name="StorageError",r}return(0,x._)(t,e),t}((0,U._)(Error));function ef(e){return(void 0===e?"undefined":(0,en._)(e))==="object"&&null!==e&&"__isStorageError"in e}var ed=function(e){function t(e,r,n){var s;return(0,O._)(this,t),(s=(0,C._)(this,t,[e])).name="StorageApiError",s.status=r,s.statusCode=n,s}return(0,x._)(t,e),(0,A._)(t,[{key:"toJSON",value:function(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}]),t}(eh),ep=function(e){function t(e,r){var n;return(0,O._)(this,t),(n=(0,C._)(this,t,[e])).name="StorageUnknownError",n.originalError=r,n}return(0,x._)(t,e),t}(eh),ev=e.i(651682),eg=function(t){var r;return r=t||("u"<typeof fetch?function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.A(611737).then(function(e){return e.default.apply(void 0,(0,R._)(r))})}:fetch),function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.apply(void 0,(0,R._)(t))}},e_=function(){var t,r,n,s;return t=void 0,r=void 0,n=void 0,s=function(){return(0,I._)(this,function(t){switch(t.label){case 0:if("u">typeof Response)return[3,2];return[4,e.A(611737)];case 1:return[2,t.sent().Response];case 2:return[2,Response]}})}
1,new(n||(n=Promise))(function(e,i){function a(e){try{u(s.next(e))}catch(e){i(e)}}function o(e){try{u(s.throw(e))}catch(e){i(e)}}function u(t){var r;t.done?e(t.value):(r=t.value,(0,j._)(r,n)?r:new n(function(e){e(r)})).then(a,o)}u((s=s.apply(t,r||[])).next())})},ey=function(e){if(Array.isArray(e))return e.map(function(e){return ey(e)});if("function"==typeof e||e!==Object(e))return e;var t={};return Object.entries(e).forEach(function(e){var r=(0,ev._)(e,2),n=r[0],s=r[1];t[n.replace(/([-_][a-z])/gi,function(e){return e.toUpperCase().replace(/[-_]/g,"")})]=ey(s)}),t},eb=function(e){if((void 0===e?"undefined":(0,en._)(e))!=="object"||null===e)return!1;var t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},em=function(e,t,r,n){return new(r||(r=Promise))(function(s,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function o(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?s(e.value):(t=e.value,(0,j._)(t,r)?t:new r(function(e){e(t)})).then(a,o)}u((n=n.apply(e,t||[])).next())})},ew=function(e){return e.msg||e.message||e.error_description||e.error||JSON.stringify(e)},ek=function(e,t,r,n){var s={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"!==e&&n?(eb(n)?(s.headers=Object.assign({"Content-Type":"application/json"},null==t?void 0:t.headers),s.body=JSON.stringify(n)):s.body=n,(null==t?void 0:t.duplex)&&(s.duplex=t.duplex),Object.assign(Object.assign({},s),r)):s};function eS(e,t,r,n,s,i){return em(this,void 0,void 0,function(){return(0,I._)(this,function(a){return[2,new Promise(function(a,o){e(r,ek(t,n,s,i)).then(function(e){if(!e.ok)throw e;return(null==n?void 0:n.noResolveJson)?e:e.json()}).then(function(e){return a(e)}).catch(function(e){return em(void 0,void 0,void 0,function(){var t;return(0,I._)(this,function(r){switch(r.label){case 0:return[4,e_()];case 1:return t=r.sent(),!(0,j._)(e,t)||(null==n?void 0:n.noResolveJson)?o(new ep(ew(e),e)):e.json().then(function(t){var r=e.status||500,n=(null==t?void 0:t.statusCode)||r+"";o(new ed(ew(t),r,n))}).catch(function(e){o(new ep(ew(e),e))}),[2]}})})})})]})})}function eE(e,t,r,n){return em(this,void 0,void 0,function(){return(0,I._)(this,function(s){return[2,eS(e,"GET",t,r,n)]})})}function eT(e,t,r,n,s){return em(this,void 0,void 0,function(){return(0,I._)(this,function(i){return[2,eS(e,"POST",t,n,s,r)]})})}function eO(e,t,r,n,s){return em(this,void 0,void 0,function(){return(0,I._)(this,function(i){return[2,eS(e,"PUT",t,n,s,r)]})})}function eA(e,t,r,n,s){return em(this,void 0,void 0,function(){return(0,I._)(this,function(i){return[2,eS(e,"DELETE",t,n,s,r)]})})}var ej=function(){function e(t,r){(0,O._)(this,e),this.downloadFn=t,this.shouldThrowOnError=r}return(0,A._)(e,[{key:"then",value:function(e,t){return this.execute().then(e,t)}},{key:"execute",value:function(){var e,t,r,n;return e=this,t=void 0,r=void 0,n=function(){var e;return(0,I._)(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.downloadFn()];case 1:return[2,{data:t.sent().body,error:null}];case 2:if(e=t.sent(),this.shouldThrowOnError)throw e;if(ef(e))return[2,{data:null,error:e}];throw e;case 3:return[2]}})},new(r||(r=Promise))(function(s,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function o(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?s(e.value):(t=e.value,(0,j._)(t,r)?t:new r(function(e){e(t)})).then(a,o)}u((n=n.apply(e,t||[])).next())})}}]),e}(),eI=function(){function e(t,r){(0,O._)(this,e),this.downloadFn=t,this.shouldThrowOnError=r}return(0,A._)(e,[{key:"asStream",value:function(){return new ej(this.downloadFn,this.shouldThrowOnError)}},{key:"then",value:function(e,t){return this.execute().then(e,t)}},{key:"execute",value:function(){var e,t,r,n;return e=this,t=void 0,r=void 0,n=function(){var e,t,r;return(0,I._)(this,function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),[4,this.downloadFn()];case 1:return e=n.sent(),t={},[4,e.blob()];case 2:return[2,(t.data=n.sent(),t.error=null,t)];case 3:if(r=n.sent(),this.shouldThrowOnError)throw r;if(ef(r))return[2,{data:null,error:r}];throw r;case 4:return[2]}})},new(r||(r=Promise))(function(s,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function o(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?s(e.value):(t=e.value,(0,j._)(t,r)?t:new r(function(e){e(t)})).then(a,o)}u((n=n.apply(e,t||[])).next())})}}]),e}(),eR=function(e,t,r,n){return new(r||(r=Promise))(function(s,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function o(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?s(e.value):(t=e.value,(0,j._)(t,r)?t:new r(function(e){e(t)})).then(a,o)}u((n=n.apply(e,t||[])).next())})},eP={limit:100,offset:0,sortBy:{column:"name",order:"asc"}}
1,eC={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},ex=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0;(0,O._)(this,e),this.shouldThrowOnError=!1,this.url=t,this.headers=r,this.bucketId=n,this.fetch=eg(s)}return(0,A._)(e,[{key:"throwOnError",value:function(){return this.shouldThrowOnError=!0,this}},{key:"uploadOrUpdate",value:function(e,t,r,n){return eR(this,void 0,void 0,function(){var s,i,a,o,u,c,l,h;return(0,I._)(this,function(f){switch(f.label){case 0:return f.trys.push([0,2,,3]),i=Object.assign(Object.assign({},eC),n),a=Object.assign(Object.assign({},this.headers),"POST"===e&&{"x-upsert":String(i.upsert)}),o=i.metadata,"u">typeof Blob&&(0,j._)(r,Blob)?((s=new FormData).append("cacheControl",i.cacheControl),o&&s.append("metadata",this.encodeMetadata(o)),s.append("",r)):"u">typeof FormData&&(0,j._)(r,FormData)?((s=r).append("cacheControl",i.cacheControl),o&&s.append("metadata",this.encodeMetadata(o))):(s=r,a["cache-control"]="max-age=".concat(i.cacheControl),a["content-type"]=i.contentType,o&&(a["x-metadata"]=this.toBase64(this.encodeMetadata(o)))),(null==n?void 0:n.headers)&&(a=Object.assign(Object.assign({},a),n.headers)),u=this._removeEmptyFolders(t),c=this._getFinalPath(u),[4,("PUT"==e?eO:eT)(this.fetch,"".concat(this.url,"/object/").concat(c),s,Object.assign({headers:a},(null==i?void 0:i.duplex)?{duplex:i.duplex}:{}))];case 1:return l=f.sent(),[2,{data:{path:u,id:l.Id,fullPath:l.Key},error:null}];case 2:if(h=f.sent(),this.shouldThrowOnError)throw h;
1if(ef(h))return[2,{data:null,error:h}];throw h;case 3:return[2]}})})}},{key:"upload",value:function(e,t,r){return eR(this,void 0,void 0,function(){return(0,I._)(this,function(n){return[2,this.uploadOrUpdate("POST",e,t,r)]})})}},{key:"uploadToSignedUrl",value:function(e,t,r,n){return eR(this,void 0,void 0,function(){var s,i,a,o,u,c,l,h;return(0,I._)(this,function(f){switch(f.label){case 0:s=this._removeEmptyFolders(e),i=this._getFinalPath(s),(a=new URL(this.url+"/object/upload/sign/".concat(i))).searchParams.set("token",t),f.label=1;case 1:return f.trys.push([1,3,,4]),u=Object.assign({upsert:eC.upsert},n),c=Object.assign(Object.assign({},this.headers),{"x-upsert":String(u.upsert)}),"u">typeof Blob&&(0,j._)(r,Blob)?((o=new FormData).append("cacheControl",u.cacheControl),o.append("",r)):"u">typeof FormData&&(0,j._)(r,FormData)?(o=r).append("cacheControl",u.cacheControl):(o=r,c["cache-control"]="max-age=".concat(u.cacheControl),c["content-type"]=u.contentType),[4,eO(this.fetch,a.toString(),o,{headers:c})];case 2:return l=f.sent(),[2,{data:{path:s,fullPath:l.Key},error:null}];case 3:if(h=f.sent(),this.shouldThrowOnError)throw h;
1if(ef(h))return[2,{data:null,error:h}];throw h;case 4:return[2]}})})}},{key:"createSignedUploadUrl",value:function(e,t){return eR(this,void 0,void 0,function(){var r,n,s,i,a,o;return(0,I._)(this,function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),r=this._getFinalPath(e),n=Object.assign({},this.headers),(null==t?void 0:t.upsert)&&(n["x-upsert"]="true"),[4,eT(this.fetch,"".concat(this.url,"/object/upload/sign/").concat(r),{},{headers:n})];case 1:if(s=u.sent(),!(a=(i=new URL(this.url+s.url)).searchParams.get("token")))throw new eh("No token returned by API");return[2,{data:{signedUrl:i.toString(),path:e,token:a},error:null}];case 2:if(o=u.sent(),this.shouldThrowOnError)throw o;if(ef(o))return[2,{data:null,error:o}];throw o;case 3:return[2]}})})}},{key:"update",value:function(e,t,r){return eR(this,void 0,void 0,function(){return(0,I._)(this,function(n){return[2,this.uploadOrUpdate("PUT",e,t,r)]})})}},{key:"move",value:function(e,t,r){return eR(this,void 0,void 0,function(){var n;return(0,I._)(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,eT(this.fetch,"".concat(this.url,"/object/move"),{bucketId:this.bucketId,sourceKey:e,destinationKey:t,de
1stinationBucket:null==r?void 0:r.destinationBucket},{headers:this.headers})];case 1:return[2,{data:s.sent(),error:null}];case 2:if(n=s.sent(),this.shouldThrowOnError)throw n;if(ef(n))return[2,{data:null,error:n}];throw n;case 3:return[2]}})})}},{key:"copy",value:function(e,t,r){return eR(this,void 0,void 0,function(){var n;return(0,I._)(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,eT(this.fetch,"".concat(this.url,"/object/copy"),{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:this.headers})];case 1:return[2,{data:{path:s.sent().Key},error:null}];case 2:if(n=s.sent(),this.shouldThrowOnError)throw n;if(ef(n))return[2,{data:null,error:n}];throw n;case 3:return[2]}})})}},{key:"createSignedUrl",value:function(e,t,r){return eR(this,void 0,void 0,function(){var n,s,i,a;return(0,I._)(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),n=this._getFinalPath(e),[4,eT(this.fetch,"".concat(this.url,"/object/sign/").concat(n),Object.assign({expiresIn:t},(null==r?void 0:r.transform)?{transform:r.transform}:{}),{headers:this.headers})];case 1:return s=o.sent(),i=(null==r?void 0:r.download)?"&download=".concat(!0===r.download?"":r.download):"",[2,{data:s={signedUrl:encodeURI("".concat(this.url).concat(s.signedURL).concat(i))},error:null}];case 2:if(a=o.sent(),this.shouldThrowOnError)throw a;if(ef(a))return[2,{data:null,error:a}];throw a;case 3:return[2]}})})}},{key:"createSignedUrls",value:function(e,t,r){return eR(this,void 0,void 0,function(){var n,s,i,a;return(0,I._)(this,function(o){switch(o.label){case 0:n=this,o.label=1;case 1:return o.trys.push([1,3,,4]),[4,eT(this.fetch,"".concat(this.url,"/object/sign/").concat(this.bucketId),{expiresIn:t,paths:e},{headers:this.headers})];case 2:return s=o.sent(),i=(null==r?void 0:r.download)?"&download=".concat(!0===r.download?"":r.download):"",[2,{data:s.map(function(e){return Object.assign(Object.assign({},e),{signedUrl:e.signedURL?encodeURI("".concat(n.url).concat(e.signedURL).concat(i)):null})}),error:null}];case 3:if(a=o.sent(),this.shouldThrowOnError)throw a;if(ef(a))return[2,{data:null,error:a}];throw a;case 4:return[2]}})})}},{key:"download",value:function(e,t){var r=this,n=void 0!==(null==t?void 0:t.transform)?"render/image/authenticated":"object",s=this.transformOptsToQueryString((null==t?void 0:t.transform)||{}),i=s?"?".concat(s):"",a=this._getFinalPath(e);return new eI(function(){return eE(r.fetch,"".concat(r.url,"/").concat(n,"/").concat(a).concat(i),{headers:r.headers,noResolveJson:!0})},this.shouldThrowOnError)}},{key:"info",value:function(e){return eR(this,void 0,void 0,function(){var t,r;return(0,I._)(this,function(n){switch(n.label){case 0:t=this._getFinalPath(e),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,eE(this.fetch,"".concat(this.url,"/object/info/").concat(t),{headers:this.headers})];case 2:return[2,{data:ey(n.sent()),error:null}];case 3:if(r=n.sent(),this.shouldThrowOnError)throw r;if(ef(r))return[2,{data:null,error:r}];throw r;case 4:return[2]}})})}},{key:"exists",value:function(e){return eR(this,void 0,void 0,function(){var t,r,n;return(0,I._)(this,function(s){switch(s.label){case 0:t=this._getFinalPath(e),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,function(e,t,r,n){return em(this,void 0,void 0,function(){return(0,I._)(this,function(n){return[2,eS(e,"HEAD",t,Object.assign(Object.assign({},r),{noResolveJson:!0}),void 0)]})})}(this.fetch,"".concat(this.url,"/object/").concat(t),{headers:this.headers})];case 2:return s.sent(),[2,{data:!0,error:null}];case 3:if(r=s.sent(),this.shouldThrowOnError)throw r;if(ef(r)&&(0,j._)(r,ep)&&[400,404].includes(null==(n=r.originalError)?void 0:n.status))return[2,{data:!1,error:r}];throw r;case 4:return[2]}})})}},{key:"getPublicUrl",value:function(e,t){var r=this._getFinalPath(e),n=[],s=(null==t?void 0:t.download)?"download=".concat(!0===t.download?"":t.download):"";""!==s&&n.push(s);var i=void 0!==(null==t?void 0:t.transform),a=this.transformOptsToQueryString((null==t?void 0:t.transform)||{});""!==a&&n.push(a);var o=n.join("&");return""!==o&&(o="?".concat(o)),{data:{publicUrl:encodeURI("".concat(this.url,"/").concat(i?"render/image":"object","/public/").concat(r).concat(o))}}}},{key:"remove",value:function(e){return eR(this,void 0,void 0,function(){var t;return(0,I._)(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,eA(this.fetch,"".concat(this.url,"/object/").concat(this.bucketId),{prefixes:e},{headers:this.headers})];case 1:return[2,{data:r.sent(),error:null}];case 2:if(t=r.sent(),this.shouldThrowOnError)throw t;if(ef(t))return[2,{data:null,error:t}];throw t;case 3:return[2]}})})}},{key:"list",value:function(e,t,r){return eR(this,void 0,void 0,function(){var n,s;return(0,I._)(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),n=Object.assign(Object.assign(Object.assign({},eP),t),{prefix:e||""}),[4,eT(this.fetch,"".concat(this.url,"/object/list/").concat(this.bucketId),n,{headers:this.headers},r)];case 1:return[2,{data:i.sent(),error:null}];case 2:if(s=i.sent(),this.shouldThrowOnError)throw s;if(ef(s))return[2,{data:null,error:s}];throw s;case 3:return[2]}})})}},{key:"listV2",value:function(e,t){return eR(this,void 0,void 0,function(){var r,n;return(0,I._)(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),r=Object.assign({},e),[4,eT(this.fetch,"".concat(this.url,"/object/list-v2/").concat(this.bucketId),r,{headers:this.headers},t)];case 1:return[2,{data:s.sent(),error:null}];case 2:if(n=s.sent(),this.shouldThrowOnError)throw n;if(ef(n))return[2,{data:null,error:n}];throw n;case 3:return[2]}})})}},{key:"encodeMetadata",value:function(e){return JSON.stringify(e)}},{key:"toBase64",value:function(e){return void 0!==el.Buffer?el.Buffer.from(e).toString("base64"):btoa(e)}},{key:"_getFinalPath",value:function(e){return"".concat(this.bucketId,"/").concat(e.replace(/^\/+/,""))}},{key:"_removeEmptyFolders",value:function(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}},{key:"transformOptsToQueryString",value:function(e){var t=[];return e.width&&t.push("width=".concat(e.width)),e.height&&t.push("height=".concat(e.height)),e.resize&&t.push("resize=".concat(e.resize)),e.format&&t.push("format=".concat(e.format)),e.quality&&t.push("quality=".concat(e.quality)),t.join("&")}}]),e}(),eU={"X-Client-Info":"storage-js/".concat("2.75.0")},eN=function(e,t,r,n){return new(r||(r=Promise))(function(s,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function o(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?s(e.value):(t=e.value,(0,j._)(t,r)?t:new r(function(e){e(t)})).then(a,o)}u((n=n.apply(e,t||[])).next())})},eL=function(e){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0;return(0,O._)(this,t),(0,C._)(this,t,[e,r,n,s])}return(0,x._)(t,e),(0,A._)(t,[{key:"from",value:function(e){return new ex(this.url,this.headers,e,this.fetch)}}]),t}(function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0;(0,O._)(this,e),this.shouldThrowOnError=!1;var i=new URL(t);(null==s?void 0:s.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.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},eU),r),this.fetch=eg(n)}return(0,A._)(e,[{key:"throwOnError",value:function(){return this.shouldThrowOnError=!0,this}},{key:"listBuckets",value:function(){return eN(this,void 0,void 0,function(){var e;return(0,I._)(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,eE(this.fetch,"".concat(this.url,"/bucket"),{headers:this.headers})];case 1:return[2,{data:t.sent(),error:null}];case 2:if(e=t.sent(),this.shouldThrowOnError)throw e;if(ef(e))return[2,{data:null,error:e}];throw e;case 3:return[2]}})})}},{key:"getBucket",value:function(e){return eN(this,void 0,void 0,function(){var t;return(0,I._)(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,eE(this.fetch,"".concat(this.url,"/bucket/").concat(e),{headers:this.headers})];case 1:return[2,{data:r.sent(),error:null}];case 2:if(t=r.sent(),this.shouldThrowOnError)throw t;if(ef(t))return[2,{data:null,error:t}];throw t;case 3:return[2]}})})}},{key:"createBucket",value:function(e){return eN(this,arguments,void 0,function(e){var t,r,n=arguments;return(0,I._)(this,function(s){switch(s.label){case 0:t=n.length>1&&void 0!==n[1]?n[1]:{public:!1},s.label=1;case 1:return s.trys.push([1,3,,4]),[4,eT(this.fetch,"".concat(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})];case 2:return[2,{data:s.sent(),error:null}];case 3:if(r=s.sent(),this.shouldThrowOnError)throw r;if(ef(r))return[2,{data:null,error:r}];throw r;case 4:return[2]}})})}},{key:"updateBucket",value:function(e,t){return eN(this,void 0,void 0,function(){var r;return(0,I._)(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,eO(this.fetch,"".concat(this.url,"/bucket/").concat(e),{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers})];case 1:return[2,{data:n.sent(),error:null}];case 2:if(r=n.sent(),this.shouldThrowOnError)throw r;if(ef(r))return[2,{data:null,error:r}];throw r;case 3:return[2]}})})}},{key:"emptyBucket",value:function(e){return eN(this,void 0,void 0,function(){var t;return(0,I._)(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,eT(this.fetch,"".concat(this.url,"/bucket/").concat(e,"/empty"),{},{headers:this.headers})];case 1:return[2,{data:r.sent(),error:null}];case 2:if(t=r.sent(),this.shouldThrowOnError)throw t;if(ef(t))return[2,{data:null,error:t}];throw t;case 3:return[2]}})})}},{key:"deleteBucket",value:function(e){return eN(this,void 0,void 0,function(){var t;return(0,I._)(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,eA(this.fetch,"".concat(this.url,"/bucket/").concat(e),{},{headers:this.headers})];case 1:return[2,{data:r.sent(),error:null}];case 2:if(t=r.sent(),this.shouldThrowOnError)throw t;if(ef(t))return[2,{data:null,error:t}];throw t;case 3:return[2]}})})}}]),e}()),eB="";eB="u">typeof Deno?"deno":"u">typeof document?"web":"u">typeof navigator&&"ReactNative"===navigator.product?"react-native":"node";var eD={headers:{"X-Client-Info":"supabase-js-".concat(eB,"/").concat("2.75.0")}},eq={schema:"public"},eM={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},eW={},eK=e.i(906085),eF=function(e){var t;return t=e||("u"<typeof fetch?eK.default:fetch),function(){for(var e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];return t.apply(void 0,(0,R._)(r))}},ez=function(e,t,r){var n=eF(r),s="u"<typeof Headers?eK.Headers:Headers;return function(r,i){var a,o,u,c;return a=void 0,o=void 0,u=void 0,c=function(){var a,o,u;return(0,I._)(this,function(c){switch(c.label){case 0:return[4,t()];case 1:return o=null!=(a=c.sent())?a:e,(u=new s(null==i?void 0:i.headers)).has("apikey")||u.set("apikey",e),u.has("Authorization")||u.set("Authorization","Bearer ".concat(o)),[2,n(r,Object.assign(Object.assign({},i),{headers:u}))]}})},new(u||(u=Promise))(function(e,t){function r(e){try{s(c.next(e))}catch(e){t(e)}}function n(e){try{s(c.throw(e))}catch(e){t(e)}}function s(t){var s;t.done?e(t.value):(s=t.value,(0,j._)(s,u)?s:new u(function(e){e(s)})).then(r,n)}s((c=c.apply(a,o||[])).next())})}},eJ="2.75.0",eH="X-Supabase-Api-Version",eG={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},eV=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,eY=function(e){function t(e,r,n){var s;return(0,O._)(this,t),(s=(0,C._)(this,t,[e])).__isAuthError=!0,s.name="AuthError",s.status=r,s.code=n,s}return(0,x._)(t,e),t}((0,U._)(Error));function e$(e){return(void 0===e?"undefined":(0,en._)(e))==="object"&&null!==e&&"__isAuthError"in e}var eQ=function(e){function t(e,r,n){var s;return(0,O._)(this,t),(s=(0,C._)(this,t,[e,r,n])).name="AuthApiError",s.status=r,s.code=n,s}return(0,x._)(t,e),t}(eY),eX=function(e){function t(e,r){var n;return(0,O._)(this,t),(n=(0,C._)(this,t,[e])).name="AuthUnknownError",n.originalError=r,n}return(0,x._)(t,e),t}(eY),eZ=function(e){function t(e,r,n,s){var i;return(0,O._)(this,t),(i=(0,C._)(this,t,[e,n,s])).name=r,i.status=n,i}return(0,x._)(t,e),t}(eY),e0=function(e){function t(){return(0,O._)(this,t),(0,C._)(this,t,["Auth session missing!","AuthSessionMissingError",400,void 0])}return(0,x._)(t,e),t}(eZ),e2=function(e){function t(){return(0,O._)(this,t),(0,C._)(this,t,["Auth session or user missing","AuthInvalidToken
1ResponseError",500,void 0])}return(0,x._)(t,e),t}(eZ),e1=function(e){function t(e){return(0,O._)(this,t),(0,C._)(this,t,[e,"AuthInvalidCredentialsError",400,void 0])}return(0,x._)(t,e),t}(eZ),e4=function(e){function t(e){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return(0,O._)(this,t),(r=(0,C._)(this,t,[e,"AuthImplicitGrantRedirectError",500,void 0])).details=null,r.details=n,r}return(0,x._)(t,e),(0,A._)(t,[{key:"toJSON",value:function(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}]),t}(eZ),e3=function(e){function t(e){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return(0,O._)(this,t),(r=(0,C._)(this,t,[e,"AuthPKCEGrantCodeExchangeError",500,void 0])).details=null,r.details=n,r}return(0,x._)(t,e),(0,A._)(t,[{key:"toJSON",value:function(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}]),t}(eZ),e5=function(e){function t(e,r){return(0,O._)(this,t),(0,C._)(this,t,[e,"AuthRetryableFetchError",r,void 0])}return(0,x._)(t,e),t}(eZ);function e6(e){return e$(e)&&"AuthRetryableFetchError"===e.name}var e8=function(e){function t(e,r,n){var s;return(0,O._)(this,t),(s=(0,C._)(this,t,[e,"AuthWeakPasswordError",r,"weak_password"])).reasons=n,s}return(0,x._)(t,e),t}(eZ),e7=function(e){function t(e){return(0,O._)(this,t),(0,C._)(this,t,[e,"AuthInvalidJwtError",400,"invalid_jwt"])}return(0,x._)(t,e),t}(eZ),e9="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),te=" 	\n\r=".split(""),tt=function(){for(var e=Array(128),t=0;t<e.length;t+=1)e[t]=-1;for(var r=0;r<te.length;r+=1)e[te[r].charCodeAt(0)]=-2;for(var n=0;n<e9.length;n+=1)e[e9[n].charCodeAt(0)]=n;return e}();function tr(e,t,r){if(null!==e)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;)r(e9[t.queue>>t.queuedBits-6&63]),t.queuedBits-=6;else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;)r(e9[t.queue>>t.queuedBits-6&63]),t.queuedBits-=6}function tn(e,t,r){var n=tt[e];if(n>-1)for(t.queue=t.queue<<6|n,t.queuedBits+=6;t.queuedBits>=8;)r(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else if(-2===n)return;else throw Error('Invalid Base64-URL character "'.concat(String.fromCharCode(e),'"'))}function ts(e){for(var t=[],r=function(e){t.push(String.fromCodePoint(e))},n={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=function(e){!function(e,t,r){if(0===t.utf8seq){if(e<=127)return r(e);for(var n=1;n<6;n+=1)if((e>>7-n&1)==0){t.utf8seq=n;break}if(2===t.utf8seq)t.codepoint=31&e;else if(3===t.utf8seq)t.codepoint=15&e;else if(4===t.utf8seq)t.codepoint=7&e;else throw Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|63&e,t.utf8seq-=1,0===t.utf8seq&&r(t.codepoint)}}(e,n,r)},a=0;a<e.length;a+=1)tn(e.charCodeAt(a),s,i);return t.join("")}function ti(e){for(var t=[],r={queue:0,queuedBits:0},n=function(e){t.push(e)},s=0;s<e.length;s+=1)tn(e.charCodeAt(s),r,n);return new Uint8Array(t)}function ta(e){var t=[],r={queue:0,queuedBits:0},n=function(e){t.push(e)};return e.forEach(function(e){return tr(e,r,n)}),tr(null,r,n),t.join("")}var to=function(){return"u">typeof window&&"u">typeof document},tu={tested:!1,writable:!1},tc=function(){if(!to())return!1;try{if("object"!==(0,en._)(globalThis.localStorage))return!1}catch(e){return!1}if(tu.tested)return tu.writable;var e="lswt-".concat(Math.random()).concat(Math.random());try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),tu.tested=!0,tu.writable=!0}catch(e){tu.tested=!0,tu.writable=!1}return tu.writable},tl=function(t){var r;return r=t||("u"<typeof fetch?function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.A(611737).then(function(e){return e.default.apply(void 0,(0,R._)(r))})}:fetch),function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.apply(void 0,(0,R._)(t))}},th=function(e,t,r){return(0,K._)(function(){return(0,I._)(this,function(n){switch(n.label){case 0:return[4,e.setItem(t,JSON.stringify(r))];case 1:return n.sent(),[2]}})})()},tf=function(e,t){return(0,K._)(function(){var r;return(0,I._)(this,function(n){switch(n.label){case 0:return[4,e.getItem(t)];case 1:if(!(r=n.sent()))return[2,null];try{return[2,JSON.parse(r)]}catch(e){return[2,r]}}})})()},td=function(e,t){return(0,K._)(function(){return(0,I._)(this,function(r){switch(r.label){case 0:return[4,e.removeItem(t)];case 1:return r.sent(),[2]}})})()},tp=function e(){var t=this;(0,O._)(this,e),this.promise=new e.promiseConstructor(function(e,r){t.resolve=e,t.reject=r})};function tv(e){var t=e.split(".");if(3!==t.length)throw new e7("Invalid JWT structure");for(var r=0;r<t.length;r++)if(!eV.test(t[r]))throw new e7("JWT not in base64url format");return{header:JSON.parse(ts(t[0])),payload:JSON.parse(ts(t[1])),signature:ti(t[2]),raw:{header:t[0],payload:t[1]}}}function tg(e){return("0"+e.toString(16)).substr(-2)}function t_(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return(0,K._)(function(){var n,s,i,a;return(0,I._)(this,function(o){switch(o.label){case 0:return s=n=function(){var e=new Uint32Array(56);if("u"<typeof crypto){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=t.length,n="",s=0;s<56;s++)n+=t.charAt(Math.floor(Math.random()*r));return n}return crypto.getRandomValues(e),Array.from(e,tg).join("")}(),r&&(s+="/PASSWORD_RECOVERY"),[4,th(e,"".concat(t,"-code-verifier"),s)];case 1:var u;return o.sent(),[4,(u=n,(0,K._)(function(){return(0,I._)(this,function(e){switch(e.label){case 0:if(!("u">typeof crypto&&void 0!==crypto.subtle&&"u">typeof TextEncoder))return console.warn("WebCrypto API is not supported. Code 
1challenge method will default to use plain instead of sha256."),[2,u];return[4,(0,K._)(function(){var e;return(0,I._)(this,function(t){switch(t.label){case 0:return e=new TextEncoder().encode(u),[4,crypto.subtle.digest("SHA-256",e)];case 1:return[2,Array.from(new Uint8Array(t.sent())).map(function(e){return String.fromCharCode(e)}).join("")]}})})()];case 1:return[2,btoa(e.sent()).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")]}})})())];case 2:return i=o.sent(),a=n===i?"plain":"s256",[2,[i,a]]}})})()}tp.promiseConstructor=Promise;var ty=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i,tb=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function tm(e){if(!tb.test(e))throw Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function tw(){return new Proxy({},{get:function(e,t){if("__isUserNotAvailableProxy"===t)return!0;if((void 0===t?"undefined":(0,en._)(t))==="symbol"){var r=t.toString();if("Symbol(Symbol.toPrimitive)"===r||"Symbol(Symbol.toStringTag)"===r||"Symbol(util.inspect.custom)"===r)return}throw Error('@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "'.concat(t,'" property of the session object is not supported. Please use getUser() instead.'))},set:function(e,t){throw Error('@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "'.concat(t,'" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.'))},deleteProperty:function(e,t){throw Error('@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "'.concat(t,'" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.'))}})}function tk(e){return JSON.parse(JSON.stringify(e))}var tS=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)0>t.indexOf(n[s])&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r},tE=function(e){return e.msg||e.message||e.error_description||e.error||JSON.stringify(e)},tT=[502,503,504];function tO(e){return(0,K._)(function(){var t,r,n,s,i;return(0,I._)(this,function(a){switch(a.label){case 0:if(!((void 0===e?"undefined":(0,en._)(e))==="object"&&null!==e&&"status"in e&&"ok"in e&&"json"in e&&"function"==typeof e.json))throw new e5(tE(e),0);if(tT.includes(e.status))throw new e5(tE(e),e.status);a.label=1;case 1:return a.trys.push([1,3,,4]),[4,e.json()];case 2:return r=a.sent(),[3,4];case 3:throw new eX(tE(n=a.sent()),n);case 4:if(s=void 0,(i=function(e){var t=e.headers.get(eH);if(!t||!t.match(ty))return null;try{return new Date("".concat(t,"T00:00:00.0Z"))}catch(e){return null}}(e))&&i.getTime()>=eG["2024-01-01"].timestamp&&(void 0===r?"undefined":(0,en._)(r))==="object"&&r&&"string"==typeof r.code?s=r.code:(void 0===r?"undefined":(0,en._)(r))==="object"&&r&&"string"==typeof r.error_code&&(s=r.error_code),s){if("weak_password"===s)throw new e8(tE(r),e.status,(null==(t=r.weak_password)?void 0:t.reasons)||[]);else if("session_not_found"===s)throw new e0}else if((void 0===r?"undefined":(0,en._)(r))==="object"&&r&&"object"===(0,en._)(r.weak_password)&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce(function(e,t){return e&&"string"==typeof t},!0))throw new e8(tE(r),e.status,r.weak_password.reasons);throw new eQ(tE(r),e.status||500,s)}})})()}var tA=function(e,t,r,n){var s={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"===e?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},null==t?void 0:t.headers),s.body=JSON.stringify(n),Object.assign(Object.assign({},s),r))};function tj(e,t,r,n){return(0,K._)(function(){var s,i,a,o;return(0,I._)(this,function(u){switch(u.label){case 0:var c,l,h,f,d,p;return(i=Object.assign({},null==n?void 0:n.headers))[eH]||(i[eH]=eG["2024-01-01"].name),(null==n?void 0:n.jwt)&&(i.Authorization="Bearer ".concat(n.jwt)),a=null!=(s=null==n?void 0:n.query)?s:{},(null==n?void 0:n.redirectTo)&&(a.redirect_to=n.redirectTo),[4,(c=e,l=t,h=r+(Object.keys(a).length?"?"+new URLSearchParams(a).toString():""),f={headers:i,noResolveJson:null==n?void 0:n.noResolveJson},d={},p=null==n?void 0:n.body,(0,K._)(function(){var e,t,r;return(0,I._)(this,function(n){switch(n.label){case 0:e=tA(l,f,d,p),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,c(h,Object.assign({},e))];case 2:return t=n.sent(),[3,4];case 3:throw console.error(r=n.sent()),new e5(tE(r),0);case 4:if(t.ok)return[3,6];return[4,tO(t)];case 5:n.sent(),n.label=6;case 6:if(null==f?void 0:f.noResolveJson)return[2,t];n.label=7;case 7:return n.trys.push([7,9,,11]),[4,t.json()];case 8:return[2,n.sent()];case 9:return[4,tO(n.sent())];case 10:return n.sent(),[3,11];case 11:return[2]}})})())];case 1:return o=u.sent(),[2,(null==n?void 0:n.xform)?null==n?void 0:n.xform(o):{data:Object.assign({},o),error:null}]}})})()}function tI(e){var t,r,n,s=null;(t=e).access_token&&t.refresh_token&&t.expires_in&&(s=Object.assign({},e),e.expires_at||(s.expires_at=(r=e.expires_in,Math.round(Date.now()/1e3)+r)));return{data:{session:s,user:null!=(n=e.user)?n:e},error:null}}function tR(e){var t=tI(e);return!t.error&&e.weak_password&&"object"===(0,en._)(e.weak_password)&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&"string"==typeof e.weak_password.message&&e.weak_password.reasons.reduce(function(e,t){return e&&"string"==typeof t},!0)&&(t.data.weak_password=e.weak_password),t}function tP(e){var t;return{data:{user:null!=(t=e.user)?t:e},error:null}}function tC(e){return{data:e,error:null}}function tx(e){return{data:{properties:{action_link:e.action_link,email_otp:e.email_otp,hashed_token:e.hashed_token,redirect_to:e.redirect_to,verification_type:e.verification_type},user:Object.assign({},tS(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]))},error:null}}function tU(e){return e}var tN=["global","local","others"],tL=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)0>t.indexOf(n[s])&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r},tB=function(){function e(t){var r=t.url,n=t.headers,s=t.fetch;(0,O._)(this,e),this.url=void 0===r?"":r,this.headers=void 0===n?{}:n,this.fetch=tl(s),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}return(0,A._)(e,[{key:"signOut",value:function(e){return(0,K._)(function(e){var t,r,n=arguments;return(0,I._)(this,function(s){switch(s.label){case 0:if(t=n.length>1&&void 0!==n[1]?n[1]:tN[0],0>tN.indexOf(t))throw Error("@supabase/auth-js: Parameter scope must be one of ".concat(tN.join(", ")));s.label=1;case 1:return s.trys.push([1,3,,4]),[4,tj(this.fetch,"POST","".concat(this.url,"/logout?scope=").concat(t),{headers:this.headers,jwt:e,noResolveJson:!0})];case 2:return s.sent(),[2,{data:null,error:null}];case 3:if(e$(r=s.sent()))return[2,{data:null,error:r}];throw r;case 4:return[2]}})}).apply(this,arguments)}},{key:"inviteUserByEmail",value:function(e){return(0,K._)(function(e){var t,r,n=arguments;return(0,I._)(this,function(s){switch(s.label){case 0:t=n.length>1&&void 0!==n[1]?n[1]:{},s.label=1;case 1:return s.trys.push([1,3,,4]),[4,tj(this.fetch,"POST","".concat(this.url,"/invite"),{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:tP})];case 2:return[2,s.sent()];case 3:if(e$(r=s.sent()))return[2,{data:{user:null},error:r}];throw r;case 4:return[2]}})}).apply(this,arguments)}},{key:"generateLink",value:function(e){return(0,K._)(function(){var t,r,n,s;return(0,I._)(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t=e.options,n=Object.assign(Object.assign({},r=tL(e,["options"])),t),"newEmail"in r&&(n.new_email=null==r?void 0:r.newEmail,delete n.newEmail),[4,tj(this.fetch,"POST","".concat(this.url,"/admin/generate_link"),{body:n,headers:this.headers,xform:tx,redirectTo:null==t?void 0:t.redirectTo})];case 1:return[2,i.sent()];case 2:if(e$(s=i.sent()))return[2,{data:{properties:null,user:null},error:s}];throw s;case 3:return[2]}})}).call(this)}},{key:"createUser",value:function(e){return(0,K._)(function(){var t;return(0,I._)(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,tj(this.fetch,"POST","".concat(this.url,"/admin/users"),{body:e,headers:this.headers,xform:tP})];case 1:return[2,r.sent()];case 2:if(e$(t=r.sent()))return[2,{data:{user:null},error:t}];throw t;case 3:return[2]}})}).call(this)}},{key:"listUsers",value:function(e){return(0,K._)(function(){var t,r,n,s,i,a,o,u,c,l,h,f,d;return(0,I._)(this,function(p){switch(p.label){case 0:return p.trys.push([0,3,,4]),u={nextPage:null,lastPage:0,total:0},[4,tj(this.fetch,"GET","".concat(this.url,"/admin/users"),{headers:this.headers,noResolveJson:!0,query:{page:null!=(r=null==(t=null==e?void 0:e.page)?void 0:t.toString())?r:"",per_page:null!=(s=null==(n=null==e?void 0:e.perPage)?void 0:n.toString())?s:""},xform:tU})];case 1:if((c=p.sent()).error)throw c.error;return[4,c.json()];case 2:return l=p.sent(),h=null!=(i=c.headers.get("x-total-count"))?i:0,(f=null!=(o=null==(a=c.headers.get("link"))?void 0:a.split(","))?o:[]).length>0&&(f.forEach(function(e){var t=parseInt(e.split(";")[0].split("=")[1].substring(0,1)),r=JSON.parse(e.split(";")[1].split("=")[1]);u["".concat(r,"Page")]=t}),u.total=parseInt(h)),[2,{data:Object.assign(Object.assign({},l),u),error:null}];case 3:if(e$(d=p.sent()))return[2,{data:{users:[]},error:d}];throw d;case 4:return[2]}})}).call(this)}},{key:"getUserById",value:function(e){return(0,K._)(function(){var t;return(0,I._)(this,function(r){switch(r.label){case 0:tm(e),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,tj(this.fetch,"GET","".concat(this.url,"/admin/users/").concat(e),{headers:this.headers,xform:tP})];case 2:return[2,r.sent()];case 3:if(e$(t=r.sent()))return[2,{data:{user:null},error:t}];throw t;case 4:return[2]}})}).call(this)}},{key:"updateUserById",value:function(e,t){return(0,K._)(function(){var r;return(0,I._)(this,function(n){switch(n.label){case 0:tm(e),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,tj(this.fetch,"PUT","".concat(this.url,"/admin/users/").concat(e),{body:t,headers:this.headers,xform:tP})];case 2:return[2,n.sent()];case 3:if(e$(r=n.sent()))return[2,{data:{user:null},error:r}];throw r;case 4:return[2]}})}).call(this)}},{key:"deleteUser",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(0,K._)(function(){var r;return(0,I._)(this,function(n){switch(n.label){case 0:tm(e),n.label=1;
1case 1:return n.trys.push([1,3,,4]),[4,tj(this.fetch,"DELETE","".concat(this.url,"/admin/users/").concat(e),{headers:this.headers,body:{should_soft_delete:t},xform:tP})];case 2:return[2,n.sent()];case 3:if(e$(r=n.sent()))return[2,{data:{user:null},error:r}];throw r;case 4:return[2]}})}).call(this)}},{key:"_listFactors",value:function(e){return(0,K._)(function(){var t,r;return(0,I._)(this,function(n){switch(n.label){case 0:tm(e.userId),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,tj(this.fetch,"GET","".concat(this.url,"/admin/users/").concat(e.userId,"/factors"),{headers:this.headers,xform:function(e){return{data:{factors:e},error:null}}})];case 2:return[2,{data:(t=n.sent()).data,error:t.error}];case 3:if(e$(r=n.sent()))return[2,{data:null,error:r}];throw r;case 4:return[2]}})}).call(this)}},{key:"_deleteFactor",value:function(e){return(0,K._)(function(){var t;return(0,I._)(this,function(r){switch(r.label){case 0:tm(e.userId),tm(e.id),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,tj(this.fetch,"DELETE","".concat(this.url,"/admin/users/").concat(e.userId,"/factors/").concat(e.id),{headers:this.headers})];case 2:return[2,{data:r.sent(),error:null}];case 3:if(e$(t=r.sent()))return[2,{data:null,error:t}];throw t;case 4:return[2]}})}).call(this)}},{key:"_listOAuthClients",value:function(e){return(0,K._)(function(){var t,r,n,s,i,a,o,u,c,l,h,f,d;return(0,I._)(this,function(p){switch(p.label){case 0:return p.trys.push([0,3,,4]),u={nextPage:null,lastPage:0,total:0},[4,tj(this.fetch,"GET","".concat(this.url,"/admin/oauth/clients"),{headers:this.headers,noResolveJson:!0,query:{page:null!=(r=null==(t=null==e?void 0:e.page)?void 0:t.toString())?r:"",per_page:null!=(s=null==(n=null==e?void 0:e.perPage)?void 0:n.toString())?s:""},xform:tU})];case 1:if((c=p.sent()).error)throw c.error;return[4,c.json()];case 2:return l=p.sent(),h=null!=(i=c.headers.get("x-total-count"))?i:0,(f=null!=(o=null==(a=c.headers.get("link"))?void 0:a.split(","))?o:[]).length>0&&(f.forEach(function(e){var t=parseInt(e.split(";")[0].split("=")[1].substring(0,1)),r=JSON.parse(e.split(";")[1].split("=")[1]);u["".concat(r,"Page")]=t}),u.total=parseInt(h)),[2,{data:Object.assign(Object.assign({},l),u),error:null}];case 3:if(e$(d=p.sent()))return[2,{data:{clients:[]},error:d}];throw d;case 4:return[2]}})}).call(this)}},{key:"_createOAuthClient",value:function(e){return(0,K._)(function(){var t;return(0,I._)(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,tj(this.fetch,"POST","".concat(this.url,"/admin/oauth/clients"),{body:e,headers:this.headers,xform:function(e){return{data:e,error:null}}})];case 1:return[2,r.sent()];case 2:if(e$(t=r.sent()))return[2,{data:null,error:t}];throw t;case 3:return[2]}})}).call(this)}},{key:"_getOAuthClient",value:function(e){return(0,K._)(function(){var t;return(0,I._)(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,tj(this.fetch,"GET","".concat(this.url,"/admin/oauth/clients/").concat(e),{headers:this.headers,xform:function(e){return{data:e,error:null}}})];case 1:return[2,r.sent()];case 2:if(e$(t=r.sent()))return[2,{data:null,error:t}];throw t;case 3:return[2]}})}).call(this)}},{key:"_deleteOAuthClient",value:function(e){return(0,K._)(function(){var t;return(0,I._)(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,tj(this.fetch,"DELETE","".concat(this.url,"/admin/oauth/clients/").concat(e),{headers:this.headers,xform:function(e){return{data:e,error:null}}})];case 1:return[2,r.sent()];case 2:if(e$(t=r.sent()))return[2,{data:null,error:t}];throw t;case 3:return[2]}})}).call(this)}},{key:"_regenerateOAuthClientSecret",value:function(e){return(0,K._)(function(){var t;return(0,I._)(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,tj(this.fetch,"POST","".concat(this.url,"/admin/oauth/clients/").concat(e,"/regenerate_secret"),{headers:this.headers,xform:function(e){return{data:e,error:null}}})];case 1:return[2,r.sent()];case 2:if(e$(t=r.sent()))return[2,{data:null,error:t}];throw t;case 3:return[2]}})}).call(this)}}]),e}();function tD(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{getItem:function(t){return e[t]||null},setItem:function(t,r){e[t]=r},removeItem:function(t){delete e[t]}}}var tq={debug:!!(globalThis&&tc()&&globalThis.localStorage&&"true"===globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug"))},tM=function(e){function t(e){var r;return(0,O._)(this,t),(r=(0,C._)(this,t,[e])).isAcquireTimeout=!0,r}return(0,x._)(t,e),t}((0,U._)(Error)),tW=function(e){function t(){return(0,O._)(this,t),(0,C._)(this,t,arguments)}return(0,x._)(t,e),t}(tM);function tK(e,t,r){return(0,K._)(function(){var n;return(0,I._)(this,function(s){switch(s.label){case 0:return tq.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t),n=new globalThis.AbortController,t>0&&setTimeout(function(){n.abort(),tq.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),[4,Promise.resolve().then(function(){return globalThis.navigator.locks.request(e,0===t?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:n.signal},function(n){return(0,K._)(function(){return(0,I._)(this,function(s){switch(s.label){case 0:if(!n)return[3,5];tq.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,n.name),s.label=1;case 1:return s.trys.push([1,,3,4]),[4,r()];case 2:return[2,s.sent()];case 3:return tq.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,n.name),[7];case 4:return[3,12];case 5:if(0!==t)return[3,6];throw tq.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new tW('Acquiring an exclusive Navigator LockManager lock "'.concat(e,'" immediately failed'));case 6:if(!tq.debug)return[3,10];s.label=7;case 7:return s.trys.push([7,9,,10]),[4,globalThis.navigator.locks.query()];case 8:return console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(s.sent(),null,"  ")),[3,10];case 9:return console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",s.sent()),[3,10];case 10: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"),[4,r()];case 11:return[2,s.sent()];case 12:return[2]}})})()})})];case 1:return[2,s.sent()]}})})()}function tF(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw Error('@supabase/auth-js: Address "'.concat(e,'" is invali
1d.'));return e.toLowerCase()}(0,x._)(function e(){return(0,O._)(this,e),(0,C._)(this,e,arguments)},tM);var tz=function(e){function t(e){var r,n,s=e.message,i=e.code,a=e.cause,o=e.name;return(0,O._)(this,t),(r=(0,C._)(this,t,[s,{cause:a}])).__isWebAuthnError=!0,r.name=null!=(n=null!=o?o:(0,j._)(a,Error)?a.name:void 0)?n:"Unknown Error",r.code=i,r}return(0,x._)(t,e),t}((0,U._)(Error)),tJ=function(e){function t(e,r){var n;return(0,O._)(this,t),(n=(0,C._)(this,t,[{code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:e}])).name="WebAuthnUnknownError",n.originalError=r,n}return(0,x._)(t,e),t}(tz),tH=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)0>t.indexOf(n[s])&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r},tG=new(function(){function e(){(0,O._)(this,e)}return(0,A._)(e,[{key:"createNewAbortSignal",value:function(){if(this.controller){var e=Error("Cancelling existing WebAuthn API call for new one");e.name="AbortError",this.controller.abort(e)}var t=new AbortController;return this.controller=t,t.signal}},{key:"cancelCeremony",value:function(){if(this.controller){var e=Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}]),e}());function tV(e){return"localhost"===e||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function tY(){var e,t;return!!(to()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&"function"==typeof(null==(e=null==navigator?void 0:navigator.credentials)?void 0:e.create)&&"function"==typeof(null==(t=null==navigator?void 0:navigator.credentials)?void 0:t.get))}var t$={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"none"},tQ={userVerification:"preferred",hints:["security-key"]};function tX(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=function(e){return null!==e&&(void 0===e?"undefined":(0,en._)(e))==="object"&&!Array.isArray(e)},s={},i=!0,a=!1,o=void 0;try{for(var u,c=t[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var l=u.value;if(l)for(var h in l){var f=l[h];if(void 0!==f)if(Array.isArray(f))s[h]=f;else if((0,j._)(f,ArrayBuffer)||ArrayBuffer.isView(f))s[h]=f;else if(n(f)){var d=s[h];n(d)?s[h]=tX(d,f):s[h]=tX(f)}else s[h]=f}}}catch(e){a=!0,o=e}finally{try{i||null==c.return||c.return()}finally{if(a)throw o}}return s}var tZ=function(){function e(t){(0,O._)(this,e),this.client=t,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}return(0,A._)(e,[{key:"_enroll",value:function(e){return(0,K._)(function(){return(0,I._)(this,function(t){return[2,this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))]})}).call(this)}},{key:"_challenge",value:function(e,t){return(0,K._)(function(e,t){var r,n,s,i,a,o,u,c,l,h,f,d,p,v,g,_,y;return(0,I._)(this,function(b){var m,w;switch(b.label){case 0:r=e.factorId,n=e.webauthn,s=e.friendlyName,i=e.signal,b.label=1;case 1:return b.trys.push([1,8,,9]),[4,this.client.mfa.challenge({factorId:r,webauthn:n})];case 2:if(o=(a=b.sent()).data,u=a.error,!o)return[2,{data:null,error:u}];switch(c=null!=i?i:tG.createNewAbortSignal(),"create"===o.webauthn.type&&(!(l=o.webauthn.credential_options.publicKey.user).name&&(l.name="".concat(l.id,":").concat(s)),!l.displayName&&(l.dis
1playName=l.name)),o.webauthn.type){case"create":return[3,3];case"request":return[3,5]}return[3,7];case 3:return[4,(m={publicKey:tX(t$,o.webauthn.credential_options.publicKey,(null==t?void 0:t.create)||{}),signal:c},(0,K._)(function(){var e;return(0,I._)(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,navigator.credentials.create(m)];case 1:if(!(e=t.sent()))return[2,{data:null,error:new tJ("Empty credential response",e)}];if(!(0,j._)(e,PublicKeyCredential))return[2,{data:null,error:new tJ("Browser returned unexpected credential type",e)}];return[2,{data:e,error:null}];case 2:return[2,{data:null,error:function(e){var t,r,n,s=e.error,i=e.options,a=i.publicKey;if(!a)throw Error("options was missing required publicKey property");if("AbortError"===s.name){if((0,j._)(i.signal,AbortSignal))return new tz({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:s})}else if("ConstraintError"===s.name){if((null==(t=a.authenticatorSelection)?void 0:t.requireResidentKey)===!0)return new tz({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:s});else if("conditional"===i.mediation&&(null==(r=a.authenticatorSelection)?void 0:r.userVerification)==="required")return new tz({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:s});else if((null==(n=a.authenticatorSelection)?void 0:n.userVerification)==="required")return new tz({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:s})}else if("InvalidStateError"===s.name)return new tz({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:s});else if("NotAllowedError"===s.name)return new tz({message:s.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s});else if("NotSupportedError"===s.name)return new tz(0===a.pubKeyCredParams.filter(function(e){return"public-key"===e.type}).length?{message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:s}:{message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:s});else if("SecurityError"===s.name){var o=window.location.hostname;if(!tV(o))return new tz({message:"".concat(window.location.hostname," is an invalid domain"),code:"ERROR_INVALID_DOMAIN",cause:s});if(a.rp.id!==o)return new tz({message:'The RP ID "'.concat(a.rp.id,'" is invalid for this domain'),code:"ERROR_INVALID_RP_ID",cause:s})}else if("TypeError"===s.name){if(a.user.id.byteLength<1||a.user.id.byteLength>64)return new tz({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:s})}else if("UnknownError"===s.name)return new tz({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:s});return new tz({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s})}({error:t.sent(),options:m})}];case 3:return[2]}})})())];case 4:if(f=(h=b.sent()).data,d=h.error,f)return[2,{data:{factorId:r,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:f}},error:null}];return[2,{data:null,error:d}];case 5:return p=tX(tQ,o.webauthn.credential_options.publicKey,(null==t?void 0:t.request)||{}),[4,(w=Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:p,signal:c}),(0,K._)(function(){var e;return(0,I._)(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,navigator.credentials.get(w)];case 1:if(!(e=t.sent()))return[2,{data:null,error:new tJ("Empty credential response",e)}];if(!(0,j._)(e,PublicKeyCredential))return[2,{data:null,error:new tJ("Browser returned unexpected credential type",e)}];return[2,{data:e,error:null}];case 2:return[2,{data:null,error:function(e){var t=e.error,r=e.options,n=r.publicKey;if(!n)throw Error("options was missing required publicKey property");if("AbortError"===t.name){if((0,j._)(r.signal,AbortSignal))return new tz({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if("NotAllowedError"===t.name)return new tz({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});else if("SecurityError"===t.name){var s=window.location.hostname;if(!tV(s))return new tz({message:"".concat(window.location.hostname," is an invali
1d domain"),code:"ERROR_INVALID_DOMAIN",cause:t});if(n.rpId!==s)return new tz({message:'The RP ID "'.concat(n.rpId,'" is invalid for this domain'),code:"ERROR_INVALID_RP_ID",cause:t})}else if("UnknownError"===t.name)return new tz({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t});return new tz({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}({error:t.sent(),options:w})}];case 3:return[2]}})})())];case 6:if(g=(v=b.sent()).data,_=v.error,g)return[2,{data:{factorId:r,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:g}},error:null}];return[2,{data:null,error:_}];case 7:return[3,9];case 8:if(e$(y=b.sent()))return[2,{data:null,error:y}];return[2,{data:null,error:new eX("Unexpected error in challenge",y)}];case 9:return[2]}})}).apply(this,arguments)}},{key:"_verify",value:function(e){return(0,K._)(function(e){var t,r,n;return(0,I._)(this,function(s){return t=e.challengeId,r=e.factorId,n=e.webauthn,[2,this.client.mfa.verify({factorId:r,challengeId:t,webauthn:n})]})}).apply(this,arguments)}},{key:"_authenticate",value:function(e,t){return(0,K._)(function(e,t){var r,n,s,i,a,o,u,c,l,h,f,d;return(0,I._)(this,function(p){switch(p.label){case 0:if(r=e.factorId,i=void 0===(s=(n=e.webauthn).rpId)?"u">typeof window?window.location.hostname:void 0:s,o=void 0===(a=n.rpOrigins)?"u">typeof window?[window.location.origin]:void 0:a,u=n.signal,!i)return[2,{data:null,error:new eY("rpId is required for WebAuthn authentication")}];p.label=1;case 1:if(p.trys.push([1,3,,4]),!tY())return[2,{data:null,error:new eX("Browser does not support WebAuthn",null)}];return[4,this.challenge({factorId:r,webauthn:{rpId:i,rpOrigins:o},signal:u},{request:t})];case 2:if(l=(c=p.sent()).data,h=c.error,!l)return[2,{data:null,error:h}];return f=l.webauthn,[2,this._verify({factorId:r,challengeId:l.challengeId,webauthn:{type:f.type,rpId:i,rpOrigins:o,credential_response:f.credential_response}})];case 3:if(e$(d=p.sent()))return[2,{data:null,error:d}];return[2,{data:null,error:new eX("Unexpected error in authenticate",d)}];case 4:return[2]}})}).apply(this,arguments)}},{key:"_register",value:function(e,t){return(0,K._)(function(e,t){var r,n,s,i,a,o,u,c,l,h,f,d,p,v;return(0,I._)(this,function(g){switch(g.label){case 0:if(r=this,n=e.friendlyName,i=void 0===(s=e.rpId)?"u">typeof window?window.location.hostname:void 0:s,o=void 0===(a=e.rpOrigins)?"u">typeof window?[window.location.origin]:void 0:a,u=e.signal,!i)return[2,{data:null,error:new eY("rpId is required for WebAuthn registration")}];g.label=1;case 1:if(g.trys.push([1,6,,7]),!tY())return[2,{data:null,error:new eX("Browser does not support WebAuthn",null)}];return[4,this._enroll({friendlyName:n})];case 2:if(l=(c=g.sent()).data,h=c.error,l)return[3,4];return[4,this.client.mfa.listFactors().then(function(e){var t;return null==(t=e.data)?void 0:t.all.find(function(e){return"webauthn"===e.factor_type&&e.friendly_name===n&&"unverified"!==e.status})}).then(function(e){return e?r.client.mfa.unenroll({factorId:null==e?void 0:e.id}):void 0})];case 3:return g.sent(),[2,{data:null,error:h}];case 4:return[4,this._challenge({factorId:l.id,friendlyName:l.friendly_name,webauthn:{rpId:i,rpOrigins:o},signal:u},{create:t})];case 5:if(d=(f=g.sent()).data,p=f.error,!d)return[2,{data:null,error:p}];return[2,this._verify({factorId:l.id,challengeId:d.challengeId,webauthn:{rpId:i,rpOrigins:o,type:d.webauthn.type,credential_response:d.webauthn.credential_response}})];case 6:if(e$(v=g.sent()))return[2,{data:null,error:v}];return[2,{data:null,error:new eX("Unexpected error in register",v)}];case 7:return[2]}})}).apply(this,arguments)}}]),e}();if(("u"<typeof globalThis?"undefined":(0,en._)(globalThis))!=="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch(e){"u">typeof self&&(self.globalThis=self)}var t0={url:"http://localhost:9999",storageKey:"supabase.auth.token",autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:{"X-Client-Info":"gotrue-js/".concat(eJ)},flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};function t2(e,t,r){return(0,K._)(function(){return(0,I._)(this,function(e){switch(e.label){case 0:return[4,r()];case 1:return[2,e.sent()]}})})()}var t1={},t4=function(){function e(t){var r,n,s=this;(0,O._)(this,e),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=e.nextInstanceID,e.nextInstanceID+=1,this.instanceID>0&&to()&&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.");var i=Object.assign(Object.assign({},t0),t);if(this.logDebugMessages=!!i.debug,"function"==typeof i.debug&&(this.logger=i.debug),this.persistSession=i.persistSession,this.storageKey=i.storageKey,this.autoRefreshToken=i.autoRefreshToken,this.admin=new tB({url:i.url,headers:i.headers,fetch:i.fetch}),this.url=i.url,this.headers=i.headers,this.fetch=tl(i.fetch),this.lock=i.lock||t2,this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,i.lock?this.lock=i.lock:to()&&(null==(r=null==globalThis?void 0:globalThis.navigator)?void 0:r.locks)?this.lock=tK:this.lock=t2,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new tZ(this)},this.persistSession?(i.storage?this.storage=i.storage:tc()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=tD(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=tD(this.memoryStorage)),to()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(e){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",e)}null==(n=this.broadcastChannel)||n.addEventListener("message",function(e){return(0,K._)(function(){return(0,I._)(this,function(t){switch(t.label){case 0:return this._debug("received broadcast notification from other tab or client",e),[4,this._notifyAllSubscribers(e.data.event,e.data.session,!1)];case 1:return t.sent(),[2]}})}).call(s)})}this.initialize()}return(0,A._)(e,[{key:"jwks",get:function(){var e,t;return null!=(t=null==(e=t1[this.storageKey])?void 0:e.jwks)?t:{keys:[]}},set:function(e){t1[this.storageKey]=Object.assign(Object.assign({},t1[this.storageKey]),{jwks:e})}},{key:"jwks_cached_at",get:function(){var e,t;return null!=(t=null==(e=t1[this.storageKey])?void 0:e.cachedAt)?t:Number.MIN_SAFE_INTEGER},set:function(e){t1[this.storageKey]=Object.assign(Object.assign({},t1[this.storageKey]),{cachedAt:e})}},{key:"_debug",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.logDebugMessages&&this.logger.apply(this,["GoTrueClient@".concat(this.instanceID," (").concat(eJ,") ").concat(new Date().toISOString())].concat((0,R._)(t))),this}},{key:"initialize",value:function(){return(0,K._)(function(){var e;return(0,I._)(this,function(t){switch(t.label){case 0:if(e=this,!this.initializePromise)return[3,2];return[4,this.initializePromise];case 1:case 3:return[2,t.sent()];case 2:return this.initializePromise=(0,K._)(function(){var e;return(0,I._)(this,function(t){switch(t.label){case 0:return e=this,[4,this._acquireLock(-1,function(){return(0,K._)(function(){return(0,I._)(this,function(e){switch(e.label){case 0:return[4,this._initialize()];case 1:return[2,e.sent()]}})}).call(e)})];case 1:return[2,t.sent()]}})}).call(e),[4,this.initializePromise]}})}).call(this)}},{key:"_initialize",value:function(){return(0,K._)(function(){var e,t,r,n,s,i,a,o,u,c,l;return(0,I._)(this,function(h){switch(h.label){case 0:e=this,h.label=1;case 1:if(h.trys.push([1,11,12,14]),r=function(e){var t={},r=new URL(e);if(r.hash&&"#"===r.hash[0])try{new URLSearchParams(r.hash.substring(1)).forEac
1h(function(e,r){t[r]=e})}catch(e){}return r.searchParams.forEach(function(e,r){t[r]=e}),t}(window.location.href),n="none",!this._isImplicitGrantCallback(r))return[3,2];return n="implicit",[3,4];case 2:return[4,this._isPKCECallback(r)];case 3:h.sent()&&(n="pkce"),h.label=4;case 4:if(!(to()&&this.detectSessionInUrl&&"none"!==n))return[3,9];return[4,this._getSessionFromURL(r,n)];case 5:var f;if(i=(s=h.sent()).data,!(a=s.error))return[3,7];if(this._debug("#_initialize()","error detecting session from URL",a),e$(f=a)&&"AuthImplicitGrantRedirectError"===f.name&&("identity_already_exists"===(o=null==(t=a.details)?void 0:t.code)||"identity_not_found"===o||"single_identity_not_deletable"===o))return[2,{error:a}];return[4,this._removeSession()];case 6:return h.sent(),[2,{error:a}];case 7:return u=i.session,c=i.redirectType,this._debug("#_initialize()","detected session in URL",u,"redirect type",c),[4,this._saveSession(u)];case 8:return h.sent(),setTimeout(function(){return(0,K._)(function(){return(0,I._)(this,function(e){switch(e.label){case 0:if("recovery"!==c)return[3,2];return[4,this._notifyAllSubscribers("PASSWORD_RECOVERY",u)];case 1:return e.sent(),[3,4];case 2:return[4,this._notifyAllSubscribers("SIGNED_IN",u)];case 3:e.sent(),e.label=4;case 4:return[2]}})}).call(e)},0),[2,{error:null}];case 9:return[4,this._recoverAndRefresh()];case 10:return h.sent(),[2,{error:null}];case 11:if(e$(l=h.sent()))return[2,{error:l}];return[2,{error:new eX("Unexpected error during initialization",l)}];case 12:return[4,this._handleVisibilityChange()];case 13:return h.sent(),this._debug("#_initialize()","end"),[7];case 14:return[2]}})}).call(this)}},{key:"signInAnonymously",value:function(e){return(0,K._)(function(){var t,r,n,s,i,a,o,u,c;return(0,I._)(this,function(l){switch(l.label){case 0:return l.trys.push([0,5,,6]),[4,tj(this.fetch,"POST","".concat(this.url,"/signup"),{headers:this.headers,body:{data:null!=(r=null==(t=null==e?void 0:e.options)?void 0:t.data)?r:{},gotrue_meta_security:{captcha_token:null==(n=null==e?void 0:e.options)?void 0:n.captchaToken}},xform:tI})];case 1:if(i=(s=l.sent()).data,(a=s.error)||!i)return[2,{data:{user:null,session:null},error:a}];if(o=i.session,u=i.user,!i.session)return[3,4];return[4,this._saveSession(i.session)];case 2:return l.sent(),[4,this._notifyAllSubscribers("SIGNED_IN",o)];case 3:l.sent(),l.label=4;case 4:return[2,{data:{user:u,session:o},error:null}];case 5:if(e$(c=l.sent()))return[2,{data:{user:null,session:null},error:c}];throw c;case 6:return[2]}})}).call(this)}},{key:"signUp",value:function(e){return(0,K._)(function(){var t,r,n,s,i,a,o,u,c,l,h,f,d,p,v,g,_,y;return(0,I._)(this,function(b){switch(b.label){case 0:if(b.trys.push([0,11,,12]),!("email"in e))return[3,4];if(i=e.email,a=e.password,o=e.options,u=null,c=null,"pkce"!==this.flowType)return[3,2];return[4,t_(this.storage,this.storageKey)];case 1:u=(l=ev._.apply(void 0,[b.sent(),2]))[0],c=l[1],b.label=2;case 2:return[4,tj(this.fetch,"POST","".concat(this.url,"/signup"),{headers:this.headers,redirectTo:null==o?void 0:o.emailRedirectTo,body:{email:i,password:a,data:null!=(t=null==o?void 0:o.data)?t:{},gotrue_meta_security:{captcha_token:null==o?void 0:o.captchaToken},code_challenge:u,code_challenge_method:c},xform:tI})];case 3:case 5:return s=b.sent(),[3,7];case 4:if(!("phone"in e))return[3,6];return h=e.phone,f=e.password,d=e.options,[4,tj(this.fetch,"POST","".concat(this.url,"/signup"),{headers:this.headers,body:{phone:h,password:f,data:null!=(r=null==d?void 0:d.data)?r:{},channel:null!=(n=null==d?void 0:d.channel)?n:"sms",gotrue_meta_security:{captcha_token:null==d?void 0:d.captchaToken}},xform:tI})];case 6:throw new e1("You must provide either an email or phone number and a password");case 7:if(p=s.data,(v=s.error)||!p)return[2,{data:{user:null,session:null},error:v}];if(g=p.session,_=p.user,!p.session)return[3,10];return[4,this._saveSession(p.session)];case 8:return b.sent(),[4,this._notifyAllSubscribers("SIGNED_IN",g)];case 9:b.sent(),b.label=10;case 10:return[2,{data:{user:_,session:g},error:null}];case 11:if(e$(y=b.sent()))return[2,{data:{user:null,session:null},error:y}];throw y;case 12:return[2]}})}).call(this)}},{key:"signInWithPassword",value:function(e){return(0,K._)(function(){var t,r,n,s,i,a,o,u,c,l;return(0,I._)(this,function(h){switch(h.label){case 0:if(h.trys.push([0,9,,10]),!("email"in e))return[3,2];return r=e.email,n=e.password,s=e.options,[4,tj(this.fetch,"POST","".concat(this.url,"/token?grant_type=password"),{headers:this.headers,body:{email:r,password:n,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}},xform:tR})];case 1:case 3:return t=h.sent(),[3,5];case 2:if(!("phone"in e))return[3,4];return i=e.phone,a=e.password,o=e.options,[4,tj(this.fetch,"POST","".concat(this.url,"/token?grant_type=password"),{headers:this.headers,body:{phone:i,password:a,gotrue_meta_security:{captcha_token:null==o?void 0:o.captchaToken}},xform:tR})];case 4:throw new e1("You must provide either an email or phone number and a password");case 5:if(u=t.data,c=t.error)return[2,{data:{user:null,session:null},error:c}];if(!u||!u.session||!u.user)return[2,{data:{user:null,session:null},error:new e2}];if(!u.session)return[3,8];return[4,this._saveSession(u.session)];case 6:return h.sent(),[4,this._notifyAllSubscribers("SIGNED_IN",u.session)];case 7:h.sent(),h.label=8;case 8:return[2,{data:Object.assign({user:u.user,session:u.session},u.weak_password?{weakPassword:u.weak_password}:null),error:c}];case 9:if(e$(l=h.sent()))return[2,{data:{user:null,session:null},error:l}];throw l;case 10:return[2]}})}).call(this)}},{key:"signInWithOAuth",value:function(e){return(0,K._)(function(){var t,r,n,s;return(0,I._)(this,function(i){switch(i.label){case 0:return[4,this._handleProviderSignIn(e.provider,{redirectTo:null==(t=e.options)?void 0:t.redirectTo,scopes:null==(r=e.options)?void 0:r.scopes,queryParams:null==(n=e.options)?void 0:n.queryParams,skipBrowserRedirect:null==(s=e.options)?void 0:s.skipBrowserRedirect})];case 1:return[2,i.sent()]}})}).call(this)}}
1,{key:"exchangeCodeForSession",value:function(e){return(0,K._)(function(){var t;return(0,I._)(this,function(r){switch(r.label){case 0:return t=this,[4,this.initializePromise];case 1:return r.sent(),[2,this._acquireLock(-1,function(){return(0,K._)(function(){return(0,I._)(this,function(t){return[2,this._exchangeCodeForSession(e)]})}).call(t)})]}})}).call(this)}},{key:"signInWithWeb3",value:function(e){return(0,K._)(function(){var t;return(0,I._)(this,function(r){switch(r.label){case 0:switch(t=e.chain){case"ethereum":return[3,1];case"solana":return[3,3]}return[3,5];case 1:return[4,this.signInWithEthereum(e)];case 2:case 4:return[2,r.sent()];case 3:return[4,this.signInWithSolana(e)];case 5:throw Error('@supabase/auth-js: Unsupported chain "'.concat(t,'"'));case 6:return[2]}})}).call(this)}},{key:"signInWithEthereum",value:function(e){return(0,K._)(function(){var t,r,n,s,i,a,o,u,c,l,h,f,d,p,v,g,_,y,b,m,w,k,S,E,T,O;return(0,I._)(this,function(A){switch(A.label){case 0:if(!("message"in e))return[3,1];return f=e.message,d=e.signature,[3,6];case 1:if(e.chain,p=e.wallet,v=e.statement,g=e.options,to())if((void 0===p?"undefined":(0,en._)(p))==="object")_=p;else if("ethereum"in(y=window)&&"object"===(0,en._)(y.ethereum)&&"request"in y.ethereum&&"function"==typeof y.ethereum.request)_=y.ethereum;else throw Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.");else{if((void 0===p?"undefined":(0,en._)(p))!=="object"||!(null==g?void 0:g.url))throw Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");_=p}return b=new URL(null!=(t=null==g?void 0:g.url)?t:window.location.href),[4,_.request({method:"eth_requestAccounts"}).then(function(e){return e}).catch(function(){throw Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")})];case 2:if(!(m=A.sent())||0===m.length)throw Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");if(w=tF(m[0]),k=null==(r=null==g?void 0:g.signInWithEthereum)?void 0:r.chainId)return[3,4];return[4,_.request({method:"eth_chainId"})];case 3:k=parseInt(A.sent(),16),A.label=4;case 4:var j;return f=function(e){var t=e.chainId,r=e.domain,n=e.expirationTime,s=e.issuedAt,i=void 0===s?new Date:s,a=e.nonce,o=e.notBefore,u=e.requestId,c=e.resources,l=e.scheme,h=e.uri,f=e.version;if(!Number.isInteger(t))throw Error('@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: '.concat(t));if(!r)throw Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(a&&a.length<8)throw Error('@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: '.concat(a));if(!h)throw Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if("1"!==f)throw Error("@supabase/auth-js: Invalid SIWE message field \"version\". Version must be '1'. Provided value: ".concat(f));if(null==(k=e.statement)?void 0:k.includes("\n"))throw Error("@supabase/auth-js: Invalid SIWE message field \"statement\". Statement must not include '\\n'. Provided value: ".concat(e.statement));var d=tF(e.address),p=l?"".concat(l,"://").concat(r):r,v=e.statement?"".concat(e.statement,"\n"):"",g="".concat(p," wants you to sign in with your Ethereum account:\n").concat(d,"\n\n").concat(v),_="URI: ".concat(h,"\nVersion: ").concat(f,"\nChain ID: ").concat(t).concat(a?"\nNonce: ".concat(a):"","\nIssued At: ").concat(i.toISOString());if(n&&(_+="\nExpiration Time: ".concat(n.toISOString())),o&&(_+="\nNot Before: ".concat(o.toISOString())),u&&(_+="\nRequest ID: ".concat(u)),c){var y="\nResources:",b=!0,m=!1,w=void 0;try{for(var k,S,E=c[Symbol.iterator]();!(b=(S=E.next()).done);b=!0){var T=S.value;if(!T||"string"!=typeof T)throw Error('@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: '.concat(T));y+="\n- ".concat(T)}}catch(e){m=!0,w=e}finally{try{b||null==E.return||E.return()}finally{if(m)throw w}}_+=y}return"".concat(g,"\n").concat(_)}({domain:b.host,address:w,statement:v,uri:b.href,version:"1",chainId:k,nonce:null==(n=null==g?void 0:g.signInWithEthereum)?void 0:n.nonce,issuedAt:null!=(i=null==(s=null==g?void 0:g.signInWithEthereum)?void 0:s.issuedAt)?i:new Date,expirationTime:null==(a=null==g?void 0:g.signInWithEthereum)?void 0:a.expirationTime,notBefore:null==(o=null==g?void 0:g.signInWithEthereum)?void 0:o.notBefore,requestId:null==(u=null==g?void 0:g.signInWithEthereum)?void 0:u.requestId,resources:null==(c=null==g?void 0:g.signInWithEthereum)?void 0:c.resources}),[4,_.request({method:"personal_sign",params:[(j=f,"0x"+Array.from(new TextEncoder().encode(j),function(e){return e.toString(16).padStart(2,"0")}).join("")),w]})];case 5:d=A.sent(),A.label=6;case 6:return A.trys.push([6,11,,12]),[4,tj(this.fetch,"POST","".concat(this.url,"/token?grant_type=web3"),{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:d},(null==(l=e.options)?void 0:l.captchaToken)?{gotrue_meta_security:{captcha_token:null==(h=e.options)?void 0:h.captchaToken}}:null),xform:tI})];case 7:if(E=(S=A.sent()).data,T=S.error)throw T;if(!E||!E.session||!E.user)return[2,{data:{user:null,session:null},error:new e2}];if(!E.session)return[3,10];return[4,this._saveSession(E.session)];
1case 8:return A.sent(),[4,this._notifyAllSubscribers("SIGNED_IN",E.session)];case 9:A.sent(),A.label=10;case 10:return[2,{data:Object.assign({},E),error:T}];case 11:if(e$(O=A.sent()))return[2,{data:{user:null,session:null},error:O}];throw O;case 12:return[2]}})}).call(this)}},{key:"signInWithSolana",value:function(e){return(0,K._)(function(){var t,r,n,s,i,a,o,u,c,l,h,f,d,p,v,g,_,y,b,m,w,k,S,E,T,O,A;return(0,I._)(this,function(I){switch(I.label){case 0:if(!("message"in e))return[3,1];return d=e.message,p=e.signature,[3,5];case 1:if(e.chain,v=e.wallet,g=e.statement,_=e.options,to())if((void 0===v?"undefined":(0,en._)(v))==="object")y=v;else if("solana"in(b=window)&&"object"===(0,en._)(b.solana)&&("signIn"in b.solana&&"function"==typeof b.solana.signIn||"signMessage"in b.solana&&"function"==typeof b.solana.signMessage))y=b.solana;else throw 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((void 0===v?"undefined":(0,en._)(v))!=="object"||!(null==_?void 0:_.url))throw Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");y=v}if(m=new URL(null!=(t=null==_?void 0:_.url)?t:window.location.href),!("signIn"in y&&y.signIn))return[3,3];return[4,y.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},null==_?void 0:_.signInWithSolana),{version:"1",domain:m.host,uri:m.href}),g?{statement:g}:null))];case 2:if(Array.isArray(w=I.sent())&&w[0]&&"object"===(0,en._)(w[0]))k=w[0];else if(w&&(void 0===w?"undefined":(0,en._)(w))==="object"&&"signedMessage"in w&&"signature"in w)k=w;else throw Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in k&&"signature"in k&&("string"==typeof k.signedMessage||(0,j._)(k.signedMessage,Uint8Array))&&(0,j._)(k.signature,Uint8Array))d="string"==typeof k.signedMessage?k.signedMessage:new TextDecoder().decode(k.signedMessage),p=k.signature;else throw Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields");return[3,5];case 3:if(!("signMessage"in y)||"function"!=typeof y.signMessage||!("publicKey"in y)||(void 0===y?"undefined":(0,en._)(y))!=="object"||!y.publicKey||!("toBase58"in y.publicKey)||"function"!=typeof y.publicKey.toBase58)throw Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");return d=["".concat(m.host," wants you to sign in with your Solana account:"),y.publicKey.toBase58()].concat((0,R._)(g?["",g,""]:[""]),["Version: 1","URI: ".concat(m.href),"Issued At: ".concat(null!=(n=null==(r=null==_?void 0:_.signInWithSolana)?void 0:r.issuedAt)?n:new Date().toISOString())],(0,R._)((null==(s=null==_?void 0:_.signInWithSolana)?void 0:s.notBefore)?["Not Before: ".concat(_.signInWithSolana.notBefore)]:[]),(0,R._)((null==(i=null==_?void 0:_.signInWithSolana)?void 0:i.expirationTime)?["Expiration Time: ".concat(_.signInWithSolana.expirationTime)]:[]),(0,R._)((null==(a=null==_?void 0:_.signInWithSolana)?void 0:a.chainId)?["Chain ID: ".concat(_.signInWithSolana.chainId)]:[]),(0,R._)((null==(o=null==_?void 0:_.signInWithSolana)?void 0:o.nonce)?["Nonce: ".concat(_.signInWithSolana.nonce)]:[]),(0,R._)((null==(u=null==_?void 0:_.signInWithSolana)?void 0:u.requestId)?["Request ID: ".concat(_.signInWithSolana.requestId)]:[]),(0,R._)((null==(l=null==(c=null==_?void 0:_.signInWithSolana)?void 0:c.resources)?void 0:l.length)?["Resources"].concat((0,R._)(_.signInWithSolana.resources.map(function(e){return"- ".concat(e)}))):[])).join("\n"),[4,y.signMessage(new TextEncoder().encode(d),"utf8")];case 4:if(!(S=I.sent())||!(0,j._)(S,Uint8Array))throw Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");p=S,I.label=5;case 5:return I.trys.push([5,10,,11]),[4,tj(this.fetch,"POST","".concat(this.url,"/token?grant_type=web3"),{headers:this.headers,body:Object.assign({chain:"solana",message:d,signature:ta(p)},(null==(h=e.options)?void 0:h.captchaToken)?{gotrue_meta_security:{captcha_token:null==(f=e.options)?void 0:f.captchaToken}}:null),xform:tI})];case 6:if(T=(E=I.sent()).data,O=E.error)throw O;if(!T||!T.session||!T.user)return[2,{data:{user:null,session:null},error:new e2}];if(!T.session)return[3,9];return[4,this._saveSession(T.session)];case 7:return I.sent(),[4,this._notifyAllSubscribers("SIGNED_IN",T.session)];case 8:I.sent(),I.label=9;case 9:return[2,{data:Object.assign({},T),error:O}];case 10:if(e$(A=I.sent()))return[2,{data:{user:null,session:null},error:A}];throw A;case 11:return[2]}})}).call(this)}},{key:"_exchangeCodeForSession",value:function(e){return(0,K._)(function(){var t,r,n,s,i,a,o,u;return(0,I._)(this,function(c){switch(c.label){case 0:return[4,tf(this.storage,"".concat(this.storageKey,"-code-verifier"))];case 1:t=c.sent(),n=(r=(0,ev._)((null!=t?t:"").split("/"),2))[0],s=r[1],c.label=2;case 2:return c.trys.push([2,8,,9]),[4,tj(this.fetch,"POST","".concat(this.url,"/token?grant_type=pkce"),{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:tI})];case 3:return a=(i=c.sent()).data,o=i.error,[4,td(this.storage,"".concat(this.storageKey,"-code-verifier"))];case 4:if(c.sent(),o)throw o;if(!a||!a.session||!a.user)return[2,{data:{user:null,session:null,redirectType:null},error:new e2}];if(!a.session)return[3,7];return[4,this._saveSession(a.session)];case 5:return c.sent(),[4,this._notifyAllSubscribers("SIGNED_IN",a.session)];case 6:c.sent(),c.label=7;case 7:return[2,{data:Object.assign(Object.assign({},a),{redirectType:null!=s?s:null}),error:o}];case 8:if(e$(u=c.sent()))return[2,{data:{user:null,session:null,redirectType:null},error:u}];throw u;case 9:return[2]}})}).call(this)}},{key:"signInWithIdToken",value:function(e){return(0,K._)(function(){var t,r,n,s,i,a,o,u,c;return(0,I._)(this,function(l){switch(l.label){case 0:return l.trys.push([0,5,,6]),t=e.options,r=e.provider,n=e.token,s=e.access_token,i=e.nonce,[4,tj(this.fetch,"POST","".concat(this.url,"/token?grant_type=id_token"),{headers:this.headers,body:{provider:r,id_token:n,access_token:s,nonce:i,gotrue_meta_security:{captcha_token:null==t?void 0:t.captchaToken}},xform:tI})];case 1:if(o=(a=l.sent()).data,u=a.error)return[2,{data:{user:null,session:null},error:u}];if(!o||!o.session||!o.user)return[2,{data:{user:null,session:null},error:new e2}];if(!o.session)return[3,4];return[4,this._saveSession(o.session)];case 2:return l.sent(),[4,this._notifyAllSubscribers("SIGNED_IN",o.session)];case 3:l.sent(),l.label=4;case 4:return[2,{data:o,error:u}];case 5:if(e$(c=l.sent()))return[2,{data:{user:null,session:null},error:c}];throw c;case 6:return[2]}})}).call(this)}},{key:"signInWithOtp",value:function(e){return(0,K._)(function(){var t,r,n,s,i,a,o,u,c,l,h,f,d,p,v,g;return(0,I._)(this,function(_){switch(_.label){case 0:if(_.trys.push([0,7,,8]),!("email"in e))return[3,4];if(a=e.email,o=e.options,u=null,c=null,"pkce"!==this.flowType)return[3,2];return[4,t_(this.storage,this.storageKey)];case 1:u=(l=ev._.apply(void 0,[_.sent(),2]))[0],c=l[1],_.label=2;case 2:return[4,tj(this.fetch,"POST","".concat(this.url,"/otp"),{headers:this.headers,body:{email:a,data:null!=(t=null==o?void 0:o.data)?t:{},create_user:null==(r=null==o?void 0:o.shouldCreateUser)||r,gotrue_meta_security:{captcha_token:null==o?void 0:o.captchaToken},code_challenge:u,code_challenge_method:c},redirectTo:null==o?void 0:o.emailRedirectTo})];case 3:return[2,{data:{user:null,session:null},error:_.sent().error}];case 4:if(!("phone"in e))return[3,6];
1return h=e.phone,f=e.options,[4,tj(this.fetch,"POST","".concat(this.url,"/otp"),{headers:this.headers,body:{phone:h,data:null!=(n=null==f?void 0:f.data)?n:{},create_user:null==(s=null==f?void 0:f.shouldCreateUser)||s,gotrue_meta_security:{captcha_token:null==f?void 0:f.captchaToken},channel:null!=(i=null==f?void 0:f.channel)?i:"sms"}})];case 5:return p=(d=_.sent()).data,v=d.error,[2,{data:{user:null,session:null,messageId:null==p?void 0:p.message_id},error:v}];case 6:throw new e1("You must provide either an email or phone number.");case 7:if(e$(g=_.sent()))return[2,{data:{user:null,session:null},error:g}];throw g;case 8:return[2]}})}).call(this)}},{key:"verifyOtp",value:function(e){return(0,K._)(function(){var t,r,n,s,i,a,o,u,c,l;return(0,I._)(this,function(h){switch(h.label){case 0:return h.trys.push([0,5,,6]),n=void 0,s=void 0,"options"in e&&(n=null==(t=e.options)?void 0:t.redirectTo,s=null==(r=e.options)?void 0:r.captchaToken),[4,tj(this.fetch,"POST","".concat(this.url,"/verify"),{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:s}}),redirectTo:n,xform:tI})];case 1:if(a=(i=h.sent()).data,o=i.error)throw o;if(!a)throw Error("An error occurred on token verification.");if(u=a.session,c=a.user,!(null==u?void 0:u.access_token))return[3,4];return[4,this._saveSession(u)];case 2:return h.sent(),[4,this._notifyAllSubscribers("recovery"==e.type?"PASSWORD_RECOVERY":"SIGNED_IN",u)];case 3:h.sent(),h.label=4;case 4:return[2,{data:{user:c,session:u},error:null}];case 5:if(e$(l=h.sent()))return[2,{data:{user:null,session:null},error:l}];throw l;case 6:return[2]}})}).call(this)}},{key:"signInWithSSO",value:function(e){return(0,K._)(function(){var t,r,n,s,i,a,o;return(0,I._)(this,function(u){switch(u.label){case 0:if(u.trys.push([0,4,,5]),s=null,i=null,"pkce"!==this.flowType)return[3,2];return[4,t_(this.storage,this.storageKey)];case 1:s=(a=ev._.apply(void 0,[u.sent(),2]))[0],i=a[1],u.label=2;case 2:return[4,tj(this.fetch,"POST","".concat(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:null!=(r=null==(t=e.options)?void 0:t.redirectTo)?r:void 0}),(null==(n=null==e?void 0:e.options)?void 0:n.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:s,code_challenge_method:i}),headers:this.headers,xform:tC})];case 3:return[2,u.sent()];case 4:if(e$(o=u.sent()))return[2,{data:null,error:o}];throw o;case 5:return[2]}})}).call(this)}},{key:"reauthenticate",value:function(){return(0,K._)(function(){var e;return(0,I._)(this,function(t){switch(t.label){case 0:return e=this,[4,this.initializePromise];case 1:return t.sent(),[4,this._acquireLock(-1,function(){return(0,K._)(function(){return(0,I._)(this,function(e){switch(e.label){case 0:return[4,this._reauthenticate()];case 1:return[2,e.sent()]}})}).call(e)})];case 2:return[2,t.sent()]}})}).call(this)}},{key:"_reauthenticate",value:function(){return(0,K._)(function(){var e,t;return(0,I._)(this,function(r){switch(r.label){case 0:e=this,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._useSession(function(t){return(0,K._)(function(){var e,r;return(0,I._)(this,function(n){switch(n.label){case 0:if(e=t.data.session,r=t.error)throw r;if(!e)throw new e0;return[4,tj(this.fetch,"GET","".concat(this.url,"/reauthenticate"),{headers:this.headers,jwt:e.access_token})];case 1:return[2,{data:{user:null,session:null},error:n.sent().error}]}})}).call(e)})];case 2:return[2,r.sent()];case 3:if(e$(t=r.sent()))return[2,{data:{user:null,session:null},error:t}];throw t;case 4:return[2]}})}).call(this)}},{key:"resend",value:function(e){return(0,K._)(function(){var t,r,n,s,i,a,o,u,c,l,h;return(0,I._)(this,function(f){switch(f.label){case 0:if(f.trys.push([0,5,,6]),t="".concat(this.url,"/resend"),!("email"in e))return[3,2];return r=e.email,n=e.type,s=e.options,[4,tj(this.fetch,"POST",t,{headers:this.headers,body:{email:r,type:n,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}},redirectTo:null==s?void 0:s.emailRedirectTo})];case 1:return[2,{data:{user:null,session:null},error:f.sent().error}];case 2:if(!("phone"in e))return[3,4];return i=e.phone,a=e.type,o=e.options,[4,tj(this.fetch,"POST",t,{headers:this.headers,body:{phone:i,type:a,gotrue_meta_security:{captcha_token:null==o?void 0:o.captchaToken}}})];case 3:return c=(u=f.sent()).data,l=u.error,[2,{data:{user:null,session:null,messageId:null==c?void 0:c.message_id},error:l}];case 4:throw new e1("You must provide either an email or phone number and a type");case 5:if(e$(h=f.sent()))return[2,{data:{user:null,session:null},error:h}];throw h;case 6:return[2]}})}).call(this)}},{key:"getSession",value:function(){return(0,K._)(function(){var e;return(0,I._)(this,function(t){switch(t.label){case 0:return e=this,[4,this.initializePromise];case 1:return t.sent(),[4,this._acquireLock(-1,function(){return(0,K._)(function(){return(0,I._)(this,function(e){return[2,this._useSession(function(e){return(0,K._)(function(){return(0,I._)(this,function(t){return[2,e]})})()})]})}).call(e)})];case 2:return[2,t.sent()]}})}).call(this)}},{key:"_acquireLock",value:function(e,t){return(0,K._)(function(){var r,n,s;return(0,I._)(this,function(i){switch(i.label){case 0:r=this,this._debug("#_acquireLock","begin",e),i.label=1;case 1:if(i.trys.push([1,,3,4]),this.lockAcquired)return n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(0,K._)(function(){return(0,I._)(this,function(e){switch(e.label){case 0:return[4,n];case 1:return e.sent(),[4,t()];case 2:return[2,e.sent()]}})})(),this.pendingInLock.push((0,K._)(function(){return(0,I._)(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,s];case 1:case 2:return e.sent(),[3,3];case 3:return[2]}})})()),[2,s];return[4,this.lock("lock:".concat(this.storageKey),e,function(){return(0,K._)(function(){var e,r;return(0,I._)(this,function(n){switch(n.label){case 0:this._debug("#_acquireLock","lock acquired for storage key",this.storageKey),n.label=1;case 1:return n.trys.push([1,,7,8]),this.lockAcquired=!0,e=t(),this.pendingInLock.push((0,K._)(function(){return(0,I._)(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,e];case 1:case 2:return t.sent(),[3,3];case 3:return[2]}})})()),[4,e];case 2:n.sent(),n.label=3;case 3:if(!this.pendingInLock.length)return[3,5];return[4,Promise.all(r=(0,R._)(this.pendingInLock))];case 4:return n.sent(),this.pendingInLock.splice(0,r.length),[3,3];case 5:return[4,e];case 6:return[2,n.sent()];case 7:return this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1,[7];case 8:return[2]}})}).call(r)})];case 2:return[2,i.sent()];case 3:return this._debug("#_acquireLock","end"),[7];case 4:return[2]}})}).call(this)}},{key:"_useSession",value:function(e){return(0,K._)(function(){return(0,I._)(this,function(t){switch(t.label){case 0:this._debug("#_useSession","begin"),t.label=1;case 1:return t.trys.push([1,,4,5]),[4,this.__loadSession()];case 2:return[4,e(t.sent())];case 3:return[2,t.sent()];case 4:return this._debug("#_useSession","end"),[7];case 5:return[2]}})}).call(this)}},{key:"__loadSession",value:function(){return(0,K._)(function(){var e,t,r,n,s,i,a,o,u;return(0,I._)(this,function(c){switch(c.label){case 0:e=this,this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",Error().stack),c.label=1;case 1:return c.trys.push([1,,10,11]),t=null,[4,tf(this.storage,this.storageKey)];case 2:if(r=c.sent(),this._debug("#getSession()","session from storage",r),null===r)return[3,5];if(!this._isValidSession(r))return[3,3];return t=r,[3,5];case 3:return this._debug("#getSession()","session from storage is not val
1id"),[4,this._removeSession()];case 4:c.sent(),c.label=5;case 5:if(!t)return[2,{data:{session:null},error:null}];if(n=!!t.expires_at&&1e3*t.expires_at-Date.now()<9e4,this._debug("#__loadSession()","session has".concat(n?"":" not"," expired"),"expires_at",t.expires_at),n)return[3,8];if(!this.userStorage)return[3,7];return[4,tf(this.userStorage,this.storageKey+"-user")];case 6:(null==(s=c.sent())?void 0:s.user)?t.user=s.user:t.user=tw(),c.label=7;case 7:return this.storage.isServer&&t.user&&(i=this.suppressGetSessionWarning,t=new Proxy(t,{get:function(t,r,n){return i||"user"!==r||(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."),i=!0,e.suppressGetSessionWarning=!0),Reflect.get(t,r,n)}})),[2,{data:{session:t},error:null}];case 8:return[4,this._callRefreshToken(t.refresh_token)];case 9:if(o=(a=c.sent()).data,u=a.error)return[2,{data:{session:null},error:u}];return[2,{data:{session:o},error:null}];case 10:return this._debug("#__loadSession()","end"),[7];case 11:return[2]}})}).call(this)}},{key:"getUser",value:function(e){return(0,K._)(function(){var t;return(0,I._)(this,function(r){switch(r.label){case 0:if(t=this,!e)return[3,2];return[4,this._getUser(e)];case 1:case 4:return[2,r.sent()];case 2:return[4,this.initializePromise];case 3:return r.sent(),[4,this._acquireLock(-1,function(){return(0,K._)(function(){return(0,I._)(this,function(e){switch(e.label){case 0:return[4,this._getUser()];case 1:return[2,e.sent()]}})}).call(t)})]}})}).call(this)}},{key:"_getUser",value:function(e){return(0,K._)(function(){var t,r;return(0,I._)(this,function(n){switch(n.label){case 0:t=this,n.label=1;case 1:if(n.trys.push([1,5,,10]),!e)return[3,3];return[4,tj(this.fetch,"GET","".concat(this.url,"/user"),{headers:this.headers,jwt:e,xform:tP})];case 2:case 4:return[2,n.sent()];case 3:return[4,this._useSession(function(e){return(0,K._)(function(){var t,r,n,s,i;return(0,I._)(this,function(a){switch(a.label){case 0:if(s=e.data,i=e.error)throw i;if(!(null==(t=s.session)?void 0:t.access_token)&&!this.hasCustomAuthorizationHeader)return[2,{data:{user:null},error:new e0}];return[4,tj(this.fetch,"GET","".concat(this.url,"/user"),{headers:this.headers,jwt:null!=(n=null==(r=s.session)?void 0:r.access_token)?n:void 0,xform:tP})];case 1:return[2,a.sent()]}})}).call(t)})];case 5:var s;if(!e$(r=n.sent()))return[3,9];if(!(e$(s=r)&&"AuthSessionMissingError"===s.name))return[3,8];return[4,this._removeSession()];case 6:return n.sent(),[4,td(this.storage,"".concat(this.storageKey,"-code-verifier"))];case 7:n.sent(),n.label=8;case 8:return[2,{data:{user:null},error:r}];case 9:throw r;case 10:return[2]}})}).call(this)}},{key:"updateUser",value:function(e){return(0,K._)(function(e){var t,r,n=arguments;return(0,I._)(this,function(s){switch(s.label){case 0:return t=this,r=n.length>1&&void 0!==n[1]?n[1]:{},[4,this.initializePromise];case 1:return s.sent(),[4,this._acquireLock(-1,function(){return(0,K._)(function(){return(0,I._)(this,function(t){switch(t.label){case 0:return[4,this._updateUser(e,r)];case 1:return[2,t.sent()]}})}).call(t)})];case 2:return[2,s.sent()]}})}).apply(this,arguments)}},{key:"_updateUser",value:function(e){return(0,K._)(function(e){var t,r,n,s=arguments;return(0,I._)(this,function(i){switch(i.label){case 0:t=this,r=s.length>1&&void 0!==s[1]?s[1]:{},i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._useSession(function(n){return(0,K._)(function(){var t,s,i,a,o,u,c,l,h;return(0,I._)(this,function(f){switch(f.label){case 0:if(t=n.data,s=n.error)throw s;if(!t.session)throw new e0;if(i=t.session,a=null,o=null,"pkce"!==this.flowType||null==e.email)return[3,2];return[4,t_(this.storage,this.storageKey)];case 1:a=(u=ev._.apply(void 0,[f.sent(),2]))[0],o=u[1],f.label=2;case 2:return[4,tj(this.fetch,"PUT","".concat(this.url,"/user"),{headers:this.headers,redirectTo:null==r?void 0:r.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:o}),jwt:i.access_token,xform:tP})];case 3:if(l=(c=f.sent()).data,h=c.error)throw h;return i.user=l.user,[4,this._saveSession(i)];case 4:return f.sent(),[4,this._notifyAllSubscribers("USER_UPDATED",i)];case 5:return f.sent(),[2,{data:{user:i.user},error:null}]}})}).call(t)})];case 2:return[2,i.sent()];case 3:if(e$(n=i.sent()))return[2,{data:{user:null},error:n}];throw n;case 4:return[2]}})}).apply(this,arguments)}},{key:"setSession",value:function(e){return(0,K._)(function(){var t;return(0,I._)(this,function(r){switch(r.label){case 0:return t=this,[4,this.initializePromise];case 1:return r.sent(),[4,this._acquireLock(-1,function(){return(0,K._)(function(){return(0,I._)(this,function(t){switch(t.label){case 0:return[4,this._setSession(e)];case 1:return[2,t.sent()]}})}).call(t)})];case 2:return[2,r.sent()]}})}).call(this)}},{key:"_setSession",value:function(e){return(0,K._)(function(){var t,r,n,s,i,a,o,u,c,l,h,f;return(0,I._)(this,function(d){switch(d.label){case 0:if(d.trys.push([0,7,,8]),!e.access_token||!e.refresh_token)throw new e0;if(r=t=Date.now()/1e3,n=!0,s=null,(i=tv(e.access_token).payload).exp&&(n=(r=i.exp)<=t),!n)return[3,2];return[4,this._callRefreshToken(e.refresh_token)];case 1:if(o=(a=d.sent()).data,u=a.error)return[2,{data:{user:null,session:null},error:u}];if(!o)return[2,{data:{user:null,session:null},error:null}];return s=o,[3,6];case 2:return[4,this._getUser(e.access_token)];case 3:if(l=(c=d.sent()).data,h=c.error)throw h;return s={access_token:e.access_token,refresh_token:e.refresh_token,user:l.user,token_type:"bearer",expires_in:r-t,expires_at:r},[4,this._saveSession(s)];case 4:return d.sent(),[4,this._notifyAllSubscribers("SIGNED_IN",s)];case 5:d.sent(),d.label=6;case 6:return[2,{data:{user:s.user,session:s},error:null}];case 7:if(e$(f=d.sent()))return[2,{data:{session:null,user:null},error:f}];throw f;case 8:return[2]}})}).call(this)}},{key:"refreshSession",value:function(e){return(0,K._)(function(){var t;return(0,I._)(this,function(r){switch(r.label){case 0:return t=this,[4,this.initializePromise];case 1:return r.sent(),[4,this._acquireLock(-1,function(){return(0,K._)(function(){return(0,I._)(this,function(t){switch(t.label){case 0:return[4,this._refreshSession(e)];case 1:return[2,t.sent()]}})}).call(t)})];case 2:return[2,r.sent()]}})}).call(this)}},{key:"_refreshSession",value:function(e){return(0,K._)(function(){var t,r;return(0,I._)(this,function(n){switch(n.label){case 0:t=this,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._useSession(function(r){return(0,K._)(function(){var t,n,s,i,a,o;return(0,I._)(this,function(u){switch(u.label){case 0:if(!e){if(n=r.data,s=r.error)throw s;e=null!=(t=n.session)?t:void 0}if(!(null==e?void 0:e.refresh_token))throw new e0;return[4,this._callRefreshToken(e.refresh_token)];case 1:if(a=(i=u.sent()).data,o=i.error)return[2,{data:{user:null,session:null},error:o}];if(!a)return[2,{data:{user:null,session:null},error:null}];return[2,{data:{user:a.user,session:a},error:null}]}})}).call(t)})];case 2:return[2,n.sent()];case 3:if(e$(r=n.sent()))return[2,{data:{user:null,session:null},error:r}];throw r;case 4:return[2]}})}).call(this)}},{key:"_getSessionFromURL",value:function(e,t){return(0,K._)(function(){var r,n,s,i,a,o,u,c,l,h,f,d,p,v,g,_,y,b,m,w,k;return(0,I._)(this,function(S){switch(S.label){case 0:if(S.trys.push([0,4,,5]),!to())throw new e4("No browser detected.");
1if(e.error||e.error_description||e.error_code)throw new e4(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("pkce"===this.flowType)throw new e3("Not a valid PKCE flow url.");break;case"pkce":if("implicit"===this.flowType)throw new e4("Not a valid implicit grant flow url.")}if("pkce"!==t)return[3,2];if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new e3("No code detected.");return[4,this._exchangeCodeForSession(e.code)];case 1:if(n=(r=S.sent()).data,s=r.error)throw s;return(i=new URL(window.location.href)).searchParams.delete("code"),window.history.replaceState(window.history.state,"",i.toString()),[2,{data:{session:n.session,redirectType:null},error:null}];case 2:if(a=e.provider_token,o=e.provider_refresh_token,u=e.access_token,c=e.refresh_token,l=e.expires_in,h=e.expires_at,f=e.token_type,!u||!l||!c||!f)throw new e4("No session defined in URL");return v=(d=Math.round(Date.now()/1e3))+(p=parseInt(l)),h&&(v=parseInt(h)),1e3*(g=v-d)<=3e4&&console.warn("@supabase/gotrue-js: Session as retrieved from URL expires in ".concat(g,"s, should have been closer to ").concat(p,"s")),d-(_=v-p)>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",_,v,d):d-_<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",_,v,d),[4,this._getUser(u)];case 3:if(b=(y=S.sent()).data,m=y.error)throw m;return w={provider_token:a,provider_refresh_token:o,access_token:u,expires_in:p,expires_at:v,refresh_token:c,token_type:f,user:b.user},window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),[2,{data:{session:w,redirectType:e.type},error:null}];case 4:if(e$(k=S.sent()))return[2,{data:{session:null,redirectType:null},error:k}];throw k;case 5:return[2]}})}).call(this)}},{key:"_isImplicitGrantCallback",value:function(e){return!!(e.access_token||e.error_description)}},{key:"_isPKCECallback",value:function(e){return(0,K._)(function(){var t;return(0,I._)(this,function(r){switch(r.label){case 0:return[4,tf(this.storage,"".concat(this.storageKey,"-code-verifier"))];case 1:return t=r.sent(),[2,!!(e.code&&t)]}})}).call(this)}},{key:"signOut",value:function(){return(0,K._)(function(){var e,t,r=arguments;return(0,I._)(this,function(n){switch(n.label){case 0:return e=this,t=r.length>0&&void 0!==r[0]?r[0]:{scope:"global"},[4,this.initializePromise];case 1:return n.sent(),[4,this._acquireLock(-1,function(){return(0,K._)(function(){return(0,I._)(this,function(e){switch(e.label){case 0:return[4,this._signOut(t)];case 1:return[2,e.sent()]}})}).call(e)})];case 2:return[2,n.sent()]}})}).apply(this,arguments)}},{key:"_signOut",value:function(){return(0,K._)(function(){var e,t,r=arguments;return(0,I._)(this,function(n){switch(n.label){case 0:return e=this,t=(r.length>0&&void 0!==r[0]?r[0]:{scope:"global"}).scope,[4,this._useSession(function(r){return(0,K._)(function(){var e,n,s,i,a;return(0,I._)(this,function(o){switch(o.label){case 0:if(n=r.data,s=r.error)return[2,{error:s}];if(!(i=null==(e=n.session)?void 0:e.access_token))return[3,2];return[4,this.admin.signOut(i,t)];case 1:if((a=o.sent().error)&&!(e$(a)&&"AuthApiError"===a.name&&(404===a.status||401===a.status||403===a.status)))return[2,{error:a}];o.label=2;case 2:if("others"===t)return[3,5];return[4,this._removeSession()];case 3:return o.sent(),[4,td(this.storage,"".concat(this.storageKey,"-code-verifier"))];case 4:o.sent(),o.label=5;case 5:return[2,{error:null}]}})}).call(e)})];case 1:return[2,n.sent()]}})}).apply(this,arguments)}},{key:"onAuthStateChange",value:function(e){var t=this,r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}),n={id:r,callback:e,unsubscribe:function(){t._debug("#unsubscribe()","state change callback with id removed",r),t.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,n),(0,K._)(function(){var e;return(0,I._)(this,function(t){switch(t.label){case 0:return e=this,[4,this.initializePromise];case 1:return t.sent(),[4,this._acquireLock(-1,function(){return(0,K._)(function(){return(0,I._)(this,function(e){return this._emitInitialSession(r),[2]})}).call(e)})];case 2:return t.sent(),[2]}})}).call(t),{data:{subscription:n}}}},{key:"_emitInitialSession",value:function(e){return(0,K._)(function(){var t;return(0,I._)(this,function(r){switch(r.label){case 0:return t=this,[4,this._useSession(function(r){return(0,K._)(function(){var t,n,s,i,a;
1return(0,I._)(this,function(o){switch(o.label){case 0:if(o.trys.push([0,2,,4]),s=r.data.session,i=r.error)throw i;return[4,null==(t=this.stateChangeEmitters.get(e))?void 0:t.callback("INITIAL_SESSION",s)];case 1:return o.sent(),this._debug("INITIAL_SESSION","callback id",e,"session",s),[3,4];case 2:return a=o.sent(),[4,null==(n=this.stateChangeEmitters.get(e))?void 0:n.callback("INITIAL_SESSION",null)];case 3:return o.sent(),this._debug("INITIAL_SESSION","callback id",e,"error",a),console.error(a),[3,4];case 4:return[2]}})}).call(t)})];case 1:return[2,r.sent()]}})}).call(this)}},{key:"resetPasswordForEmail",value:function(e){return(0,K._)(function(e){var t,r,n,s,i,a=arguments;return(0,I._)(this,function(o){switch(o.label){case 0:if(t=a.length>1&&void 0!==a[1]?a[1]:{},r=null,n=null,"pkce"!==this.flowType)return[3,2];return[4,t_(this.storage,this.storageKey,!0)];case 1:r=(s=ev._.apply(void 0,[o.sent(),2]))[0],n=s[1],o.label=2;case 2:return o.trys.push([2,4,,5]),[4,tj(this.fetch,"POST","".concat(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})];case 3:return[2,o.sent()];case 4:if(e$(i=o.sent()))return[2,{data:null,error:i}];throw i;case 5:return[2]}})}).apply(this,arguments)}},{key:"getUserIdentities",value:function(){return(0,K._)(function(){var e,t,r,n,s;return(0,I._)(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.getUser()];case 1:if(r=(t=i.sent()).data,n=t.error)throw n;return[2,{data:{identities:null!=(e=r.user.identities)?e:[]},error:null}];case 2:if(e$(s=i.sent()))return[2,{data:null,error:s}];throw s;case 3:return[2]}})}).call(this)}},{key:"linkIdentity",value:function(e){return(0,K._)(function(){return(0,I._)(this,function(t){return"token"in e?[2,this.linkIdentityIdToken(e)]:[2,this.linkIdentityOAuth(e)]})}).call(this)}},{key:"linkIdentityOAuth",value:function(e){return(0,K._)(function(){var t,r,n,s,i,a;return(0,I._)(this,function(o){switch(o.label){case 0:t=this,o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this._useSession(function(r){return(0,K._)(function(){var t,n,s,i,a,o,u,c;return(0,I._)(this,function(l){switch(l.label){case 0:if(o=r.data,u=r.error)throw u;return[4,this._getUrlForProvider("".concat(this.url,"/user/identities/authorize"),e.provider,{redirectTo:null==(t=e.options)?void 0:t.redirectTo,scopes:null==(n=e.options)?void 0:n.scopes,queryParams:null==(s=e.options)?void 0:s.queryParams,skipBrowserRedirect:!0})];case 1:return c=l.sent(),[4,tj(this.fetch,"GET",c,{headers:this.headers,jwt:null!=(a=null==(i=o.session)?void 0:i.access_token)?a:void 0})];case 2:return[2,l.sent()]}})}).call(t)})];case 2:if(s=(n=o.sent()).data,i=n.error)throw i;return!to()||(null==(r=e.options)?void 0:r.skipBrowserRedirect)||window.location.assign(null==s?void 0:s.url),[2,{data:{provider:e.provider,url:null==s?void 0:s.url},error:null}];case 3:if(e$(a=o.sent()))return[2,{data:{provider:e.provider,url:null},error:a}];throw a;case 4:return[2]}})}).call(this)}},{key:"linkIdentityIdToken",value:function(e){return(0,K._)(function(){var t;return(0,I._)(this,function(r){switch(r.label){case 0:return t=this,[4,this._useSession(function(r){return(0,K._)(function(){var t,n,s,i,a,o,u,c,l,h,f,d;return(0,I._)(this,function(p){switch(p.label){case 0:if(p.trys.push([0,5,,6]),n=r.error,s=r.data.session,n)throw n;return i=e.options,a=e.provider,o=e.token,u=e.access_token,c=e.nonce,[4,tj(this.fetch,"POST","".concat(this.url,"/token?grant_type=id_token"),{headers:this.headers,jwt:null!=(t=null==s?void 0:s.access_token)?t:void 0,body:{provider:a,id_token:o,access_token:u,nonce:c,link_identity:!0,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:tI})];case 1:if(h=(l=p.sent()).data,f=l.error)return[2,{data:{user:null,session:null},error:f}];if(!h||!h.session||!h.user)return[2,{data:{user:null,session:null},error:new e2}];if(!h.session)return[3,4];return[4,this._saveSession(h.session)];case 2:return p.sent(),[4,this._notifyAllSubscribers("USER_UPDATED",h.session)];case 3:p.sent(),p.label=4;case 4:return[2,{data:h,error:f}];case 5:if(e$(d=p.sent()))return[2,{data:{user:null,session:null},error:d}];throw d;case 6:return[2]}})}).call(t)})];case 1:return[2,r.sent()]}})}).call(this)}},{key:"unlinkIdentity",value:function(e){return(0,K._)(function(){var t,r;return(0,I._)(this,function(n){switch(n.label){case 0:t=this,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._useSession(function(r){return(0,K._)(function(){var t,n,s,i;return(0,I._)(this,function(a){switch(a.label){case 0:if(s=r.data,i=r.error)throw i;
1return[4,tj(this.fetch,"DELETE","".concat(this.url,"/user/identities/").concat(e.identity_id),{headers:this.headers,jwt:null!=(n=null==(t=s.session)?void 0:t.access_token)?n:void 0})];case 1:return[2,a.sent()]}})}).call(t)})];case 2:return[2,n.sent()];case 3:if(e$(r=n.sent()))return[2,{data:null,error:r}];throw r;case 4:return[2]}})}).call(this)}},{key:"_refreshAccessToken",value:function(e){return(0,K._)(function(){var t,r,n,s;return(0,I._)(this,function(i){switch(i.label){case 0:t=this,r="#_refreshAccessToken(".concat(e.substring(0,5),"...)"),this._debug(r,"begin"),i.label=1;case 1:var a,o;return i.trys.push([1,3,4,5]),n=Date.now(),[4,(a=function(n){return(0,K._)(function(){return(0,I._)(this,function(t){switch(t.label){case 0:var s;if(!(n>0))return[3,2];return[4,(s=200*Math.pow(2,n-1),(0,K._)(function(){return(0,I._)(this,function(e){switch(e.label){case 0:return[4,new Promise(function(e){setTimeout(function(){return e(null)},s)})];case 1:return[2,e.sent()]}})})())];case 1:t.sent(),t.label=2;case 2:return this._debug(r,"refreshing attempt",n),[4,tj(this.fetch,"POST","".concat(this.url,"/token?grant_type=refresh_token"),{body:{refresh_token:e},headers:this.headers,xform:tI})];case 3:return[2,t.sent()]}})}).call(t)},o=function(e,t){var r=200*Math.pow(2,e);return t&&e6(t)&&Date.now()+r-n<3e4},new Promise(function(e,t){(0,K._)(function(){var r,n,s;return(0,I._)(this,function(i){switch(i.label){case 0:r=0,i.label=1;case 1:if(!(r<1/0))return[3,6];i.label=2;case 2:return i.trys.push([2,4,,5]),[4,a(r)];case 3:if(n=i.sent(),!o(r,null,n))return e(n),[2];return[3,5];case 4:if(s=i.sent(),!o(r,s))return t(s),[2];return[3,5];case 5:return r++,[3,1];case 6:return[2]}})})()}))];case 2:return[2,i.sent()];case 3:if(s=i.sent(),this._debug(r,"error",s),e$(s))return[2,{data:{session:null,user:null},error:s}];throw s;case 4:return this._debug(r,"end"),[7];case 5:return[2]}})}).call(this)}},{key:"_isValidSession",value:function(e){return(void 0===e?"undefined":(0,en._)(e))==="object"&&null!==e&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}},{key:"_handleProviderSignIn",value:function(e,t){return(0,K._)(function(){var r;return(0,I._)(this,function(n){switch(n.label){case 0:return[4,this._getUrlForProvider("".concat(this.url,"/authorize"),e,{redirectTo:t.redirectTo,scopes:t.scopes,queryParams:t.queryParams})];case 1:return r=n.sent(),this._debug("#_handleProviderSignIn()","provider",e,"options",t,"url",r),to()&&!t.skipBrowserRedirect&&window.location.assign(r),[2,{data:{provider:e,url:r},error:null}]}})}).call(this)}},{key:"_recoverAndRefresh",value:function(){return(0,K._)(function(){var e,t,r,n,s,i,a,o,u,c,l,h;return(0,I._)(this,function(f){switch(f.label){case 0:r="#_recoverAndRefresh()",this._debug(r,"begin"),f.label=1;case 1:return f.trys.push([1,30,31,32]),[4,tf(this.storage,this.storageKey)];case 2:if(!((n=f.sent())&&this.userStorage))return[3,6];return[4,tf(this.userStorage,this.storageKey+"-user")];case 3:if(s=f.sent(),!(!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!s))return[3,5];return s={user:n.user},[4,th(this.userStorage,this.storageKey+"-user",s)];case 4:f.sent(),f.label=5;case 5:return n.user=null!=(e=null==s?void 0:s.user)?e:tw(),[3,11];case 6:if(!(n&&!n.user)||n.user)return[3,11];return[4,tf(this.storage,this.storageKey+"-user")];case 7:if(!((i=f.sent())&&(null==i?void 0:i.user)))return[3,10];return n.user=i.user,[4,td(this.storage,this.storageKey+"-user")];case 8:return f.sent(),[4,th(this.storage,this.storageKey,n)];case 9:return f.sent(),[3,11];case 10:n.user=tw(),f.label=11;case 11:if(this._debug(r,"session from storage",n),this._isValidSession(n))return[3,14];if(this._debug(r,"session is not valid"),null===n)return[3,13];return[4,this._removeSession()];case 12:f.sent(),f.label=13;case 13:return[2];case 14:if(a=(null!=(t=n.expires_at)?t:1/0)*1e3-Date.now()<9e4,this._debug(r,"session has".concat(a?"":" not"," expired with margin of ").concat(9e4,"s")),!a)return[3,18];if(!(this.autoRefreshToken&&n.refresh_token))return[3,17];return[4,this._callRefreshToken(n.refresh_token)];case 15:if(!(o=f.sent().error)||(console.error(o),e6(o)))return[3,17];return this._debug(r,"refresh failed with a non-retryable error, remov
1ing the session",o),[4,this._removeSession()];case 16:f.sent(),f.label=17;case 17:return[3,29];case 18:if(!(n.user&&!0===n.user.__isUserNotAvailableProxy))return[3,27];f.label=19;case 19:return f.trys.push([19,25,,26]),[4,this._getUser(n.access_token)];case 20:if(c=(u=f.sent()).data,!(!u.error&&(null==c?void 0:c.user)))return[3,23];return n.user=c.user,[4,this._saveSession(n)];case 21:return f.sent(),[4,this._notifyAllSubscribers("SIGNED_IN",n)];case 22:return f.sent(),[3,24];case 23:this._debug(r,"could not get user data, skipping SIGNED_IN notification"),f.label=24;case 24:return[3,26];case 25:return console.error("Error getting user data:",l=f.sent()),this._debug(r,"error getting user data, skipping SIGNED_IN notification",l),[3,26];case 26:return[3,29];case 27:return[4,this._notifyAllSubscribers("SIGNED_IN",n)];case 28:f.sent(),f.label=29;case 29:return[3,32];case 30:return h=f.sent(),this._debug(r,"error",h),console.error(h),[2];case 31:return this._debug(r,"end"),[7];case 32:return[2]}})}).call(this)}},{key:"_callRefreshToken",value:function(e){return(0,K._)(function(){var t,r,n,s,i,a,o,u,c;return(0,I._)(this,function(l){switch(l.label){case 0:if(!e)throw new e0;if(this.refreshingDeferred)return[2,this.refreshingDeferred.promise];n="#_callRefreshToken(".concat(e.substring(0,5),"...)"),this._debug(n,"begin"),l.label=1;case 1:return l.trys.push([1,5,9,10]),this.refreshingDeferred=new tp,[4,this._refreshAccessToken(e)];case 2:if(i=(s=l.sent()).data,a=s.error)throw a;if(!i.session)throw new e0;return[4,this._saveSession(i.session)];case 3:return l.sent(),[4,this._notifyAllSubscribers("TOKEN_REFRESHED",i.session)];case 4:return l.sent(),o={data:i.session,error:null},this.refreshingDeferred.resolve(o),[2,o];case 5:if(u=l.sent(),this._debug(n,"error",u),!e$(u))return[3,8];if(c={data:null,error:u},e6(u))return[3,7];return[4,this._removeSession()];case 6:l.sent(),l.label=7;case 7:return null==(t=this.refreshingDeferred)||t.resolve(c),[2,c];case 8:throw null==(r=this.refreshingDeferred)||r.reject(u),u;case 9:return this.refreshingDeferred=null,this._debug(n,"end"),[7];case 10:return[2]}})}).call(this)}},{key:"_notifyAllSubscribers",value:function(e,t){var r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];return(0,K._)(function(){var n,s,i;return(0,I._)(this,function(a){switch(a.label){case 0:n="#_notifyAllSubscribers(".concat(e,")"),this._debug(n,"begin",t,"broadcast = ".concat(r)),a.label=1;case 1:return a.trys.push([1,,3,4]),this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:t}),s=[],[4,Promise.all(Array.from(this.stateChangeEmitters.values()).map(function(r){return(0,K._)(function(){var n;return(0,I._)(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,r.callback(e,t)];case 1:return i.sent(),[3,3];case 2:return n=i.sent(),s.push(n),[3,3];case 3:return[2]}})})()}))];case 2:if(a.sent(),s.length>0){for(i=0;i<s.length;i+=1)console.error(s[i]);throw s[0]}return[3,4];case 3:return this._debug(n,"end"),[7];case 4:return[2]}})}).call(this)}},{key:"_saveSession",value:function(e){return(0,K._)(function(){var t,r,n,s,i;return(0,I._)(this,function(a){switch(a.label){case 0:if(this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,r=(t=Object.assign({},e)).user&&!0===t.user.__isUserNotAvailableProxy,!this.userStorage)return[3,5];if(!(!r&&t.user))return[3,2];return[4,th(this.userStorage,this.storageKey+"-user",{user:t.user})];case 1:return a.sent(),[3,3];case 2:a.label=3;case 3:return n=Object.assign({},t),delete n.user,s=tk(n),[4,th(this.storage,this.storageKey,s)];case 4:return a.sent(),[3,7];case 5:return i=tk(t),[4,th(this.storage,this.storageKey,i)];case 6:a.sent(),a.label=7;case 7:return[2]}})}).call(this)}},{key:"_removeSession",value:function(){return(0,K._)(function(){return(0,I._)(this,function(e){switch(e.label){case 0:return this._debug("#_removeSession()"),[4,td(this.storage,this.storageKey)];case 1:return e.sent(),[4,td(this.storage,this.storageKey+"-code-verifier")];case 2:return e.sent(),[4,td(this.storage,this.storageKey+"-user")];case 3:if(e.sent(),!this.userStorage)return[3,5];return[4,td(this.userStorage,this.storageKey+"-user")];case 4:e.sent(),e.label=5;case 5:return[4,this._notifyAllSubscribers("SIGNED_OUT",null)];case 6:return e.sent(),[2]}})}).call(this)}},{key:"_removeVisibilityChangedCallback",value:function(){this._debug("#_removeVisibilityChangedCallback()");var e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&to()&&(null==window?void 0:window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}
1catch(e){console.error("removing visibilitychange callback failed",e)}}},{key:"_startAutoRefresh",value:function(){return(0,K._)(function(){var e,t;return(0,I._)(this,function(r){switch(r.label){case 0:return e=this,[4,this._stopAutoRefresh()];case 1:return r.sent(),this._debug("#_startAutoRefresh()"),t=setInterval(function(){return e._autoRefreshTokenTick()},3e4),this.autoRefreshTicker=t,t&&(void 0===t?"undefined":(0,en._)(t))==="object"&&"function"==typeof t.unref?t.unref():"u">typeof Deno&&"function"==typeof Deno.unrefTimer&&Deno.unrefTimer(t),setTimeout(function(){return(0,K._)(function(){return(0,I._)(this,function(e){switch(e.label){case 0:return[4,this.initializePromise];case 1:return e.sent(),[4,this._autoRefreshTokenTick()];case 2:return e.sent(),[2]}})}).call(e)},0),[2]}})}).call(this)}},{key:"_stopAutoRefresh",value:function(){return(0,K._)(function(){var e;return(0,I._)(this,function(t){return this._debug("#_stopAutoRefresh()"),e=this.autoRefreshTicker,this.autoRefreshTicker=null,e&&clearInterval(e),[2]})}).call(this)}},{key:"startAutoRefresh",value:function(){return(0,K._)(function(){return(0,I._)(this,function(e){switch(e.label){case 0:return this._removeVisibilityChangedCallback(),[4,this._startAutoRefresh()];case 1:return e.sent(),[2]}})}).call(this)}},{key:"stopAutoRefresh",value:function(){return(0,K._)(function(){return(0,I._)(this,function(e){switch(e.label){case 0:return this._removeVisibilityChangedCallback(),[4,this._stopAutoRefresh()];case 1:return e.sent(),[2]}})}).call(this)}},{key:"_autoRefreshTokenTick",value:function(){return(0,K._)(function(){var e,t;return(0,I._)(this,function(r){switch(r.label){case 0:e=this,this._debug("#_autoRefreshTokenTick()","begin"),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._acquireLock(0,function(){return(0,K._)(function(){var e,t;return(0,I._)(this,function(r){switch(r.label){case 0:e=this,r.label=1;case 1:r.trys.push([1,,6,7]),t=Date.now(),r.label=2;case 2:return r.trys.push([2,4,,5]),[4,this._useSession(function(r){return(0,K._)(function(){var e,n;return(0,I._)(this,function(s){switch(s.label){case 0:if(!(e=r.data.session)||!e.refresh_token||!e.expires_at)return this._debug("#_autoRefreshTokenTick()","no session"),[2];if(n=Math.floor((1e3*e.expires_at-t)/3e4),this._debug("#_autoRefreshTokenTick()","access token expires in ".concat(n," ticks, a tick lasts ").concat(3e4,"ms, refresh threshold is ").concat(3," ticks")),!(n<=3))return[3,2];return[4,this._callRefreshToken(e.refresh_token)];case 1:s.sent(),s.label=2;case 2:return[2]}})}).call(e)})];case 3:return[2,r.sent()];case 4:return console.error("Auto refresh tick failed with error. This is likely a transient error.",r.sent()),[3,5];case 5:return[3,7];case 6:return this._debug("#_autoRefreshTokenTick()","end"),[7];case 7:return[2]}})}).call(e)})];case 2:return r.sent(),[3,4];case 3:if((t=r.sent()).isAcquireTimeout||(0,j._)(t,tM))this._debug("auto refresh token tick lock not available");else throw t;return[3,4];case 4:return[2]}})}).call(this)}},{key:"_handleVisibilityChange",value:function(){return(0,K._)(function(){var e;return(0,I._)(this,function(t){switch(t.label){case 0:if(e=this,this._debug("#_handleVisibilityChange()"),!to()||!(null==window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),[2,!1];t.label=1;case 1:return t.trys.push([1,3,,4]),this.visibilityChangedCallback=function(){return(0,K._)(function(){return(0,I._)(this,function(e){switch(e.label){case 0:return[4,this._onVisibilityChanged(!1)];case 1:return[2,e.sent()]}})}).call(e)},null==window||window.addEventListener("visibilitychange",this.visibilityChangedCallback),[4,this._onVisibilityChanged(!0)];case 2:return t.sent(),[3,4];case 3:return console.error("_handleVisibilityChange",t.sent()),[3,4];case 4:return[2]}})}).call(this)}},{key:"_onVisibilityChanged",value:function(e){return(0,K._)(function(){var t,r;return(0,I._)(this,function(n){switch(n.label){case 0:if(t=this,r="#_onVisibilityChanged(".concat(e,")"),this._debug(r,"visibilityState",document.visibilityState),"visible"!==document.visibilityState)return[3,4];if(this.autoRefreshToken&&this._startAutoRefresh(),e)return[3,3];return[4,this.initializePromise];case 1:return n.sent(),[4,this._acquireLock(-1,function(){return(0,K._)(function(){return(0,I._)(this,function(e){switch(e.label){case 0:if("visible"!==document.visibilityState)return this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting"),[2];return[4,this._recoverAndRefresh()];case 1:return e.sent(),[2]}})}).call(t)})];case 2:n.sent(),n.label=3;case 3:return[3,5];case 4:"hidden"===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh(),n.label=5;case 5:return[2]}})}).call(this)}},{key:"_getUrlForProvider",value:function(e,t,r){return(0,K._)(function(){var n,s,i,a,o,u;return(0,I._)(this,function(c){switch(c.label){case 0:if(n=["provider=".concat(encodeURIComponent(t))],(null==r?void 0:r.redirectTo)&&n.push("redirect_to=".concat(encodeURIComponent(r.redirectTo))),(null==r?void 0:r.scopes)&&n.push("scopes=".concat(encodeURIComponent(r.scopes))),"pkce"!==this.flowType)return[3,2];return[4,t_(this.storage,this.storageKey)];case 1:i=(s=ev._.apply(void 0,[c.sent(),2]))[0],a=s[1],o=new URLSearchParams({code_challenge:"".concat(encodeURIComponent(i)),code_challenge_method:"".concat(encodeURIComponent(a))}),n.push(o.toString()),c.label=2;
1case 2:return(null==r?void 0:r.queryParams)&&(u=new URLSearchParams(r.queryParams),n.push(u.toString())),(null==r?void 0:r.skipBrowserRedirect)&&n.push("skip_http_redirect=".concat(r.skipBrowserRedirect)),[2,"".concat(e,"?").concat(n.join("&"))]}})}).call(this)}},{key:"_unenroll",value:function(e){return(0,K._)(function(){var t,r;return(0,I._)(this,function(n){switch(n.label){case 0:t=this,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._useSession(function(r){return(0,K._)(function(){var t,n,s;return(0,I._)(this,function(i){switch(i.label){case 0:if(n=r.data,s=r.error)return[2,{data:null,error:s}];return[4,tj(this.fetch,"DELETE","".concat(this.url,"/factors/").concat(e.factorId),{headers:this.headers,jwt:null==(t=null==n?void 0:n.session)?void 0:t.access_token})];case 1:return[2,i.sent()]}})}).call(t)})];case 2:return[2,n.sent()];case 3:if(e$(r=n.sent()))return[2,{data:null,error:r}];throw r;case 4:return[2]}})}).call(this)}},{key:"_enroll",value:function(e){return(0,K._)(function(){var t,r;return(0,I._)(this,function(n){switch(n.label){case 0:t=this,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._useSession(function(r){return(0,K._)(function(){var t,n,s,i,a,o,u,c;return(0,I._)(this,function(l){switch(l.label){case 0:if(s=r.data,i=r.error)return[2,{data:null,error:i}];return a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},"phone"===e.factorType?{phone:e.phone}:"totp"===e.factorType?{issuer:e.issuer}:{}),[4,tj(this.fetch,"POST","".concat(this.url,"/factors"),{body:a,headers:this.headers,jwt:null==(t=null==s?void 0:s.session)?void 0:t.access_token})];case 1:if(u=(o=l.sent()).data,c=o.error)return[2,{data:null,error:c}];return"totp"===e.factorType&&"totp"===u.type&&(null==(n=null==u?void 0:u.totp)?void 0:n.qr_code)&&(u.totp.qr_code="data:image/svg+xml;utf-8,".concat(u.totp.qr_code)),[2,{data:u,error:null}]}})}).call(t)})];case 2:return[2,n.sent()];case 3:if(e$(r=n.sent()))return[2,{data:null,error:r}];throw r;case 4:return[2]}})}).call(this)}},{key:"_verify",value:function(e){return(0,K._)(function(){var t;return(0,I._)(this,function(r){return t=this,[2,this._acquireLock(-1,function(){return(0,K._)(function(){var t,r;return(0,I._)(this,function(n){switch(n.label){case 0:t=this,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._useSession(function(r){return(0,K._)(function(){var t,n,s,i,a,o,u;return(0,I._)(this,function(c){switch(c.label){case 0:var l,h;if(n=r.data,s=r.error)return[2,{data:null,error:s}];return i=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:"create"===e.webauthn.type?"toJSON"in(l=e.webauthn.credential_response)&&"function"==typeof l.toJSON?l.toJSON():{id:l.id,rawId:l.id,response:{attestationObject:ta(new Uint8Array(l.response.attestationObject)),clientDataJSON:ta(new Uint8Array(l.response.clientDataJSON))},type:"public-key",clientExtensionResults:l.getClientExtensionResults(),authenticatorAttachment:null!=(h=l.authenticatorAttachment)?h:void 0}:function(e){if("toJSON"in e&&"function"==typeof e.toJSON)return e.toJSON();var t,r=e.getClientExtensionResults(),n=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:ta(new Uint8Array(n.authenticatorData)),clientDataJSON:ta(new Uint8Array(n.clientDataJSON)),signature:ta(new Uint8Array(n.signature)),userHandle:n.userHandle?ta(new Uint8Array(n.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:null!=(t=e.authenticatorAttachment)?t:void 0}}(e.webauthn.credential_response)})}:{code:e.code}),[4,tj(this.fetch,"POST","".concat(this.url,"/factors/").concat(e.factorId,"/verify"),{body:i,headers:this.headers,jwt:null==(t=null==n?void 0:n.session)?void 0:t.access_token})];case 1:if(o=(a=c.sent()).data,u=a.error)return[2,{data:null,error:u}];return[4,this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+o.expires_in},o))];case 2:return c.sent(),[4,this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",o)];case 3:return c.sent(),[2,{data:o,error:u}]}})}).call(t)})];case 2:return[2,n.sent()];case 3:if(e$(r=n.sent()))return[2,{data:null,error:r}];throw r;case 4:return[2]}})}).call(t)})]})}).call(this)}},{key:"_challenge",value:function(e){return(0,K._)(function(){var t;return(0,I._)(this,function(r){return t=this,[2,this._acquireLock(-1,function(){return(0,K._)(function(){var t,r;return(0,I._)(this,function(n){switch(n.label){case 0:t=this,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._useSession(function(r){return(0,K._)(function(){var t,n,s,i,a;return(0,I._)(this,function(o){switch(o.label){case 0:if(n=r.data,s=r.error)return[2,{data:null,error:s}];return[4,tj(this.fetch,"POST","".concat(this.url,"/factors/").concat(e.factorId,"/challenge"),{body:e,headers:this.headers,jwt:null==(t=null==n?void 0:n.session)?void 0:t.access_token})];case 1:if((i=o.sent()).error)return[2,i];if("webauthn"!==(a=i.data).type)return[2,{data:a,error:null}];switch(a.webauthn.type){case"create":return[2,{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:function(e){if(!e)throw Error("Credential creation options are required");if("u">typeof PublicKeyCredential&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&"function"==typeof PublicKeyCredential.parseCreationOptionsFromJSON)return PublicKeyCredential.parseCreationOptionsFromJSON(e);var t=e.challenge,r=e.user,n=e.excludeCredentials,s=tH(e,["challenge","user","excludeCredentials"]),i=ti(t).buffer,a=Object.assign(Object.assign({},r),{id:ti(r.id).buffer}),o=Object.assign(Object.assign({}
1,s),{challenge:i,user:a});if(n&&n.length>0){o.excludeCredentials=Array(n.length);for(var u=0;u<n.length;u++){var c=n[u];o.excludeCredentials[u]=Object.assign(Object.assign({},c),{id:ti(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return o}(a.webauthn.credential_options.publicKey)})})}),error:null}];case"request":return[2,{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:function(e){if(!e)throw Error("Credential request options are required");if("u">typeof PublicKeyCredential&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&"function"==typeof PublicKeyCredential.parseRequestOptionsFromJSON)return PublicKeyCredential.parseRequestOptionsFromJSON(e);var t=e.challenge,r=e.allowCredentials,n=tH(e,["challenge","allowCredentials"]),s=ti(t).buffer,i=Object.assign(Object.assign({},n),{challenge:s});if(r&&r.length>0){i.allowCredentials=Array(r.length);for(var a=0;a<r.length;a++){var o=r[a];i.allowCredentials[a]=Object.assign(Object.assign({},o),{id:ti(o.id).buffer,type:o.type||"public-key",transports:o.transports})}}return i}(a.webauthn.credential_options.publicKey)})})}),error:null}]}return[2]}})}).call(t)})];case 2:return[2,n.sent()];case 3:if(e$(r=n.sent()))return[2,{data:null,error:r}];throw r;case 4:return[2]}})}).call(t)})]})}).call(this)}},{key:"_challengeAndVerify",value:function(e){return(0,K._)(function(){var t,r,n;return(0,I._)(this,function(s){switch(s.label){case 0:return[4,this._challenge({factorId:e.factorId})];case 1:if(r=(t=s.sent()).data,n=t.error)return[2,{data:null,error:n}];return[4,this._verify({factorId:e.factorId,challengeId:r.id,code:e.code})];case 2:return[2,s.sent()]}})}).call(this)}},{key:"_listFactors",value:function(){return(0,K._)(function(){var e,t,r,n,s,i,a,o,u,c,l;return(0,I._)(this,function(h){switch(h.label){case 0:return[4,this.getUser()];case 1:if(r=(t=h.sent()).data.user,n=t.error)return[2,{data:null,error:n}];s={all:[],phone:[],totp:[],webauthn:[]},i=!0,a=!1,o=void 0;try{for(u=(null!=(e=null==r?void 0:r.factors)?e:[])[Symbol.iterator]();!(i=(c=u.next()).done);i=!0)l=c.value,s.all.push(l),"verified"===l.status&&s[l.factor_type].push(l)}catch(e){a=!0,o=e}finally{try{i||null==u.return||u.return()}finally{if(a)throw o}}return[2,{data:s,error:null}]}})}).call(this)}},{key:"_getAuthenticatorAssuranceLevel",value:function(){return(0,K._)(function(){var e;return(0,I._)(this,function(t){return e=this,[2,this._acquireLock(-1,function(){return(0,K._)(function(){return(0,I._)(this,function(e){switch(e.label){case 0:return[4,this._useSession(function(e){return(0,K._)(function(){var t,r,n,s,i,a,o,u;return(0,I._)(this,function(c){return(n=e.data.session,s=e.error)?[2,{data:null,error:s}]:n?(i=tv(n.access_token).payload,a=null,i.aal&&(a=i.aal),o=a,(null!=(r=null==(t=n.user.factors)?void 0:t.filter(function(e){return"verified"===e.status}))?r:[]).length>0&&(o="aal2"),u=i.amr||[],[2,{data:{currentLevel:a,nextLevel:o,currentAuthenticationMethods:u},error:null}]):[2,{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null}]})})()})];case 1:return[2,e.sent()]}})}).call(e)})]})}).call(this)}},{key:"fetchJwk",value:function(e){return(0,K._)(function(e){var t,r,n,s,i,a=arguments;return(0,I._)(this,function(o){switch(o.label){case 0:if((t=(a.length>1&&void 0!==a[1]?a[1]:{keys:[]}).keys.find(function(t){return t.kid===e}))||(r=Date.now(),(t=this.jwks.keys.find(function(t){return t.kid===e}))&&this.jwks_cached_at+6e5>r))return[2,t];return[4,tj(this.fetch,"GET","".concat(this.url,"/.well-known/jwks.json"),{headers:this.headers})];case 1:if(s=(n=o.sent()).data,i=n.error)throw i;if(!s.keys||0===s.keys.length||(this.jwks=s,this.jwks_cached_at=r,!(t=s.keys.find(function(t){return t.kid===e}))))return[2,null];return[2,t]}})}).apply(this,arguments)}},{key:"getClaims",value:function(e){return(0,K._)(function(e){var t,r,n,s,i,a,o,u,c,l,h,f,d,p,v,g,_,y,b=arguments;return(0,I._)(this,function(m){switch(m.label){case 0:t=b.length>1&&void 0!==b[1]?b[1]:{},m.label=1;case 1:if(m.trys.push([1,11,,12]),r=e)return[3,3];
1return[4,this.getSession()];case 2:if(s=(n=m.sent()).data,(i=n.error)||!s.session)return[2,{data:null,error:i}];r=s.session.access_token,m.label=3;case 3:if(o=(a=tv(r)).header,u=a.payload,c=a.signature,h=(l=a.raw).header,f=l.payload,(null==t?void 0:t.allowExpired)||function(e){if(!e)throw Error("Missing exp claim");if(e<=Math.floor(Date.now()/1e3))throw Error("JWT has expired")}(u.exp),!(!o.alg||o.alg.startsWith("HS")||!o.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)))return[3,4];return p=null,[3,6];case 4:return[4,this.fetchJwk(o.kid,(null==t?void 0:t.keys)?{keys:t.keys}:null==t?void 0:t.jwks)];case 5:p=m.sent(),m.label=6;case 6:if(d=p)return[3,8];return[4,this.getUser(r)];case 7:if(v=m.sent().error)throw v;return[2,{data:{claims:u,header:o,signature:c},error:null}];case 8:return g=function(e){switch(e){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 Error("Invalid alg claim")}}(o.alg),[4,crypto.subtle.importKey("jwk",d,g,!0,["verify"])];case 9:var w,k;return _=m.sent(),[4,crypto.subtle.verify(g,_,c,(w="".concat(h,".").concat(f),k=[],!function(e,t){for(var r=0;r<e.length;r+=1){var n=e.charCodeAt(r);if(n>55295&&n<=56319){var s=(n-55296)*1024&65535;n=(e.charCodeAt(r+1)-56320&65535|s)+65536,r+=1}!function(e,t){if(e<=127)return t(e);if(e<=2047){t(192|e>>6),t(128|63&e);return}if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|63&e);return}if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|63&e);return}throw Error("Unrecognized Unicode codepoint: ".concat(e.toString(16)))}(n,t)}}(w,function(e){return k.push(e)}),new Uint8Array(k)))];case 10:if(!m.sent())throw new e7("Invalid JWT signature");return[2,{data:{claims:u,header:o,signature:c},error:null}];case 11:if(e$(y=m.sent()))return[2,{data:null,error:y}];throw y;case 12:return[2]}})}).apply(this,arguments)}}]),e}();t4.nextInstanceID=0;var t3=function(e){function t(e){return(0,O._)(this,t),(0,C._)(this,t,[e])}return(0,x._)(t,e),t}(t4),t5=function(){function e(t,r,n){(0,O._)(this,e),this.supabaseUrl=t,this.supabaseKey=r;var s,i,a,o=function(e){var t=null==e?void 0:e.trim();if(!t)throw Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(t.endsWith("/")?t:t+"/")}catch(e){throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}(t);if(!r)throw Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",o),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",o),this.storageUrl=new URL("storage/v1",o),this.functionsUrl=new URL("functions/v1",o);var u="sb-".concat(o.hostname.split(".")[0],"-auth-token"),c=function(e,t){var r,n,s=this,i=e.db,a=e.auth,o=e.realtime,u=e.global,c=t.db,l=t.auth,h=t.realtime,f=t.global,d={db:Object.assign(Object.assign({},c),i),auth:Object.assign(Object.assign({},l),a),realtime:Object.assign(Object.assign({},h),o),storage:{},global:Object.assign(Object.assign(Object.assign({},f),u),{headers:Object.assign(Object.assign({},null!=(r=null==f?void 0:f.headers)?r:{}),null!=(n=null==u?void 0:u.headers)?n:{})}),accessToken:function(){var e,t,r;return e=void 0,t=void 0,r=function(){return(0,I._)(this,function(e){return[2,""]})},new(t||(t=Promise))(function(n,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function o(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var r;e.done?n(e.value):(r=e.value,(0,j._)(r,t)?r:new t(function(e){e(r)})).then(a,o)}u((r=r.apply(s,e||[])).next())})}};return e.accessToken?d.accessToken=e.accessToken:delete d.accessToken,d}(null!=n?n:{},{db:eq,realtime:eW,auth:Object.assign(Object.assign({},eM),{storageKey:u}),global:eD});this.storageKey=null!=(s=c.auth.storageKey)?s:"",this.headers=null!=(i=c.global.headers)?i:{},c.accessToken?(this.accessToken=c.accessToken,this.auth=new Proxy({},{get:function(e,t){throw Error("@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.".concat(String(t)," is not possible"))}})):this.auth=this._initSupabaseAuthClient(null!=(a=c.auth)?a:{},this.headers,c.global.fetch),this.fetch=ez(r,this._getAccessToken.bind(this),c.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},c.realtime)),this.rest=new W(new URL("rest/v1",o).href,{headers:this.headers,schema:c.db.schema,fetch:this.fetch}),this.storage=new eL(this.storageUrl.href,this.headers,this.fetch,null==n?void 0:n.storage),c.accessToken||this._listenForAuthEvents()}return(0,A._)(e,[{key:"functions",get:function(){return new q(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}},{key:"from",value:function(e){return this.rest.from(e)}},{key:"schema",value:function(e){return this.rest.schema(e)}},{key:"rpc",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{head:!1,get:!1,count:void 0};return this.rest.rpc(e,t,r)}},{key:"channel",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{config:{}};return this.realtime.channel(e,t)}},{key:"getChannels",value:function(){return this.realtime.getChannels()}},{key:"removeChannel",value:function(e){return this.realtime.removeChannel(e)}},{key:"removeAllChannels",value:function(){return this.realtime.removeAllChannels()}},{key:"_getAccessToken",value:function(){var e,t,r,n;return e=this,t=void 0,r=void 0,n=function(){var e,t;return(0,I._)(this,function(r){switch(r.label){case 0:if(!this.accessToken)return[3,2];return[4,this.accessToken()];case 1:return[2,r.sent()];case 2:return[4,this.auth.getSession()];case 3:return[2,null!=(t=null==(e=r.sent().data.session)?void 0:e.access_token)?t:this.supabaseKey]}})},new(r||(r=Promise))(function(s,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function o(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?s(e.value):(t=e.value,(0,j._)(t,r)?t:new r(function(e){e(t)})).then(a,o)}u((n=n.apply(e,t||[])).next())})}},{key:"_initSupabaseAuthClient",value:function(e,t,r){var n=e.autoRefreshToken,s=e.persistSession,i=e.detectSessionInUrl,a=e.storage,o=e.userStorage,u=e.storageKey,c=e.flowType,l=e.lock,h=e.debug,f={Authorization:"Bearer ".concat(this.supabaseKey),apikey:"".concat(this.supabaseKey)};return new t3({url:this.authUrl.href,headers:Object.assign(Object.assign({},f),t),storageKey:u,autoRefreshToken:n,persistSession:s,detectSessionInUrl:i,storage:a,userStorage:o,flowType:c,lock:l,debug:h,fetch:r,hasCustomAuthorizationHeader:Object.keys(this.headers).some(function(e){return"authorization"===e.toLowerCase()})})}},{key:"_initRealtimeClient",value:function(e){return new ec(this.realtimeUrl.href,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},null==e?void 0:e.params)}))}},{key:"_listenForAuthEvents",value:function(){var e=this;return this.auth.onAuthStateChange(function(t,r){e._handleTokenChanged(t,"CLIENT",null==r?void 0:r.access_token)})}},{key:"_handleTokenChanged",value:function(e,t,r){("TOKEN_REFRESHED"===e||"SIGNED_IN"===e)&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):"SIGNED_OUT"===e&&(this.realtime.setAuth(),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void 0)}}]),e}();(function(){if("u">typeof window||void 0===T.default)return!1;var e=T.default.version;if(null==e)return!1;var t=e.match(/^v(\d+)\./);return!!t&&18>=parseInt(t[1],10)})()&&console.warn("⚠️  Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to N
1ode.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");var t6=e.i(909156);function t8(){return"u">typeof window&&void 0!==window.document}t6.parse,t6.serialize;var t7={path:"/",sameSite:"lax",httpOnly:!1,maxAge:3456e4},t9=/^(.*)[.](0|[1-9][0-9]*)$/;function re(e,t){if(e===t)return!0;var r=e.match(t9);return!!r&&r[1]===t}function rt(e,t,r){var n=null!=r?r:3180,s=encodeURIComponent(t);if(s.length<=n)return[{name:e,value:t}];for(var i=[];s.length>0;){var a=s.slice(0,n),o=a.lastIndexOf("%");o>n-3&&(a=a.slice(0,o));for(var u="";a.length>0;)try{u=decodeURIComponent(a);break}catch(e){if((0,j._)(e,URIError)&&"%"===a.at(-3)&&a.length>3)a=a.slice(0,a.length-3);else throw e}i.push(u),s=s.slice(a.length)}return i.map(function(t,r){return{name:"".concat(e,".").concat(r),value:t}})}function rr(e,t){return(0,K._)(function(){var r,n,s,i;return(0,I._)(this,function(a){switch(a.label){case 0:return[4,t(e)];case 1:if(r=a.sent())return[2,r];n=[],s=0,a.label=2;case 2:return[4,t("".concat(e,".").concat(s))];case 3:if(!(i=a.sent()))return[3,5];n.push(i),a.label=4;case 4:return s++,[3,2];case 5:if(n.length>0)return[2,n.join("")];return[2,null]}})})()}var rn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),rs=" 	\n\r=".split(""),ri=function(){for(var e=Array(128),t=0;t<e.length;t+=1)e[t]=-1;for(var r=0;r<rs.length;r+=1)e[rs[r].charCodeAt(0)]=-2;for(var n=0;n<rn.length;n+=1)e[rn[n].charCodeAt(0)]=n;return e}();function ra(e){var t=[],r=0,n=0;if(function(e,t){for(var r=0;r<e.length;r+=1){var n=e.charCodeAt(r);if(n>55295&&n<=56319){var s=(n-55296)*1024&65535;n=(e.charCodeAt(r+1)-56320&65535|s)+65536,r+=1}!function(e,t){if(e<=127)return t(e);if(e<=2047){t(192|e>>6),t(128|63&e);return}if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|63&e);return}if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|63&e);return}throw Error("Unrecognized Unicode codepoint: ".concat(e.toString(16)))}(n,t)}}(e,function(e){for(r=r<<8|e,n+=8;n>=6;){var s=r>>n-6&63;t.push(rn[s]),n-=6}}),n>0)for(r<<=6-n,n=6;n>=6;){var s=r>>n-6&63;t.push(rn[s]),n-=6}return t.join("")}function ro(e){for(var t=[],r=function(e){t.push(String.fromCodePoint(e))},n={utf8seq:0,codepoint:0},s=0,i=0,a=0;a<e.length;a+=1){var o=ri[e.charCodeAt(a)];if(o>-1)for(s=s<<6|o,i+=6;i>=8;)(function(e,t,r){if(0===t.utf8seq){if(e<=127)return r(e);for(var n=1;n<6;n+=1)if((e>>7-n&1)==0){t.utf8seq=n;break}if(2===t.utf8seq)t.codepoint=31&e;else if(3===t.utf8seq)t.codepoint=15&e;else if(4===t.utf8seq)t.codepoint=7&e;else throw Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|63&e,t.utf8seq-=1,0===t.utf8seq&&r(t.codepoint)}})(s>>i-8&255,n,r),i-=8;else if(-2===o)continue;else throw Error('Invalid Base64-URL character "'.concat(e.at(a),'" at position ').concat(a))}return t.join("")}var ru=e.i(299749),rc="base64-";function rl(e,t,r){var n,s,i,a=(null==r?void 0:r.isSingleton)===!0||(!r||!("isSingleton"in r))&&t8();if(a&&k)return k;if(!e||!t)throw Error("@supabase/ssr: Your project's URL and API key are required to create a Supabase client!\n\nCheck your Supabase project's API settings to find these values\n\nhttps://supabase.com/dashboard/project/_/settings/api");var o=function(e,t){var r,n,s,i=null!=(r=e.cookies)?r:null,a=e.cookieEncoding,o={},u={};if(i)if("get"in i)if(n=function(e){return(0,K._)(function(){return(0,I._)(this,function(t){switch(t.label){case 0:return[4,(0,K._)(function(){var t,r,n,s;return(0,I._)(this,function(a){switch(a.label){case 0:t=e.flatMap(function(e){return[e].concat((0,R._)(Array.from({length:5}).map(function(t,r){return"".concat(e,".").concat(r)})))}),r=[],n=0,a.label=1;case 1:if(!(n<t.length))return[3,4];return[4,i.get(t[n])];case 2:if(!(s=a.sent())&&"string"!=typeof s)return[3,3];r.push({name:t[n],value:s}),a.label=3;case 3:return n+=1,[3,1];case 4:return[2,r]}})})()];case 1:return[2,t.sent()]}})})()},"set"in i&&"remove"in i)s=function(e){return(0,K._)(function(){var t,r,n,s,a;return(0,I._)(this,function(o){switch(o.label){case 0:t=0,o.label=1;case 1:if(!(t<e.length))return[3,6];if(n=(r=e[t]).name,s=r.value,a=r.options,!s)return[3,3];return[4,i.set(n,s,a)];case 2:return o.sent(),[3,5];case 3:return[4,i.remove(n,a)];case 4:o.sent(),o.label=5;case 5:return t+=1,[3,1];case 6:return[2]}})})()};else if(t)s=function(){return(0,K._)(function(){return(0,I._)(this,function(e){return 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 c
1orrectness. 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."),[2]})})()};else throw 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 i)if(n=function(){return(0,K._)(function(){return(0,I._)(this,function(e){switch(e.label){case 0:return[4,i.getAll()];case 1:return[2,e.sent()]}})})()},"setAll"in i)s=i.setAll;else if(t)s=function(){return(0,K._)(function(){return(0,I._)(this,function(e){return 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."),[2]})})()};else throw Error("@supabase/ssr: createBrowserClient requires configuring both getAll and setAll cookie methods (deprecated: alternatively both get, set and remove can be used)");else throw Error("@supabase/ssr: ".concat(t?"createServerClient":"createBrowserClient"," requires configuring getAll and setAll cookie methods (deprecated: alternatively use get, set and remove).").concat(t8()?" As this is called in a browser runtime, consider removing the cookies option object to use the document.cookie API automatically.":""));else if(!t&&t8()){var c=function(){var e=(0,t6.parse)(document.cookie);return Object.keys(e).map(function(t){var r;return{name:t,value:null!=(r=e[t])?r:""}})};n=function(){return c()},s=function(e){e.forEach(function(e){var t=e.name,r=e.value,n=e.options;document.cookie=(0,t6.serialize)(t,r,n)})}}else if(t)throw 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)");else n=function(){return[]},s=function(){throw 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 t?{getAll:n,setAll:s,setItems:o,removedItems:u,storage:{isServer:!0,getItem:function(e){return(0,K._)(function(){var t,r,s;return(0,I._)(this,function(i){switch(i.label){case 0:if("string"==typeof o[e])return[2,o[e]];if(u[e])return[2,null];return[4,n([e])];case 1:return t=i.sent(),[4,rr(e,function(e){return(0,K._)(function(){var r;return(0,I._)(this,function(n){return(r=(null==t?void 0:t.find(function(t){return t.name===e}))||null)?[2,r.value]:[2,null]})})()})];case 2:if(!(r=i.sent()))return[2,null];return s=r,"string"==typeof r&&r.startsWith(rc)&&(s=ro(r.substring(rc.length))),[2,s]}})})()},setItem:function(t,r){return(0,K._)(function(){var i;return(0,I._)(this,function(c){switch(c.label){case 0:if(!t.endsWith("-code-verifier"))return[3,2];return[4,function(e,t){return(0,K._)(function(e,t){var r,n,s,i,a,o,u,c,l,h,f,d,p;return(0,I._)(this,function(v){switch(v.label){case 0:return r=e.getAll,n=e.setAll,s=e.setItems,i=e.removedItems,o=t.cookieEncoding,u=null!=(a=t.cookieOptions)?a:null,[4,r((0,R._)(s?Object.keys(s):[]).concat((0,R._)(i?Object.keys(i):[])))];case 1:return l=(null==(c=v.sent())?void 0:c.map(function(e){return e.name}))||[],h=Object.keys(i).flatMap(function(e){return l.filter(function(t){return re(t,e)})}),f=Object.keys(s).flatMap(function(e){var t=new Set(l.filter(function(t){return re(t,e)})),r=s[e];"base64url"===o&&(r=rc+ra(r));var n=rt(e,r);return n.forEach(function(e){t.delete(e.name)}),h.push.apply(h,(0,R._)(t)),n}),d=(0,E._)((0,S._)({},t7,u),{maxAge:0}),p=(0,E._)((0,S._)({},t7,u),{maxAge:t7.maxAge}),delete d.name,delete p.name,[4,n((0,R._)(h.map(function(e){return{name:e,value:"",options:d}})).concat((0,R._)(f.map(function(e){return{name:e.name,value:e.value,options:p}}))))];case 2:return v.sent(),[2]}})}).apply(this,arguments)}({getAll:n,setAll:s,setItems:(0,ru._)({},t,r),removedItems:{}},{cookieOptions:null!=(i=null==e?void 0:e.cookieOptions)?i:null,cookieEncoding:a})];case 1:c.sent(),c.label=2;case 2:return o[t]=r,delete u[t],[2]}})})()},removeItem:function(e){return(0,K._)(function(){return(0,I._)(this,function(t){return delete o[e],u[e]=!0,[2]})})()}}}:{getAll:n,setAll:s,setItems:o,removedItems:u,storage:{isServer:!1,getItem:function(e){return(0,K._)(function(){var t,r,s;return(0,I._)(this,function(i){switch(i.label){case 0:return[4,n([e])];case 1:return t=i.sent(),[4,rr(e,function(e){return(0,K._)(function(){var r;return(0,I._)(this,function(n){return(r=(null==t?void 0:t.find(function(t){return t.name===e}))||null)?[2,r.value]:[2,null]})})()})];case 2:if(!(r=i.sent()))return[2,null];
1return s=r,r.startsWith(rc)&&(s=ro(r.substring(rc.length))),[2,s]}})})()},setItem:function(t,r){return(0,K._)(function(){var i,o,u,c,l,h,f;return(0,I._)(this,function(d){switch(d.label){case 0:return[4,n([t])];case 1:if(o=new Set(((null==(i=d.sent())?void 0:i.map(function(e){return e.name}))||[]).filter(function(e){return re(e,t)})),u=r,"base64url"===a&&(u=rc+ra(r)),(c=rt(t,u)).forEach(function(e){var t=e.name;o.delete(t)}),l=(0,E._)((0,S._)({},t7,null==e?void 0:e.cookieOptions),{maxAge:0}),h=(0,E._)((0,S._)({},t7,null==e?void 0:e.cookieOptions),{maxAge:t7.maxAge}),delete l.name,delete h.name,!((f=(0,R._)((0,R._)(o).map(function(e){return{name:e,value:"",options:l}})).concat((0,R._)(c.map(function(e){return{name:e.name,value:e.value,options:h}})))).length>0))return[3,3];return[4,s(f)];case 2:d.sent(),d.label=3;case 3:return[2]}})})()},removeItem:function(t){return(0,K._)(function(){var r,i,a;return(0,I._)(this,function(o){switch(o.label){case 0:return[4,n([t])];case 1:if(i=((null==(r=o.sent())?void 0:r.map(function(e){return e.name}))||[]).filter(function(e){return re(e,t)}),a=(0,E._)((0,S._)({},t7,null==e?void 0:e.cookieOptions),{maxAge:0}),delete a.name,!(i.length>0))return[3,3];return[4,s(i.map(function(e){return{name:e,value:"",options:a}}))];case 2:o.sent(),o.label=3;case 3:return[2]}})})()}}}}((0,E._)((0,S._)({},r),{cookieEncoding:null!=(n=null==r?void 0:r.cookieEncoding)?n:"base64url"}),!1).storage,u=new t5(e,t,(0,E._)((0,S._)({},r),{global:(0,E._)((0,S._)({},null==r?void 0:r.global),{headers:(0,E._)((0,S._)({},null==r||null==(s=r.global)?void 0:s.headers),{"X-Client-Info":"supabase-ssr/".concat("0.6.1"," createBrowserClient")})}),auth:(0,E._)((0,S._)({},null==r?void 0:r.auth,(null==r||null==(i=r.cookieOptions)?void 0:i.name)?{storageKey:r.cookieOptions.name}:null),{flowType:"pkce",autoRefreshToken:t8(),detectSessionInUrl:t8(),persistSession:!0,storage:o})}));return a&&(k=u),u}e.s(["createBrowserClient",()=>rl],972390),e.i(752683),e.s([],529225)}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.