@supabase/supabase-js 1.26.0 → 1.28.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,15 +1,19 @@
1
1
  # `supabase-js`
2
2
 
3
- An isomorphic Javascript client for Supabase.
3
+ An isomorphic JavaScript client for Supabase.
4
4
 
5
- - Documentation: https://supabase.io/docs/client/supabase-client
5
+ **Documentation:** https://supabase.io/docs/client/supabase-client
6
6
 
7
7
  ## Usage
8
8
 
9
+ First of all, you need to install the library:
10
+
9
11
  ```sh
10
12
  npm install @supabase/supabase-js
11
13
  ```
12
14
 
15
+ Then you're able to import the library and establish the connection with the database:
16
+
13
17
  ```js
14
18
  import { createClient } from '@supabase/supabase-js'
15
19
 
@@ -19,22 +23,40 @@ const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key
19
23
 
20
24
  ### UMD
21
25
 
22
- You can now use plain `<script>`s to import supabase-js from CDNs, like
26
+ You can now use plain `<script>`s to import supabase-js from CDNs, like:
27
+
28
+ ```html
29
+ <script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js"></script>
30
+ ```
31
+ or even:
23
32
 
24
- `<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js"></script>`
25
- or
26
- `<script src="https://unpkg.com/@supabase/supabase-js"></script>`.
33
+ ```html
34
+ <script src="https://unpkg.com/@supabase/supabase-js"></script>
35
+ ```
27
36
 
28
37
  Then you can use it from a global `supabase` variable:
29
38
 
30
39
  ```html
31
40
  <script>
32
- const { createClient } = supabase
33
- supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')
34
- ...
41
+ const { createClient } = supabase
42
+ const _supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')
43
+
44
+ console.log('Supabase Instance: ', _supabase);
45
+ // ...
35
46
  </script>
36
47
  ```
37
48
 
49
+ ### Custom `fetch` implementation
50
+
51
+ `supabase-js` uses the [`cross-fetch`](https://www.npmjs.com/package/cross-fetch) library to make HTTP requests, but an alternative `fetch` implementation can be provided as an option. This is most useful in environments where `cross-fetch` is not compatible, for instance Cloudflare Workers:
52
+
53
+ ```js
54
+ import { createClient } from '@supabase/supabase-js'
55
+
56
+ // Provide a custom `fetch` implementation as an option
57
+ const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key', { fetch: fetch })
58
+ ```
59
+
38
60
  ## Sponsors
39
61
 
40
62
  We are building the features of Firebase using enterprise-grade, open source products. We support existing communities wherever possible, and if the products don’t exist we build them and open source them ourselves. Thanks to these sponsors who are making the OSS ecosystem better for everyone.
@@ -1,4 +1,4 @@
1
- import { SupabaseClientOptions } from './lib/types';
1
+ import { Fetch, SupabaseClientOptions } from './lib/types';
2
2
  import { SupabaseAuthClient } from './lib/SupabaseAuthClient';
3
3
  import { SupabaseQueryBuilder } from './lib/SupabaseQueryBuilder';
4
4
  import { SupabaseStorageClient } from '@supabase/storage-js';
@@ -21,6 +21,10 @@ export default class SupabaseClient {
21
21
  protected authUrl: string;
22
22
  protected storageUrl: string;
23
23
  protected realtime: RealtimeClient;
24
+ protected fetch?: Fetch;
25
+ protected headers: {
26
+ [key: string]: string;
27
+ };
24
28
  /**
25
29
  * Create a new client for use in the browser.
26
30
  * @param supabaseUrl The unique Supabase URL which is supplied when you create a new project in your project dashboard.
@@ -31,6 +35,7 @@ export default class SupabaseClient {
31
35
  * @param options.detectSessionInUrl Set to "true" if you want to automatically detects OAuth grants in the URL and signs in the user.
32
36
  * @param options.headers Any additional headers to send with each network request.
33
37
  * @param options.realtime Options passed along to realtime-js constructor.
38
+ * @param options.fetch A custom fetch implementation.
34
39
  */
35
40
  constructor(supabaseUrl: string, supabaseKey: string, options?: SupabaseClientOptions);
36
41
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"SupabaseClient.d.ts","sourceRoot":"","sources":["../../src/SupabaseClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACnD,OAAO,EAAE,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AyBjC;;OAEG;IACH,IAAI,OAAO,0BAEV;IAED;;;;OAIG;IACH,IAAI,CAAC,CAAC,GAAG,GAAG,EAAE,KAAK,EAAE,MAAM,GAAG,oBAAoB,CAAC,CAAC,CAAC;IAWrD;;;;;;;;OAQG;IACH,GAAG,CAAC,CAAC,GAAG,GAAG,EACT,EAAE,EAAE,MAAM,EACV,MAAM,CAAC,EAAE,MAAM,EACf,EACE,IAAY,EACZ,KAAY,GACb,GAAE;QAAE,IAAI,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,IAAI,GAAG,OAAO,GAAG,SAAS,GAAG,WAAW,CAAA;KAAO;IAM9E;;;;OAIG;IACH,kBAAkB,CAAC,YAAY,EAAE,oBAAoB;YAiBvC,kBAAkB;IAMhC;;OAEG;IACH,gBAAgB,IAAI,oBAAoB,EAAE;IAI1C,OAAO,CAAC,uBAAuB;IAuB/B,OAAO,CAAC,mBAAmB;IAO3B,OAAO,CAAC,oBAAoB;IAQ5B,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,aAAa;CAWtB"}
@@ -39,6 +39,7 @@ class SupabaseClient {
39
39
  * @param options.detectSessionInUrl Set to "true" if you want to automatically detects OAuth grants in the URL and signs in the user.
40
40
  * @param options.headers Any additional headers to send with each network request.
41
41
  * @param options.realtime Options passed along to realtime-js constructor.
42
+ * @param options.fetch A custom fetch implementation.
42
43
  */
43
44
  constructor(supabaseUrl, supabaseKey, options) {
44
45
  this.supabaseUrl = supabaseUrl;
@@ -54,8 +55,10 @@ class SupabaseClient {
54
55
  this.authUrl = `${supabaseUrl}/auth/v1`;
55
56
  this.storageUrl = `${supabaseUrl}/storage/v1`;
56
57
  this.schema = settings.schema;
58
+ this.fetch = settings.fetch;
59
+ this.headers = Object.assign(Object.assign({}, constants_1.DEFAULT_HEADERS), options === null || options === void 0 ? void 0 : options.headers);
57
60
  this.auth = this._initSupabaseAuthClient(settings);
58
- this.realtime = this._initRealtimeClient(settings.realtime);
61
+ this.realtime = this._initRealtimeClient(Object.assign({ headers: this.headers }, settings.realtime));
59
62
  // In the future we might allow the user to pass in a logger to receive these events.
60
63
  // this.realtime.onOpen(() => console.log('OPEN'))
61
64
  // this.realtime.onClose(() => console.log('CLOSED'))
@@ -65,7 +68,7 @@ class SupabaseClient {
65
68
  * Supabase Storage allows you to manage user-generated content, such as photos or videos.
66
69
  */
67
70
  get storage() {
68
- return new storage_js_1.SupabaseStorageClient(this.storageUrl, this._getAuthHeaders());
71
+ return new storage_js_1.SupabaseStorageClient(this.storageUrl, this._getAuthHeaders(), this.fetch);
69
72
  }
70
73
  /**
71
74
  * Perform a table operation.
@@ -79,6 +82,7 @@ class SupabaseClient {
79
82
  schema: this.schema,
80
83
  realtime: this.realtime,
81
84
  table,
85
+ fetch: this.fetch,
82
86
  });
83
87
  }
84
88
  /**
@@ -129,7 +133,7 @@ class SupabaseClient {
129
133
  getSubscriptions() {
130
134
  return this.realtime.channels;
131
135
  }
132
- _initSupabaseAuthClient({ autoRefreshToken, persistSession, detectSessionInUrl, localStorage, headers, }) {
136
+ _initSupabaseAuthClient({ autoRefreshToken, persistSession, detectSessionInUrl, localStorage, headers, fetch, }) {
133
137
  const authHeaders = {
134
138
  Authorization: `Bearer ${this.supabaseKey}`,
135
139
  apikey: `${this.supabaseKey}`,
@@ -141,6 +145,7 @@ class SupabaseClient {
141
145
  persistSession,
142
146
  detectSessionInUrl,
143
147
  localStorage,
148
+ fetch,
144
149
  });
145
150
  }
146
151
  _initRealtimeClient(options) {
@@ -150,11 +155,12 @@ class SupabaseClient {
150
155
  return new postgrest_js_1.PostgrestClient(this.restUrl, {
151
156
  headers: this._getAuthHeaders(),
152
157
  schema: this.schema,
158
+ fetch: this.fetch,
153
159
  });
154
160
  }
155
161
  _getAuthHeaders() {
156
162
  var _a, _b;
157
- const headers = constants_1.DEFAULT_HEADERS;
163
+ const headers = this.headers;
158
164
  const authBearer = (_b = (_a = this.auth.session()) === null || _a === void 0 ? void 0 : _a.access_token) !== null && _b !== void 0 ? _b : this.supabaseKey;
159
165
  headers['apikey'] = this.supabaseKey;
160
166
  headers['Authorization'] = `Bearer ${authBearer}`;
@@ -1 +1 @@
1
- {"version":3,"file":"SupabaseClient.js","sourceRoot":"","sources":["../../src/SupabaseClient.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+CAAiD;AACjD,2CAAkD;AAElD,iEAA6D;AAC7D,qEAAiE;AACjE,qDAA4D;AAC5D,yDAAwD;AACxD,uDAAmG;AAEnG,MAAM,eAAe,GAAG;IACtB,MAAM,EAAE,QAAQ;IAChB,gBAAgB,EAAE,IAAI;IACtB,cAAc,EAAE,IAAI;IACpB,kBAAkB,EAAE,IAAI;IACxB,OAAO,EAAE,2BAAe;CACzB,CAAA;AAED;;;;GAIG;AACH,MAAqB,cAAc;IAajC;;;;;;;;;;OAUG;IACH,YACY,WAAmB,EACnB,WAAmB,EAC7B,OAA+B;QAFrB,gBAAW,GAAX,WAAW,CAAQ;QACnB,gBAAW,GAAX,WAAW,CAAQ;QAG7B,IAAI,CAAC,WAAW;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QAC7D,IAAI,CAAC,WAAW;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QAE7D,WAAW,GAAG,4BAAkB,CAAC,WAAW,CAAC,CAAA;QAE7C,MAAM,QAAQ,mCAAQ,eAAe,GAAK,OAAO,CAAE,CAAA;QACnD,IAAI,CAAC,OAAO,GAAG,GAAG,WAAW,UAAU,CAAA;QACvC,IAAI,CAAC,WAAW,GAAG,GAAG,WAAW,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QACrE,IAAI,CAAC,OAAO,GAAG,GAAG,WAAW,UAAU,CAAA;QACvC,IAAI,CAAC,UAAU,GAAG,GAAG,WAAW,aAAa,CAAA;QAC7C,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAA;QAE7B,IAAI,CAAC,IAA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,CAAC,IAAI,CAAC,OAAO,EAAE;YACvC,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE;YAC/B,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC,CAAA;IACJ,CAAC;IAEO,eAAe;;QACrB,MAAM,OAAO,GAA8B,IAAI,CAAC,OAAO,CAAA;QACvD,MAAM,UAAU,eAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,0CAAE,YAAY,mCAAI,IAAI,CAAC,WAAW,CAAA;QACxE,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,WAAW,CAAA;QACpC,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,UAAU,EAAE,CAAA;QACjD,OAAO,OAAO,CAAA;IAChB,CAAC;IAEO,aAAa,CAAC,YAAkC;QACtD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,YAAY;iBACT,WAAW,EAAE;iBACb,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE;gBAClB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,CAAA;gBAClC,OAAO,OAAO,CAAC,IAAI,CAAC,CAAA;YACtB,CAAC,CAAC;iBACD,OAAO,CAAC,OAAO,EAAE,CAAC,CAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;QAC9C,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAjMD,iCAiMC"}
@@ -1,17 +1,18 @@
1
1
  import { PostgrestQueryBuilder } from '@supabase/postgrest-js';
2
2
  import { SupabaseRealtimeClient } from './SupabaseRealtimeClient';
3
3
  import { RealtimeClient } from '@supabase/realtime-js';
4
- import { SupabaseEventTypes, SupabaseRealtimePayload } from './types';
4
+ import { Fetch, SupabaseEventTypes, SupabaseRealtimePayload } from './types';
5
5
  export declare class SupabaseQueryBuilder<T> extends PostgrestQueryBuilder<T> {
6
6
  private _subscription;
7
7
  private _realtime;
8
- constructor(url: string, { headers, schema, realtime, table, }: {
8
+ constructor(url: string, { headers, schema, realtime, table, fetch, }: {
9
9
  headers?: {
10
10
  [key: string]: string;
11
11
  };
12
12
  schema: string;
13
13
  realtime: RealtimeClient;
14
14
  table: string;
15
+ fetch?: Fetch;
15
16
  });
16
17
  /**
17
18
  * Subscribe to realtime changes in your databse.
@@ -1 +1 @@
1
- {"version":3,"file":"SupabaseQueryBuilder.d.ts","sourceRoot":"","sources":["../../../src/lib/SupabaseQueryBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAErE,qBAAa,oBAAoB,CAAC,CAAC,CAAE,SAAQ,qBAAqB,CAAC,CAAC,CAAC;IACnE,OAAO,CAAC,aAAa,CAAwB;IAC7C,OAAO,CAAC,SAAS,CAAgB;gBAG/B,GAAG,EAAE,MAAM,EACX,EACE,OAAY,EACZ,MAAM,EACN,QAAQ,EACR,KAAK,GACN,EAAE;QACD,OAAO,CAAC,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAA;QACnC,MAAM,EAAE,MAAM,CAAA;QACd,QAAQ,EAAE,cAAc,CAAA;QACxB,KAAK,EAAE,MAAM,CAAA;KACd;IAQH;;;;OAIG;IACH,EAAE,CACA,KAAK,EAAE,kBAAkB,EACzB,QAAQ,EAAE,CAAC,OAAO,EAAE,uBAAuB,CAAC,CAAC,CAAC,KAAK,IAAI,GACtD,sBAAsB;CAM1B"}
1
+ {"version":3,"file":"SupabaseQueryBuilder.d.ts","sourceRoot":"","sources":["../../../src/lib/SupabaseQueryBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAE5E,qBAAa,oBAAoB,CAAC,CAAC,CAAE,SAAQ,qBAAqB,CAAC,CAAC,CAAC;IACnE,OAAO,CAAC,aAAa,CAAwB;IAC7C,OAAO,CAAC,SAAS,CAAgB;gBAG/B,GAAG,EAAE,MAAM,EACX,EACE,OAAY,EACZ,MAAM,EACN,QAAQ,EACR,KAAK,EACL,KAAK,GACN,EAAE;QACD,OAAO,CAAC,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAA;QACnC,MAAM,EAAE,MAAM,CAAA;QACd,QAAQ,EAAE,cAAc,CAAA;QACxB,KAAK,EAAE,MAAM,CAAA;QACb,KAAK,CAAC,EAAE,KAAK,CAAA;KACd;IAQH;;;;OAIG;IACH,EAAE,CACA,KAAK,EAAE,kBAAkB,EACzB,QAAQ,EAAE,CAAC,OAAO,EAAE,uBAAuB,CAAC,CAAC,CAAC,KAAK,IAAI,GACtD,sBAAsB;CAM1B"}
@@ -4,8 +4,8 @@ exports.SupabaseQueryBuilder = void 0;
4
4
  const postgrest_js_1 = require("@supabase/postgrest-js");
5
5
  const SupabaseRealtimeClient_1 = require("./SupabaseRealtimeClient");
6
6
  class SupabaseQueryBuilder extends postgrest_js_1.PostgrestQueryBuilder {
7
- constructor(url, { headers = {}, schema, realtime, table, }) {
8
- super(url, { headers, schema });
7
+ constructor(url, { headers = {}, schema, realtime, table, fetch, }) {
8
+ super(url, { headers, schema, fetch });
9
9
  this._subscription = new SupabaseRealtimeClient_1.SupabaseRealtimeClient(realtime, headers, schema, table);
10
10
  this._realtime = realtime;
11
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SupabaseQueryBuilder.js","sourceRoot":"","sources":["../../../src/lib/SupabaseQueryBuilder.ts"],"names":[],"mappings":";;;AAAA,yDAA8D;AAC9D,qEAAiE;AAIjE,MAAa,oBAAwB,SAAQ,oCAAwB;IAInE,YACE,GAAW,EACX,EACE,OAAO,GAAG,EAAE,EACZ,MAAM,EACN,QAAQ,EACR,KAAK,GAMN;QAED,KAAK,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAA;QAE/B,IAAI,CAAC,aAAa,GAAG,IAAI,+CAAsB,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;QACjF,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAA;IAC3B,CAAC;IAED;;;;OAIG;IACH,EAAE,CACA,KAAyB,EACzB,QAAuD;QAEvD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,EAAE;YACjC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAA;SACzB;QACD,OAAO,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;IAC/C,CAAC;CACF;AAtCD,oDAsCC"}
1
+ {"version":3,"file":"SupabaseQueryBuilder.js","sourceRoot":"","sources":["../../../src/lib/SupabaseQueryBuilder.ts"],"names":[],"mappings":";;;AAAA,yDAA8D;AAC9D,qEAAiE;AAIjE,MAAa,oBAAwB,SAAQ,oCAAwB;IAInE,YACE,GAAW,EACX,EACE,OAAO,GAAG,EAAE,EACZ,MAAM,EACN,QAAQ,EACR,KAAK,EACL,KAAK,GAON;QAED,KAAK,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAA;QAEtC,IAAI,CAAC,aAAa,GAAG,IAAI,+CAAsB,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;QACjF,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAA;IAC3B,CAAC;IAED;;;;OAIG;IACH,EAAE,CACA,KAAyB,EACzB,QAAuD;QAEvD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,EAAE;YACjC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAA;SACzB;QACD,OAAO,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;IAC/C,CAAC;CACF;AAxCD,oDAwCC"}
@@ -1,5 +1,6 @@
1
1
  import { GoTrueClient } from '@supabase/gotrue-js';
2
2
  import { RealtimeClientOptions } from '@supabase/realtime-js';
3
+ export declare type Fetch = typeof fetch;
3
4
  declare type GoTrueClientOptions = ConstructorParameters<typeof GoTrueClient>[0];
4
5
  export interface SupabaseAuthClientOptions extends GoTrueClientOptions {
5
6
  }
@@ -34,6 +35,10 @@ export declare type SupabaseClientOptions = {
34
35
  * Options passed to the realtime-js instance
35
36
  */
36
37
  realtime?: RealtimeClientOptions;
38
+ /**
39
+ * A custom `fetch` implementation.
40
+ */
41
+ fetch?: Fetch;
37
42
  };
38
43
  export declare type SupabaseRealtimePayload<T> = {
39
44
  commit_timestamp: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAE7D,aAAK,mBAAmB,GAAG,qBAAqB,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,CAAA;AAExE,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB;CAAG;AAEzE,oBAAY,qBAAqB,GAAG;IAClC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAA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OAAO,CAAA;IAC1B;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B;;OAEG;IACH,YAAY,CAAC,EAAE,yBAAyB,CAAC,cAAc,CAAC,CAAA;IAExD;;OAEG;IACH,QAAQ,CAAC,EAAE,qBAAqB,CAAA;IAEhC;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAA;AAED,oBAAY,uBAAuB,CAAC,CAAC,IAAI;IACvC,gBAAgB,EAAE,MAAM,CAAA;IACxB,SAAS,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAA;IACzC,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,gEAAgE;IAChE,GAAG,EAAE,CAAC,CAAA;IACN,qEAAqE;IACrE,GAAG,EAAE,CAAC,CAAA;CACP,CAAA;AAED,oBAAY,kBAAkB,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,GAAG,CAAA"}
@@ -1,2 +1,2 @@
1
- export declare const version = "1.26.0";
1
+ export declare const version = "1.28.2";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
4
  // generated by genversion
5
- exports.version = '1.26.0';
5
+ exports.version = '1.28.2';
6
6
  //# sourceMappingURL=version.js.map
@@ -1,4 +1,4 @@
1
- import { SupabaseClientOptions } from './lib/types';
1
+ import { Fetch, SupabaseClientOptions } from './lib/types';
2
2
  import { SupabaseAuthClient } from './lib/SupabaseAuthClient';
3
3
  import { SupabaseQueryBuilder } from './lib/SupabaseQueryBuilder';
4
4
  import { SupabaseStorageClient } from '@supabase/storage-js';
@@ -21,6 +21,10 @@ export default class SupabaseClient {
21
21
  protected authUrl: string;
22
22
  protected storageUrl: string;
23
23
  protected realtime: RealtimeClient;
24
+ protected fetch?: Fetch;
25
+ protected headers: {
26
+ [key: string]: string;
27
+ };
24
28
  /**
25
29
  * Create a new client for use in the browser.
26
30
  * @param supabaseUrl The unique Supabase URL which is supplied when you create a new project in your project dashboard.
@@ -31,6 +35,7 @@ export default class SupabaseClient {
31
35
  * @param options.detectSessionInUrl Set to "true" if you want to automatically detects OAuth grants in the URL and signs in the user.
32
36
  * @param options.headers Any additional headers to send with each network request.
33
37
  * @param options.realtime Options passed along to realtime-js constructor.
38
+ * @param options.fetch A custom fetch implementation.
34
39
  */
35
40
  constructor(supabaseUrl: string, supabaseKey: string, options?: SupabaseClientOptions);
36
41
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"SupabaseClient.d.ts","sourceRoot":"","sources":["../../src/SupabaseClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAE5D,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAyB,MAAM,uBAAuB,CAAA;AAUnG;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,cAAc;IAyB/B,SAAS,CAAC,WAAW,EAAE,MAAM;IAC7B,SAAS,CAAC,WAAW,EAAE,MAAM;IAzB/B;;OAEG;IACH,IAAI,EAAE,kBAAkB,CAAA;IAExB,SAAS,CAAC,MAAM,EAAE,MAAM,CAAA;IACxB,SAAS,CAAC,OAAO,EAAE,MAAM,CAAA;IACzB,SAAS,CAAC,WAAW,EAAE,MAAM,CAAA;IAC7B,SAAS,CAAC,OAAO,EAAE,MAAM,CAAA;IACzB,SAAS,CAAC,UAAU,EAAE,MAAM,CAAA;IAC5B,SAAS,CAAC,QAAQ,EAAE,cAAc,CAAA;IAElC;;;;;;;;;;OAUG;gBAES,WAAW,EAAE,MAAM,EAC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@ export default class SupabaseClient {
37
37
  * @param options.detectSessionInUrl Set to "true" if you want to automatically detects OAuth grants in the URL and signs in the user.
38
38
  * @param options.headers Any additional headers to send with each network request.
39
39
  * @param options.realtime Options passed along to realtime-js constructor.
40
+ * @param options.fetch A custom fetch implementation.
40
41
  */
41
42
  constructor(supabaseUrl, supabaseKey, options) {
42
43
  this.supabaseUrl = supabaseUrl;
@@ -52,8 +53,10 @@ export default class SupabaseClient {
52
53
  this.authUrl = `${supabaseUrl}/auth/v1`;
53
54
  this.storageUrl = `${supabaseUrl}/storage/v1`;
54
55
  this.schema = settings.schema;
56
+ this.fetch = settings.fetch;
57
+ this.headers = Object.assign(Object.assign({}, DEFAULT_HEADERS), options === null || options === void 0 ? void 0 : options.headers);
55
58
  this.auth = this._initSupabaseAuthClient(settings);
56
- this.realtime = this._initRealtimeClient(settings.realtime);
59
+ this.realtime = this._initRealtimeClient(Object.assign({ headers: this.headers }, settings.realtime));
57
60
  // In the future we might allow the user to pass in a logger to receive these events.
58
61
  // this.realtime.onOpen(() => console.log('OPEN'))
59
62
  // this.realtime.onClose(() => console.log('CLOSED'))
@@ -63,7 +66,7 @@ export default class SupabaseClient {
63
66
  * Supabase Storage allows you to manage user-generated content, such as photos or videos.
64
67
  */
65
68
  get storage() {
66
- return new SupabaseStorageClient(this.storageUrl, this._getAuthHeaders());
69
+ return new SupabaseStorageClient(this.storageUrl, this._getAuthHeaders(), this.fetch);
67
70
  }
68
71
  /**
69
72
  * Perform a table operation.
@@ -77,6 +80,7 @@ export default class SupabaseClient {
77
80
  schema: this.schema,
78
81
  realtime: this.realtime,
79
82
  table,
83
+ fetch: this.fetch,
80
84
  });
81
85
  }
82
86
  /**
@@ -127,7 +131,7 @@ export default class SupabaseClient {
127
131
  getSubscriptions() {
128
132
  return this.realtime.channels;
129
133
  }
130
- _initSupabaseAuthClient({ autoRefreshToken, persistSession, detectSessionInUrl, localStorage, headers, }) {
134
+ _initSupabaseAuthClient({ autoRefreshToken, persistSession, detectSessionInUrl, localStorage, headers, fetch, }) {
131
135
  const authHeaders = {
132
136
  Authorization: `Bearer ${this.supabaseKey}`,
133
137
  apikey: `${this.supabaseKey}`,
@@ -139,6 +143,7 @@ export default class SupabaseClient {
139
143
  persistSession,
140
144
  detectSessionInUrl,
141
145
  localStorage,
146
+ fetch,
142
147
  });
143
148
  }
144
149
  _initRealtimeClient(options) {
@@ -148,11 +153,12 @@ export default class SupabaseClient {
148
153
  return new PostgrestClient(this.restUrl, {
149
154
  headers: this._getAuthHeaders(),
150
155
  schema: this.schema,
156
+ fetch: this.fetch,
151
157
  });
152
158
  }
153
159
  _getAuthHeaders() {
154
160
  var _a, _b;
155
- const headers = DEFAULT_HEADERS;
161
+ const headers = this.headers;
156
162
  const authBearer = (_b = (_a = this.auth.session()) === null || _a === void 0 ? void 0 : _a.access_token) !== null && _b !== void 0 ? _b : this.supabaseKey;
157
163
  headers['apikey'] = this.supabaseKey;
158
164
  headers['Authorization'] = `Bearer ${authBearer}`;
@@ -1 +1 @@
1
- {"version":3,"file":"SupabaseClient.js","sourceRoot":"","sources":["../../src/SupabaseClient.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAElD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,cAAc,EAA+C,MAAM,uBAAuB,CAAA;AAEnG,MAAM,eAAe,GAAG;IACtB,MAAM,EAAE,QAAQ;IAChB,gBAAgB,EAAE,IAAI;IACtB,cAAc,EAAE,IAAI;IACpB,kBAAkB,EAAE,IAAI;IACxB,OAAO,EAAE,eAAe;C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e;;QACrB,MAAM,OAAO,GAA8B,IAAI,CAAC,OAAO,CAAA;QACvD,MAAM,UAAU,eAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,0CAAE,YAAY,mCAAI,IAAI,CAAC,WAAW,CAAA;QACxE,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,WAAW,CAAA;QACpC,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,UAAU,EAAE,CAAA;QACjD,OAAO,OAAO,CAAA;IAChB,CAAC;IAEO,aAAa,CAAC,YAAkC;QACtD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,YAAY;iBACT,WAAW,EAAE;iBACb,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE;gBAClB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,CAAA;gBAClC,OAAO,OAAO,CAAC,IAAI,CAAC,CAAA;YACtB,CAAC,CAAC;iBACD,OAAO,CAAC,OAAO,EAAE,CAAC,CAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;QAC9C,CAAC,CAAC,CAAA;IACJ,CAAC;CACF"}
@@ -1,17 +1,18 @@
1
1
  import { PostgrestQueryBuilder } from '@supabase/postgrest-js';
2
2
  import { SupabaseRealtimeClient } from './SupabaseRealtimeClient';
3
3
  import { RealtimeClient } from '@supabase/realtime-js';
4
- import { SupabaseEventTypes, SupabaseRealtimePayload } from './types';
4
+ import { Fetch, SupabaseEventTypes, SupabaseRealtimePayload } from './types';
5
5
  export declare class SupabaseQueryBuilder<T> extends PostgrestQueryBuilder<T> {
6
6
  private _subscription;
7
7
  private _realtime;
8
- constructor(url: string, { headers, schema, realtime, table, }: {
8
+ constructor(url: string, { headers, schema, realtime, table, fetch, }: {
9
9
  headers?: {
10
10
  [key: string]: string;
11
11
  };
12
12
  schema: string;
13
13
  realtime: RealtimeClient;
14
14
  table: string;
15
+ fetch?: Fetch;
15
16
  });
16
17
  /**
17
18
  * Subscribe to realtime changes in your databse.
@@ -1 +1 @@
1
- {"version":3,"file":"SupabaseQueryBuilder.d.ts","sourceRoot":"","sources":["../../../src/lib/SupabaseQueryBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAErE,qBAAa,oBAAoB,CAAC,CAAC,CAAE,SAAQ,qBAAqB,CAAC,CAAC,CAAC;IACnE,OAAO,CAAC,aAAa,CAAwB;IAC7C,OAAO,CAAC,SAAS,CAAgB;gBAG/B,GAAG,EAAE,MAAM,EACX,EACE,OAAY,EACZ,MAAM,EACN,QAAQ,EACR,KAAK,GACN,EAAE;QACD,OAAO,CAAC,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAA;QACnC,MAAM,EAAE,MAAM,CAAA;QACd,QAAQ,EAAE,cAAc,CAAA;QACxB,KAAK,EAAE,MAAM,CAAA;KACd;IAQH;;;;OAIG;IACH,EAAE,CACA,KAAK,EAAE,kBAAkB,EACzB,QAAQ,EAAE,CAAC,OAAO,EAAE,uBAAuB,CAAC,CAAC,CAAC,KAAK,IAAI,GACtD,sBAAsB;CAM1B"}
1
+ {"version":3,"file":"SupabaseQueryBuilder.d.ts","sourceRoot":"","sources":["../../../src/lib/SupabaseQueryBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAE5E,qBAAa,oBAAoB,CAAC,CAAC,CAAE,SAAQ,qBAAqB,CAAC,CAAC,CAAC;IACnE,OAAO,CAAC,aAAa,CAAwB;IAC7C,OAAO,CAAC,SAAS,CAAgB;gBAG/B,GAAG,EAAE,MAAM,EACX,EACE,OAAY,EACZ,MAAM,EACN,QAAQ,EACR,KAAK,EACL,KAAK,GACN,EAAE;QACD,OAAO,CAAC,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAA;QACnC,MAAM,EAAE,MAAM,CAAA;QACd,QAAQ,EAAE,cAAc,CAAA;QACxB,KAAK,EAAE,MAAM,CAAA;QACb,KAAK,CAAC,EAAE,KAAK,CAAA;KACd;IAQH;;;;OAIG;IACH,EAAE,CACA,KAAK,EAAE,kBAAkB,EACzB,QAAQ,EAAE,CAAC,OAAO,EAAE,uBAAuB,CAAC,CAAC,CAAC,KAAK,IAAI,GACtD,sBAAsB;CAM1B"}
@@ -1,8 +1,8 @@
1
1
  import { PostgrestQueryBuilder } from '@supabase/postgrest-js';
2
2
  import { SupabaseRealtimeClient } from './SupabaseRealtimeClient';
3
3
  export class SupabaseQueryBuilder extends PostgrestQueryBuilder {
4
- constructor(url, { headers = {}, schema, realtime, table, }) {
5
- super(url, { headers, schema });
4
+ constructor(url, { headers = {}, schema, realtime, table, fetch, }) {
5
+ super(url, { headers, schema, fetch });
6
6
  this._subscription = new SupabaseRealtimeClient(realtime, headers, schema, table);
7
7
  this._realtime = realtime;
8
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SupabaseQueryBuilder.js","sourceRoot":"","sources":["../../../src/lib/SupabaseQueryBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AAIjE,MAAM,OAAO,oBAAwB,SAAQ,qBAAwB;IA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CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,EAAE;YACjC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAA;SACzB;QACD,OAAO,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;IAC/C,CAAC;CACF"}
@@ -1,5 +1,6 @@
1
1
  import { GoTrueClient } from '@supabase/gotrue-js';
2
2
  import { RealtimeClientOptions } from '@supabase/realtime-js';
3
+ export declare type Fetch = typeof fetch;
3
4
  declare type GoTrueClientOptions = ConstructorParameters<typeof GoTrueClient>[0];
4
5
  export interface SupabaseAuthClientOptions extends GoTrueClientOptions {
5
6
  }
@@ -34,6 +35,10 @@ export declare type SupabaseClientOptions = {
34
35
  * Options passed to the realtime-js instance
35
36
  */
36
37
  realtime?: RealtimeClientOptions;
38
+ /**
39
+ * A custom `fetch` implementation.
40
+ */
41
+ fetch?: Fetch;
37
42
  };
38
43
  export declare type SupabaseRealtimePayload<T> = {
39
44
  commit_timestamp: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAE7D,aAAK,mBAAmB,GAAG,qBAAqB,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,CAAA;AAExE,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB;CAAG;AAEzE,oBAAY,qBAAqB,GAAG;IAClC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IACnC;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACx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G;IACH,YAAY,CAAC,EAAE,yBAAyB,CAAC,cAAc,CAAC,CAAA;IAExD;;OAEG;IACH,QAAQ,CAAC,EAAE,qBAAqB,CAAA;IAEhC;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAA;AAED,oBAAY,uBAAuB,CAAC,CAAC,IAAI;IACvC,gBAAgB,EAAE,MAAM,CAAA;IACxB,SAAS,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAA;IACzC,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,gEAAgE;IAChE,GAAG,EAAE,CAAC,CAAA;IACN,qEAAqE;IACrE,GAAG,EAAE,CAAC,CAAA;CACP,CAAA;AAED,oBAAY,kBAAkB,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,GAAG,CAAA"}
@@ -1,2 +1,2 @@
1
- export declare const version = "1.26.0";
1
+ export declare const version = "1.28.2";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,3 +1,3 @@
1
1
  // generated by genversion
2
- export const version = '1.26.0';
2
+ export const version = '1.28.2';
3
3
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.supabase=t():e.supabase=t()}(self,(function(){return(()=>{var e={271:(e,t,r)=>{"use strict";r.r(t),r.d(t,{GoTrueApi:()=>v,GoTrueClient:()=>_});var s=r(98),n=r.n(s),i=function(e,t,r,s){return new(r||(r=Promise))((function(n,i){function o(e){try{h(s.next(e))}catch(e){i(e)}}function a(e){try{h(s.throw(e))}catch(e){i(e)}}function h(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}h((s=s.apply(e,t||[])).next())}))};const o=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e);function a(e=n(),t,r,s,a){return i(this,void 0,void 0,(function*(){return new Promise(((n,i)=>{e(r,((e,t,r)=>{const s={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"===e||(s.headers=Object.assign({"Content-Type":"text/plain;charset=UTF-8"},null==t?void 0:t.headers),s.body=JSON.stringify(r)),s})(t,s,a)).then((e=>{if(!e.ok)throw e;return(null==s?void 0:s.noResolveJson)?n:e.json()})).then((e=>n(e))).catch((e=>((e,t)=>{if("function"!=typeof e.json)return t(e);e.json().then((r=>t({message:o(r),status:(null==e?void 0:e.status)||500})))})(e,i)))}))}))}function h(e,t,r,s){return i(this,void 0,void 0,(function*(){return a(e,"POST",t,s,r)}))}const c="supabase.auth.token",u={name:"sb:token",lifetime:28800,domain:"",path:"/",sameSite:"lax"};function l(e,t,r){const s=r.map((t=>{return r=t,s=function(e){if(!e||!e.headers||!e.headers.host)throw new Error('The "host" request header is not available');const t=e.headers.host.indexOf(":")>-1&&e.headers.host.split(":")[0]||e.headers.host;return!(["localhost","127.0.0.1"].indexOf(t)>-1||t.endsWith(".local"))}(e),function(e,t,r){const s=r||{},n=encodeURIComponent,i=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;if("function"!=typeof n)throw new TypeError("option encode is invalid");if(!i.test(e))throw new TypeError("argument name is invalid");const o=n(t);if(o&&!i.test(o))throw new TypeError("argument val is invalid");let a=e+"="+o;if(null!=s.maxAge){const e=s.maxAge-0;if(isNaN(e)||!isFinite(e))throw new TypeError("option maxAge is invalid");a+="; Max-Age="+Math.floor(e)}if(s.domain){if(!i.test(s.domain))throw new TypeError("option domain is invalid");a+="; Domain="+s.domain}if(s.path){if(!i.test(s.path))throw new TypeError("option path is invalid");a+="; Path="+s.path}if(s.expires){if("function"!=typeof s.expires.toUTCString)throw new TypeError("option expires is invalid");a+="; Expires="+s.expires.toUTCString()}if(s.httpOnly&&(a+="; HttpOnly"),s.secure&&(a+="; Secure"),s.sameSite)switch("string"==typeof s.sameSite?s.sameSite.toLowerCase():s.sameSite){case"lax":a+="; SameSite=Lax";break;case"strict":a+="; SameSite=Strict";break;case"none":a+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return a}(r.name,r.value,{maxAge:r.maxAge,expires:new Date(Date.now()+1e3*r.maxAge),httpOnly:!0,secure:s,path:null!==(n=r.path)&&void 0!==n?n:"/",domain:null!==(i=r.domain)&&void 0!==i?i:"",sameSite:null!==(o=r.sameSite)&&void 0!==o?o:"lax"});var r,s,n,i,o})),n=t.getHeader("Set-Cookie");n&&(n instanceof Array?Array.prototype.push.apply(s,n):"string"==typeof n&&s.push(n)),t.setHeader("Set-Cookie",s)}function d(e,t,r){l(e,t,[r])}function p(e){return Math.round(Date.now()/1e3)+e}const f=()=>"undefined"!=typeof window;function m(e,t){t||(t=window.location.href),e=e.replace(/[\[\]]/g,"\\$&");const r=new RegExp("[?&#]"+e+"(=([^&#]*)|&|#|$)").exec(t);return r?r[2]?decodeURIComponent(r[2].replace(/\+/g," ")):"":null}var y=function(e,t,r,s){return new(r||(r=Promise))((function(n,i){function o(e){try{h(s.next(e))}catch(e){i(e)}}function a(e){try{h(s.throw(e))}catch(e){i(e)}}function h(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}h((s=s.apply(e,t||[])).next())}))};class v{constructor({url:e="",headers:t={},cookieOptions:r,fetch:s}){this.url=e,this.headers=t,this.cookieOptions=Object.assign(Object.assign({},u),r),this.fetch=s}signUpWithEmail(e,t,r={}){return y(this,void 0,void 0,(function*(){try{const s=Object.assign({},this.headers);let n="";r.redirectTo&&(n="?redirect_to="+encodeURIComponent(r.redirectTo));const i=yield h(this.fetch,`${this.url}/signup${n}`,{email:e,password:t,data:r.data},{headers:s}),o=Object.assign({},i);return o.expires_in&&(o.expires_at=p(i.expires_in)),{data:o,error:null}}catch(e){return{data:null,error:e}}}))}signInWithEmail(e,t,r={}){return y(this,void 0,void 0,(function*(){try{const s=Object.assign({},this.headers);let n="?grant_type=password";r.redirectTo&&(n+="&redirect_to="+encodeURIComponent(r.redirectTo));const i=yield h(this.fetch,`${this.url}/token${n}`,{email:e,password:t},{headers:s}),o=Object.assign({},i);return o.expires_in&&(o.expires_at=p(i.expires_in)),{data:o,error:null}}catch(e){return{data:null,error:e}}}))}signUpWithPhone(e,t,r={}){return y(this,void 0,void 0,(function*(){try{const s=Object.assign({},this.headers),n=yield h(this.fetch,this.url+"/signup",{phone:e,password:t,data:r.data},{headers:s}),i=Object.assign({},n);return i.expires_in&&(i.expires_at=p(n.expires_in)),{data:i,error:null}}catch(e){return{data:null,error:e}}}))}signInWithPhone(e,t){return y(this,void 0,void 0,(function*(){try{const r=Object.assign({},this.headers),s="?grant_type=password",n=yield h(this.fetch,`${this.url}/token${s}`,{phone:e,password:t},{headers:r}),i=Object.assign({},n);return i.expires_in&&(i.expires_at=p(n.expires_in)),{data:i,error:null}}catch(e){return{data:null,error:e}}}))}sendMagicLinkEmail(e,t={}){return y(this,void 0,void 0,(function*(){try{const r=Object.assign({},this.headers);let s="";return t.redirectTo&&(s+="?redirect_to="+encodeURIComponent(t.redirectTo)),{data:yield h(this.fetch,`${this.url}/magiclink${s}`,{email:e},{headers:r}),error:null}}catch(e){return{data:null,error:e}}}))}sendMobileOTP(e){return y(this,void 0,void 0,(function*(){try{const t=Object.assign({},this.headers);return{data:yield h(this.fetch,this.url+"/otp",{phone:e},{headers:t}),error:null}}catch(e){return{data:null,error:e}}}))}verifyMobileOTP(e,t,r={}){return y(this,void 0,void 0,(function*(){try{const s=Object.assign({},this.headers);return{data:yield h(this.fetch,this.url+"/verify",{phone:e,token:t,type:"sms",redirect_to:r.redirectTo},{headers:s}),error:null}}catch(e){return{data:null,error:e}}}))}inviteUserByEmail(e,t={}){return y(this,void 0,void 0,(function*(){try{const r=Object.assign({},this.headers);let s="";return t.redirectTo&&(s+="?redirect_to="+encodeURIComponent(t.redirectTo)),{data:yield h(this.fetch,`${this.url}/invite${s}`,{email:e,data:t.data},{headers:r}),error:null}}catch(e){return{data:null,error:e}}}))}resetPasswordForEmail(e,t={}){return y(this,void 0,void 0,(function*(){try{const r=Object.assign({},this.headers);let s="";return t.redirectTo&&(s+="?redirect_to="+encodeURIComponent(t.redirectTo)),{data:yield h(this.fetch,`${this.url}/recover${s}`,{email:e},{headers:r}),error:null}}catch(e){return{data:null,error:e}}}))}_createRequestHeaders(e){const t=Object.assign({},this.headers);return t.Authorization="Bearer "+e,t}signOut(e){return y(this,void 0,void 0,(function*(){try{return yield h(this.fetch,this.url+"/logout",{},{headers:this._createRequestHeaders(e),noResolveJson:!0}),{error:null}}catch(e){return{error:e}}}))}getUrlForProvider(e,t){const r=["provider="+encodeURIComponent(e)];return(null==t?void 0:t.redirectTo)&&r.push("redirect_to="+encodeURIComponent(t.redirectTo)),(null==t?void 0:t.scopes)&&r.push("scopes="+encodeURIComponent(t.scopes)),`${this.url}/authorize?${r.join("&")}`}getUser(e){return y(this,void 0,void 0,(function*(){try{const t=yield function(e,t,r){return i(this,void 0,void 0,(function*(){return a(e,"GET",t,r)}))}(this.fetch,this.url+"/user",{headers:this._createRequestHeaders(e)});return{user:t,data:t,error:null}}catch(e){return{user:null,data:null,error:e}}}))}updateUser(e,t){return y(this,void 0,void 0,(function*(){try{const r=yield function(e,t,r,s){return i(this,void 0,void 0,(function*(){return a(e,"PUT",t,s,r)}))}(this.fetch,this.url+"/user",t,{headers:this._createRequestHeaders(e)});return{user:r,data:r,error:null}}catch(e){return{user:null,data:null,error:e}}}))}deleteUser(e,t){return y(this,void 0,void 0,(function*(){try{const r=yield function(e,t,r,s){return i(this,void 0,void 0,(function*(){return a(e,"DELETE",t,s,r)}))}(this.fetch,`${this.url}/admin/users/${e}`,{},{headers:this._createRequestHeaders(t)});return{user:r,data:r,error:null}}catch(e){return{user:null,data:null,error:e}}}))}refreshAccessToken(e){return y(this,void 0,void 0,(function*(){try{const t=yield h(this.fetch,this.url+"/token?grant_type=refresh_token",{refresh_token:e},{headers:this.headers}),r=Object.assign({},t);return r.expires_in&&(r.expires_at=p(t.expires_in)),{data:r,error:null}}catch(e){return{data:null,error:e}}}))}setAuthCookie(e,t){"POST"!==e.method&&(t.setHeader("Allow","POST"),t.status(405).end("Method Not Allowed"));const{event:r,session:s}=e.body;if(!r)throw new Error("Auth event missing!");if("SIGNED_IN"===r){if(!s)throw new Error("Auth session missing!");d(e,t,{name:this.cookieOptions.name,value:s.access_token,domain:this.cookieOptions.domain,maxAge:this.cookieOptions.lifetime,path:this.cookieOptions.path,sameSite:this.cookieOptions.sameSite})}"SIGNED_OUT"===r&&function(e,t,r){d(e,t,{name:r,value:"",maxAge:-1})}(e,t,this.cookieOptions.name),t.status(200).json({})}getUserByCookie(e){return y(this,void 0,void 0,(function*(){try{if(!e.cookies)throw new Error("Not able to parse cookies! When using Express make sure the cookie-parser middleware is in use!");if(!e.cookies[this.cookieOptions.name])throw new Error("No cookie found!");const t=e.cookies[this.cookieOptions.name],{user:r,error:s}=yield this.getUser(t);if(s)throw s;return{user:r,data:r,error:null}}catch(e){return{user:null,data:null,error:e}}}))}generateLink(e,t,r={}){return y(this,void 0,void 0,(function*(){try{return{data:yield h(this.fetch,this.url+"/admin/generate_link",{type:e,email:t,password:r.password,data:r.data,redirect_to:r.redirectTo},{headers:this.headers}),error:null}}catch(e){return{data:null,error:e}}}))}}var g=function(e,t,r,s){return new(r||(r=Promise))((function(n,i){function o(e){try{h(s.next(e))}catch(e){i(e)}}function a(e){try{h(s.throw(e))}catch(e){i(e)}}function h(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}h((s=s.apply(e,t||[])).next())}))};!function(){if("object"!=typeof globalThis)try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch(e){"undefined"!=typeof self&&(self.globalThis=self)}}();const b={url:"http://localhost:9999",autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:{"X-Client-Info":"gotrue-js/1.20.0"}};class _{constructor(e){this.stateChangeEmitters=new Map;const t=Object.assign(Object.assign({},b),e);this.currentUser=null,this.currentSession=null,this.autoRefreshToken=t.autoRefreshToken,this.persistSession=t.persistSession,this.localStorage=t.localStorage||globalThis.localStorage,this.api=new v({url:t.url,headers:t.headers,cookieOptions:t.cookieOptions,fetch:t.fetch}),this._recoverSession(),this._recoverAndRefresh(),t.detectSessionInUrl&&f()&&m("access_token")&&this.getSessionFromUrl({storeSession:!0}).then((({error:e})=>{e&&console.error("Error getting session from URL.",e)}))}signUp({email:e,password:t,phone:r},s={}){return g(this,void 0,void 0,(function*(){try{this._removeSession();const{data:n,error:i}=r&&t?yield this.api.signUpWithPhone(r,t,{data:s.data}):yield this.api.signUpWithEmail(e,t,{redirectTo:s.redirectTo,data:s.data});if(i)throw i;if(!n)throw"An error occurred on sign up.";let o=null,a=null;return n.access_token&&(o=n,a=o.user,this._saveSession(o),this._notifyAllSubscribers("SIGNED_IN")),n.id&&(a=n),{data:n,user:a,session:o,error:null}}catch(e){return{data:null,user:null,session:null,error:e}}}))}signIn({email:e,phone:t,password:r,refreshToken:s,provider:n},i={}){return g(this,void 0,void 0,(function*(){try{if(this._removeSession(),e&&!r){const{error:t}=yield this.api.sendMagicLinkEmail(e,{redirectTo:i.redirectTo});return{data:null,user:null,session:null,error:t}}if(e&&r)return this._handleEmailSignIn(e,r,{redirectTo:i.redirectTo});if(t&&!r){const{error:e}=yield this.api.sendMobileOTP(t);return{data:null,user:null,session:null,error:e}}if(t&&r)return this._handlePhoneSignIn(t,r);if(s){const{error:e}=yield this._callRefreshToken(s);if(e)throw e;return{data:this.currentSession,user:this.currentUser,session:this.currentSession,error:null}}if(n)return this._handleProviderSignIn(n,{redirectTo:i.redirectTo,scopes:i.scopes});throw new Error("You must provide either an email, phone number or a third-party provider.")}catch(e){return{data:null,user:null,session:null,error:e}}}))}verifyOTP({phone:e,token:t},r={}){return g(this,void 0,void 0,(function*(){try{this._removeSession();const{data:s,error:n}=yield this.api.verifyMobileOTP(e,t,r);if(n)throw n;if(!s)throw"An error occurred on token verification.";let i=null,o=null;return s.access_token&&(i=s,o=i.user,this._saveSession(i),this._notifyAllSubscribers("SIGNED_IN")),s.id&&(o=s),{data:s,user:o,session:i,error:null}}catch(e){return{data:null,user:null,session:null,error:e}}}))}user(){return this.currentUser}session(){return this.currentSession}refreshSession(){var e;return g(this,void 0,void 0,(function*(){try{if(!(null===(e=this.currentSession)||void 0===e?void 0:e.access_token))throw new Error("Not logged in.");const{error:t}=yield this._callRefreshToken();if(t)throw t;return{data:this.currentSession,user:this.currentUser,error:null}}catch(e){return{data:null,user:null,error:e}}}))}update(e){var t;return g(this,void 0,void 0,(function*(){try{if(!(null===(t=this.currentSession)||void 0===t?void 0:t.access_token))throw new Error("Not logged in.");const{user:r,error:s}=yield this.api.updateUser(this.currentSession.access_token,e);if(s)throw s;if(!r)throw Error("Invalid user data.");const n=Object.assign(Object.assign({},this.currentSession),{user:r});return this._saveSession(n),this._notifyAllSubscribers("USER_UPDATED"),{data:r,user:r,error:null}}catch(e){return{data:null,user:null,error:e}}}))}setSession(e){return g(this,void 0,void 0,(function*(){try{if(!e)throw new Error("No current session.");const{data:t,error:r}=yield this.api.refreshAccessToken(e);return r?{session:null,error:r}:(this._saveSession(t),this._notifyAllSubscribers("SIGNED_IN"),{session:t,error:null})}catch(e){return{error:e,session:null}}}))}setAuth(e){return this.currentSession=Object.assign(Object.assign({},this.currentSession),{access_token:e,token_type:"bearer",user:null}),this.currentSession}getSessionFromUrl(e){return g(this,void 0,void 0,(function*(){try{if(!f())throw new Error("No browser detected.");const t=m("error_description");if(t)throw new Error(t);const r=m("provider_token"),s=m("access_token");if(!s)throw new Error("No access_token detected.");const n=m("expires_in");if(!n)throw new Error("No expires_in detected.");const i=m("refresh_token");if(!i)throw new Error("No refresh_token detected.");const o=m("token_type");if(!o)throw new Error("No token_type detected.");const a=Math.round(Date.now()/1e3)+parseInt(n),{user:h,error:c}=yield this.api.getUser(s);if(c)throw c;const u={provider_token:r,access_token:s,expires_in:parseInt(n),expires_at:a,refresh_token:i,token_type:o,user:h};return(null==e?void 0:e.storeSession)&&(this._saveSession(u),this._notifyAllSubscribers("SIGNED_IN"),"recovery"===m("type")&&this._notifyAllSubscribers("PASSWORD_RECOVERY")),window.location.hash="",{data:u,error:null}}catch(e){return{data:null,error:e}}}))}signOut(){var e;return g(this,void 0,void 0,(function*(){const t=null===(e=this.currentSession)||void 0===e?void 0:e.access_token;if(this._removeSession(),this._notifyAllSubscribers("SIGNED_OUT"),t){const{error:e}=yield this.api.signOut(t);if(e)return{error:e}}return{error:null}}))}onAuthStateChange(e){try{const t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})),r={id:t,callback:e,unsubscribe:()=>{this.stateChangeEmitters.delete(t)}};return this.stateChangeEmitters.set(t,r),{data:r,error:null}}catch(e){return{data:null,error:e}}}_handleEmailSignIn(e,t,r={}){var s,n;return g(this,void 0,void 0,(function*(){try{const{data:i,error:o}=yield this.api.signInWithEmail(e,t,{redirectTo:r.redirectTo});return o||!i?{data:null,user:null,session:null,error:o}:(((null===(s=null==i?void 0:i.user)||void 0===s?void 0:s.confirmed_at)||(null===(n=null==i?void 0:i.user)||void 0===n?void 0:n.email_confirmed_at))&&(this._saveSession(i),this._notifyAllSubscribers("SIGNED_IN")),{data:i,user:i.user,session:i,error:null})}catch(e){return{data:null,user:null,session:null,error:e}}}))}_handlePhoneSignIn(e,t){var r;return g(this,void 0,void 0,(function*(){try{const{data:s,error:n}=yield this.api.signInWithPhone(e,t);return n||!s?{data:null,user:null,session:null,error:n}:((null===(r=null==s?void 0:s.user)||void 0===r?void 0:r.phone_confirmed_at)&&(this._saveSession(s),this._notifyAllSubscribers("SIGNED_IN")),{data:s,user:s.user,session:s,error:null})}catch(e){return{data:null,user:null,session:null,error:e}}}))}_handleProviderSignIn(e,t={}){const r=this.api.getUrlForProvider(e,{redirectTo:t.redirectTo,scopes:t.scopes});try{return f()&&(window.location.href=r),{provider:e,url:r,data:null,session:null,user:null,error:null}}catch(t){return r?{provider:e,url:r,data:null,session:null,user:null,error:null}:{data:null,user:null,session:null,error:t}}}_recoverSession(){var e;try{const t=f()&&(null===(e=this.localStorage)||void 0===e?void 0:e.getItem(c));if(!t||"string"!=typeof t)return null;const r=JSON.parse(t),{currentSession:s,expiresAt:n}=r;n>=Math.round(Date.now()/1e3)&&(null==s?void 0:s.user)&&(this._saveSession(s),this._notifyAllSubscribers("SIGNED_IN"))}catch(e){console.log("error",e)}}_recoverAndRefresh(){return g(this,void 0,void 0,(function*(){try{const e=f()&&(yield this.localStorage.getItem(c));if(!e)return null;const t=JSON.parse(e),{currentSession:r,expiresAt:s}=t;if(s<Math.round(Date.now()/1e3))if(this.autoRefreshToken&&r.refresh_token){const{error:e}=yield this._callRefreshToken(r.refresh_token);e&&(console.log(e.message),yield this._removeSession())}else this._removeSession();else r&&r.user?(this._saveSession(r),this._notifyAllSubscribers("SIGNED_IN")):(console.log("Current session is missing data."),this._removeSession())}catch(e){return console.error(e),null}}))}_callRefreshToken(e){var t;return void 0===e&&(e=null===(t=this.currentSession)||void 0===t?void 0:t.refresh_token),g(this,void 0,void 0,(function*(){try{if(!e)throw new Error("No current session.");const{data:t,error:r}=yield this.api.refreshAccessToken(e);if(r)throw r;if(!t)throw Error("Invalid session data.");return this._saveSession(t),this._notifyAllSubscribers("SIGNED_IN"),{data:t,error:null}}catch(e){return{data:null,error:e}}}))}_notifyAllSubscribers(e){this.stateChangeEmitters.forEach((t=>t.callback(e,this.currentSession)))}_saveSession(e){this.currentSession=e,this.currentUser=e.user;const t=e.expires_at;if(t){const e=t-Math.round(Date.now()/1e3),r=e>60?60:.5;this._startAutoRefreshToken(1e3*(e-r))}this.persistSession&&e.expires_at&&this._persistSession(this.currentSession)}_persistSession(e){const t={currentSession:e,expiresAt:e.expires_at};f()&&this.localStorage.setItem(c,JSON.stringify(t))}_removeSession(){return g(this,void 0,void 0,(function*(){this.currentSession=null,this.currentUser=null,this.refreshTokenTimer&&clearTimeout(this.refreshTokenTimer),f()&&(yield this.localStorage.removeItem(c))}))}_startAutoRefreshToken(e){this.refreshTokenTimer&&clearTimeout(this.refreshTokenTimer),e<=0||!this.autoRefreshToken||(this.refreshTokenTimer=setTimeout((()=>this._callRefreshToken()),e),"function"==typeof this.refreshTokenTimer.unref&&this.refreshTokenTimer.unref())}}},501:(e,t,r)=>{"use strict";r.r(t),r.d(t,{PostgrestBuilder:()=>i,PostgrestClient:()=>l,PostgrestFilterBuilder:()=>a,PostgrestQueryBuilder:()=>h});var s=r(98),n=r.n(s);class i{constructor(e){this.shouldThrowOnError=!1,Object.assign(this,e)}throwOnError(){return this.shouldThrowOnError=!0,this}then(e,t){void 0===this.schema||(["GET","HEAD"].includes(this.method)?this.headers["Accept-Profile"]=this.schema:this.headers["Content-Profile"]=this.schema),"GET"!==this.method&&"HEAD"!==this.method&&(this.headers["Content-Type"]="application/json");let r=n()(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then((e=>{return t=this,r=void 0,n=function*(){var t,r,s;let n=null,i=null,o=null;if(e.ok){const n=null===(t=this.headers.Prefer)||void 0===t?void 0:t.split(",").includes("return=minimal");if("HEAD"!==this.method&&!n){const t=yield e.text();t&&(i="text/csv"===this.headers.Accept?t:JSON.parse(t))}const a=null===(r=this.headers.Prefer)||void 0===r?void 0:r.match(/count=(exact|planned|estimated)/),h=null===(s=e.headers.get("content-range"))||void 0===s?void 0:s.split("/");a&&h&&h.length>1&&(o=parseInt(h[1]))}else if(n=yield e.json(),n&&this.shouldThrowOnError)throw n;return{error:n,data:i,count:o,status:e.status,statusText:e.statusText,body:i}},new((s=void 0)||(s=Promise))((function(e,i){function o(e){try{h(n.next(e))}catch(e){i(e)}}function a(e){try{h(n.throw(e))}catch(e){i(e)}}function h(t){var r;t.done?e(t.value):(r=t.value,r instanceof s?r:new s((function(e){e(r)}))).then(o,a)}h((n=n.apply(t,r||[])).next())}));var t,r,s,n}));return this.shouldThrowOnError||(r=r.catch((e=>({error:{message:"FetchError: "+e.message,details:"",hint:"",code:e.code||""},data:null,body:null,count:null,status:400,statusText:"Bad Request"})))),r.then(e,t)}}class o extends i{select(e="*"){let t=!1;const r=e.split("").map((e=>/\s/.test(e)&&!t?"":('"'===e&&(t=!t),e))).join("");return this.url.searchParams.set("select",r),this}order(e,{ascending:t=!0,nullsFirst:r=!1,foreignTable:s}={}){const n=void 0===s?"order":s+".order",i=this.url.searchParams.get(n);return this.url.searchParams.set(n,`${i?i+",":""}${e}.${t?"asc":"desc"}.${r?"nullsfirst":"nullslast"}`),this}limit(e,{foreignTable:t}={}){const r=void 0===t?"limit":t+".limit";return this.url.searchParams.set(r,""+e),this}range(e,t,{foreignTable:r}={}){const s=void 0===r?"offset":r+".offset",n=void 0===r?"limit":r+".limit";return this.url.searchParams.set(s,""+e),this.url.searchParams.set(n,""+(t-e+1)),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.Accept="application/vnd.pgrst.object+json",this}maybeSingle(){this.headers.Accept="application/vnd.pgrst.object+json";const e=new o(this);return e.then=(e,t)=>this.then((t=>{var r,s;return(null===(s=null===(r=t.error)||void 0===r?void 0:r.details)||void 0===s?void 0:s.includes("Results contain 0 rows"))?e({error:null,data:null,count:t.count,status:200,statusText:"OK",body:null}):e(t)}),t),e}csv(){return this.headers.Accept="text/csv",this}}class a extends o{constructor(){super(...arguments),this.cs=this.contains,this.cd=this.containedBy,this.sl=this.rangeLt,this.sr=this.rangeGt,this.nxl=this.rangeGte,this.nxr=this.rangeLte,this.adj=this.rangeAdjacent,this.ov=this.overlaps}not(e,t,r){return this.url.searchParams.append(""+e,`not.${t}.${r}`),this}or(e,{foreignTable:t}={}){const r=void 0===t?"or":t+".or";return this.url.searchParams.append(r,`(${e})`),this}eq(e,t){return this.url.searchParams.append(""+e,"eq."+t),this}neq(e,t){return this.url.searchParams.append(""+e,"neq."+t),this}gt(e,t){return this.url.searchParams.append(""+e,"gt."+t),this}gte(e,t){return this.url.searchParams.append(""+e,"gte."+t),this}lt(e,t){return this.url.searchParams.append(""+e,"lt."+t),this}lte(e,t){return this.url.searchParams.append(""+e,"lte."+t),this}like(e,t){return this.url.searchParams.append(""+e,"like."+t),this}ilike(e,t){return this.url.searchParams.append(""+e,"ilike."+t),this}is(e,t){return this.url.searchParams.append(""+e,"is."+t),this}in(e,t){const r=t.map((e=>"string"==typeof e&&new RegExp("[,()]").test(e)?`"${e}"`:""+e)).join(",");return this.url.searchParams.append(""+e,`in.(${r})`),this}contains(e,t){return"string"==typeof t?this.url.searchParams.append(""+e,"cs."+t):Array.isArray(t)?this.url.searchParams.append(""+e,`cs.{${t.join(",")}}`):this.url.searchParams.append(""+e,"cs."+JSON.stringify(t)),this}containedBy(e,t){return"string"==typeof t?this.url.searchParams.append(""+e,"cd."+t):Array.isArray(t)?this.url.searchParams.append(""+e,`cd.{${t.join(",")}}`):this.url.searchParams.append(""+e,"cd."+JSON.stringify(t)),this}rangeLt(e,t){return this.url.searchParams.append(""+e,"sl."+t),this}rangeGt(e,t){return this.url.searchParams.append(""+e,"sr."+t),this}rangeGte(e,t){return this.url.searchParams.append(""+e,"nxl."+t),this}rangeLte(e,t){return this.url.searchParams.append(""+e,"nxr."+t),this}rangeAdjacent(e,t){return this.url.searchParams.append(""+e,"adj."+t),this}overlaps(e,t){return"string"==typeof t?this.url.searchParams.append(""+e,"ov."+t):this.url.searchParams.append(""+e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:s=null}={}){let n="";"plain"===s?n="pl":"phrase"===s?n="ph":"websearch"===s&&(n="w");const i=void 0===r?"":`(${r})`;return this.url.searchParams.append(""+e,`${n}fts${i}.${t}`),this}fts(e,t,{config:r}={}){const s=void 0===r?"":`(${r})`;return this.url.searchParams.append(""+e,`fts${s}.${t}`),this}plfts(e,t,{config:r}={}){const s=void 0===r?"":`(${r})`;return this.url.searchParams.append(""+e,`plfts${s}.${t}`),this}phfts(e,t,{config:r}={}){const s=void 0===r?"":`(${r})`;return this.url.searchParams.append(""+e,`phfts${s}.${t}`),this}wfts(e,t,{config:r}={}){const s=void 0===r?"":`(${r})`;return this.url.searchParams.append(""+e,`wfts${s}.${t}`),this}filter(e,t,r){return this.url.searchParams.append(""+e,`${t}.${r}`),this}match(e){return Object.keys(e).forEach((t=>{this.url.searchParams.append(""+t,"eq."+e[t])})),this}}class h extends i{constructor(e,{headers:t={},schema:r}={}){super({}),this.url=new URL(e),this.headers=Object.assign({},t),this.schema=r}select(e="*",{head:t=!1,count:r=null}={}){this.method="GET";let s=!1;const n=e.split("").map((e=>/\s/.test(e)&&!s?"":('"'===e&&(s=!s),e))).join("");return this.url.searchParams.set("select",n),r&&(this.headers.Prefer="count="+r),t&&(this.method="HEAD"),new a(this)}insert(e,{upsert:t=!1,onConflict:r,returning:s="representation",count:n=null}={}){this.method="POST";const i=["return="+s];if(t&&i.push("resolution=merge-duplicates"),t&&void 0!==r&&this.url.searchParams.set("on_conflict",r),this.body=e,n&&i.push("count="+n),this.headers.Prefer=i.join(","),Array.isArray(e)){const t=e.reduce(((e,t)=>e.concat(Object.keys(t))),[]);if(t.length>0){const e=[...new Set(t)].map((e=>`"${e}"`));this.url.searchParams.set("columns",e.join(","))}}return new a(this)}upsert(e,{onConflict:t,returning:r="representation",count:s=null,ignoreDuplicates:n=!1}={}){this.method="POST";const i=[`resolution=${n?"ignore":"merge"}-duplicates`,"return="+r];return void 0!==t&&this.url.searchParams.set("on_conflict",t),this.body=e,s&&i.push("count="+s),this.headers.Prefer=i.join(","),new a(this)}update(e,{returning:t="representation",count:r=null}={}){this.method="PATCH";const s=["return="+t];return this.body=e,r&&s.push("count="+r),this.headers.Prefer=s.join(","),new a(this)}delete({returning:e="representation",count:t=null}={}){this.method="DELETE";const r=["return="+e];return t&&r.push("count="+t),this.headers.Prefer=r.join(","),new a(this)}}class c extends i{constructor(e,{headers:t={},schema:r}={}){super({}),this.url=new URL(e),this.headers=Object.assign({},t),this.schema=r}rpc(e,{head:t=!1,count:r=null}={}){return t?(this.method="HEAD",e&&Object.entries(e).forEach((([e,t])=>{this.url.searchParams.append(e,t)}))):(this.method="POST",this.body=e),r&&(void 0!==this.headers.Prefer?this.headers.Prefer+=",count="+r:this.headers.Prefer="count="+r),new a(this)}}const u={"X-Client-Info":"postgrest-js/0.34.1"};class l{constructor(e,{headers:t={},schema:r}={}){this.url=e,this.headers=Object.assign(Object.assign({},u),t),this.schema=r}auth(e){return this.headers.Authorization="Bearer "+e,this}from(e){const t=`${this.url}/${e}`;return new h(t,{headers:this.headers,schema:this.schema})}rpc(e,t,{head:r=!1,count:s=null}={}){const n=`${this.url}/rpc/${e}`;return new c(n,{headers:this.headers,schema:this.schema}).rpc(t,{head:r,count:s})}}},498:(e,t,r)=>{"use strict";r.r(t),r.d(t,{RealtimeClient:()=>E,RealtimeSubscription:()=>w,Transformers:()=>n});var s,n={};r.r(n),r.d(n,{PostgresTypes:()=>s,convertCell:()=>a,convertChangeData:()=>i,convertColumn:()=>o,toArray:()=>d,toBoolean:()=>c,toJson:()=>l,toNumber:()=>u,toTimestampString:()=>p}),function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"}(s||(s={}));const i=(e,t,r={})=>{var s;const n=null!==(s=r.skipTypes)&&void 0!==s?s:[];return Object.keys(t).reduce(((r,s)=>(r[s]=o(s,e,t,n),r)),{})},o=(e,t,r,s)=>{const n=t.find((t=>t.name===e)),i=null==n?void 0:n.type,o=r[e];return i&&!s.includes(i)?a(i,o):h(o)},a=(e,t)=>{if("_"===e.charAt(0)){const r=e.slice(1,e.length);return d(t,r)}switch(e){case s.bool:return c(t);case s.float4:case s.float8:case s.int2:case s.int4:case s.int8:case s.numeric:case s.oid:return u(t);case s.json:case s.jsonb:return l(t);case s.timestamp:return p(t);case s.abstime:case s.date:case s.daterange:case s.int4range:case s.int8range:case s.money:case s.reltime:case s.text:case s.time:case s.timestamptz:case s.timetz:case s.tsrange:case s.tstzrange:default:return h(t)}},h=e=>e,c=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},u=e=>{if("string"==typeof e){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},l=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(t){return console.log("JSON parse error: "+t),e}return e},d=(e,t)=>{if("string"!=typeof e)return e;const r=e.length-1,s=e[r];if("{"===e[0]&&"}"===s){let s;const n=e.slice(1,r);try{s=JSON.parse("["+n+"]")}catch(e){s=n?n.split(","):[]}return s.map((e=>a(t,e)))}return e},p=e=>"string"==typeof e?e.replace(" ","T"):e,f={"X-Client-Info":"realtime-js/1.2.1"};var m,y,v,g;!function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"}(m||(m={})),function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"}(y||(y={})),function(e){e.close="phx_close",e.error="phx_error",e.join="phx_join",e.reply="phx_reply",e.leave="phx_leave"}(v||(v={})),function(e){e.websocket="websocket"}(g||(g={}));class b{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=t}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout((()=>{this.tries=this.tries+1,this.callback()}),this.timerCalc(this.tries+1))}}class _{constructor(e,t,r={},s=1e4){this.channel=e,this.event=t,this.payload=r,this.timeout=s,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref}))}receive(e,t){var r;return this._hasReceived(e)&&t(null===(r=this.receivedResp)||void 0===r?void 0:r.response),this.recHooks.push({status:e,callback:t}),this}startTimeout(){this.timeoutTimer||(this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,(e=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=e,this._matchReceive(e)})),this.timeoutTimer=setTimeout((()=>{this.trigger("timeout",{})}),this.timeout))}trigger(e,t){this.refEvent&&this.channel.trigger(this.refEvent,{status:e,response:t})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:t}){this.recHooks.filter((t=>t.status===e)).forEach((e=>e.callback(t)))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}class w{constructor(e,t={},r){this.topic=e,this.params=t,this.socket=r,this.bindings=[],this.state=y.closed,this.joinedOnce=!1,this.pushBuffer=[],this.timeout=this.socket.timeout,this.joinPush=new _(this,v.join,this.params,this.timeout),this.rejoinTimer=new b((()=>this.rejoinUntilConnected()),this.socket.reconnectAfterMs),this.joinPush.receive("ok",(()=>{this.state=y.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach((e=>e.send())),this.pushBuffer=[]})),this.onClose((()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=y.closed,this.socket.remove(this)})),this.onError((e=>{this.isLeaving()||this.isClosed()||(this.socket.log("channel","error "+this.topic,e),this.state=y.errored,this.rejoinTimer.scheduleTimeout())})),this.joinPush.receive("timeout",(()=>{this.isJoining()&&(this.socket.log("channel","timeout "+this.topic,this.joinPush.timeout),this.state=y.errored,this.rejoinTimer.scheduleTimeout())})),this.on(v.reply,((e,t)=>{this.trigger(this.replyEventName(t),e)}))}rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this.rejoin()}subscribe(e=this.timeout){if(this.joinedOnce)throw"tried to subscribe multiple times. 'subscribe' can only be called a single time per channel instance";return this.joinedOnce=!0,this.rejoin(e),this.joinPush}onClose(e){this.on(v.close,e)}onError(e){this.on(v.error,(t=>e(t)))}on(e,t){this.bindings.push({event:e,callback:t})}off(e){this.bindings=this.bindings.filter((t=>t.event!==e))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let s=new _(this,e,t,r);return this.canPush()?s.send():(s.startTimeout(),this.pushBuffer.push(s)),s}unsubscribe(e=this.timeout){this.state=y.leaving;let t=()=>{this.socket.log("channel","leave "+this.topic),this.trigger(v.close,"leave",this.joinRef())};this.joinPush.destroy();let r=new _(this,v.leave,{},e);return r.receive("ok",(()=>t())).receive("timeout",(()=>t())),r.send(),this.canPush()||r.trigger("ok",{}),r}onMessage(e,t,r){return t}isMember(e){return this.topic===e}joinRef(){return this.joinPush.ref}sendJoin(e){this.state=y.joining,this.joinPush.resend(e)}rejoin(e=this.timeout){this.isLeaving()||this.sendJoin(e)}trigger(e,t,r){let{close:s,error:n,leave:i,join:o}=v;if(r&&[s,n,i,o].indexOf(e)>=0&&r!==this.joinRef())return;let a=this.onMessage(e,t,r);if(t&&!a)throw"channel onMessage callbacks must return the payload, modified or unmodified";this.bindings.filter((r=>"*"===r.event?e===(null==t?void 0:t.type):r.event===e)).map((e=>e.callback(a,r)))}replyEventName(e){return"chan_reply_"+e}isClosed(){return this.state===y.closed}isErrored(){return this.state===y.errored}isJoined(){return this.state===y.joined}isJoining(){return this.state===y.joining}isLeaving(){return this.state===y.leaving}}var S=r(840);class T{constructor(){this.HEADER_LENGTH=1}decode(e,t){return e.constructor===ArrayBuffer?t(this._binaryDecode(e)):t("string"==typeof e?JSON.parse(e):{})}_binaryDecode(e){const t=new DataView(e),r=new TextDecoder;return this._decodeBroadcast(e,t,r)}_decodeBroadcast(e,t,r){const s=t.getUint8(1),n=t.getUint8(2);let i=this.HEADER_LENGTH+2;const o=r.decode(e.slice(i,i+s));i+=s;const a=r.decode(e.slice(i,i+n));return i+=n,{ref:null,topic:o,event:a,payload:JSON.parse(r.decode(e.slice(i,e.byteLength)))}}}const x=()=>{};class E{constructor(e,t){this.channels=[],this.endPoint="",this.headers=f,this.params={},this.timeout=1e4,this.transport=S.w3cwebsocket,this.heartbeatIntervalMs=3e4,this.longpollerTimeout=2e4,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.ref=0,this.logger=x,this.conn=null,this.sendBuffer=[],this.serializer=new T,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.endPoint=`${e}/${g.websocket}`,(null==t?void 0:t.params)&&(this.params=t.params),(null==t?void 0:t.headers)&&(this.headers=Object.assign(Object.assign({},this.headers),t.headers)),(null==t?void 0:t.timeout)&&(this.timeout=t.timeout),(null==t?void 0:t.logger)&&(this.logger=t.logger),(null==t?void 0:t.transport)&&(this.transport=t.transport),(null==t?void 0:t.heartbeatIntervalMs)&&(this.heartbeatIntervalMs=t.heartbeatIntervalMs),(null==t?void 0:t.longpollerTimeout)&&(this.longpollerTimeout=t.longpollerTimeout),this.reconnectAfterMs=(null==t?void 0:t.reconnectAfterMs)?t.reconnectAfterMs:e=>[1e3,2e3,5e3,1e4][e-1]||1e4,this.encode=(null==t?void 0:t.encode)?t.encode:(e,t)=>t(JSON.stringify(e)),this.decode=(null==t?void 0:t.decode)?t.decode:this.serializer.decode.bind(this.serializer),this.reconnectTimer=new b((()=>{return e=this,t=void 0,s=function*(){yield this.disconnect(),this.connect()},new((r=void 0)||(r=Promise))((function(n,i){function o(e){try{h(s.next(e))}catch(e){i(e)}}function a(e){try{h(s.throw(e))}catch(e){i(e)}}function h(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}h((s=s.apply(e,t||[])).next())}));var e,t,r,s}),this.reconnectAfterMs)}connect(){this.conn||(this.conn=new this.transport(this.endPointURL(),[],null,this.headers),this.conn&&(this.conn.binaryType="arraybuffer",this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e)))}disconnect(e,t){return new Promise(((r,s)=>{try{this.conn&&(this.conn.onclose=function(){},e?this.conn.close(e,t||""):this.conn.close(),this.conn=null,this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.reset()),r({error:null,data:!0})}catch(e){r({error:e,data:!1})}}))}log(e,t,r){this.logger(e,t,r)}onOpen(e){this.stateChangeCallbacks.open.push(e)}onClose(e){this.stateChangeCallbacks.close.push(e)}onError(e){this.stateChangeCallbacks.error.push(e)}onMessage(e){this.stateChangeCallbacks.message.push(e)}connectionState(){switch(this.conn&&this.conn.readyState){case m.connecting:return"connecting";case m.open:return"open";case m.closing:return"closing";default:return"closed"}}isConnected(){return"open"===this.connectionState()}remove(e){this.channels=this.channels.filter((t=>t.joinRef()!==e.joinRef()))}channel(e,t={}){let r=new w(e,t,this);return this.channels.push(r),r}push(e){let{topic:t,event:r,payload:s,ref:n}=e,i=()=>{this.encode(e,(e=>{var t;null===(t=this.conn)||void 0===t||t.send(e)}))};this.log("push",`${t} ${r} (${n})`,s),this.isConnected()?i():this.sendBuffer.push(i)}onConnMessage(e){this.decode(e.data,(e=>{let{topic:t,event:r,payload:s,ref:n}=e;n&&n===this.pendingHeartbeatRef?this.pendingHeartbeatRef=null:r===(null==s?void 0:s.type)&&this._resetHeartbeat(),this.log("receive",`${s.status||""} ${t} ${r} ${n&&"("+n+")"||""}`,s),this.channels.filter((e=>e.isMember(t))).forEach((e=>e.trigger(r,s,n))),this.stateChangeCallbacks.message.forEach((t=>t(e)))}))}endPointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:"1.0.0"}))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_onConnOpen(){this.log("transport","connected to "+this.endPointURL()),this._flushSendBuffer(),this.reconnectTimer.reset(),this._resetHeartbeat(),this.stateChangeCallbacks.open.forEach((e=>e()))}_onConnClose(e){this.log("transport","close",e),this._triggerChanError(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach((t=>t(e)))}_onConnError(e){this.log("transport",e.message),this._triggerChanError(),this.stateChangeCallbacks.error.forEach((t=>t(e)))}_triggerChanError(){this.channels.forEach((e=>e.trigger(v.error)))}_appendParams(e,t){if(0===Object.keys(t).length)return e;const r=e.match(/\?/)?"&":"?";return`${e}${r}${new URLSearchParams(t)}`}_flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach((e=>e())),this.sendBuffer=[])}_resetHeartbeat(){this.pendingHeartbeatRef=null,this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval((()=>this._sendHeartbeat()),this.heartbeatIntervalMs)}_sendHeartbeat(){var e;if(this.isConnected()){if(this.pendingHeartbeatRef)return this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),void(null===(e=this.conn)||void 0===e||e.close(1e3,"hearbeat timeout"));this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef})}}}},122:(e,t,r)=>{"use strict";r.r(t),r.d(t,{SupabaseStorageClient:()=>v});var s=r(98),n=r.n(s),i=function(e,t,r,s){return new(r||(r=Promise))((function(n,i){function o(e){try{h(s.next(e))}catch(e){i(e)}}function a(e){try{h(s.throw(e))}catch(e){i(e)}}function h(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}h((s=s.apply(e,t||[])).next())}))};const o=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e);function a(e=n(),t,r,s,a,h){return i(this,void 0,void 0,(function*(){return new Promise(((n,i)=>{e(r,((e,t,r,s)=>{const n={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"===e?n:(n.headers=Object.assign({"Content-Type":"application/json"},null==t?void 0:t.headers),n.body=JSON.stringify(s),Object.assign(Object.assign({},n),r))})(t,s,a,h)).then((e=>{if(!e.ok)throw e;return(null==s?void 0:s.noResolveJson)?n(e):e.json()})).then((e=>n(e))).catch((e=>((e,t)=>{if("function"!=typeof e.json)return t(e);e.json().then((r=>t({message:o(r),status:(null==e?void 0:e.status)||500})))})(e,i)))}))}))}function h(e,t,r,s){return i(this,void 0,void 0,(function*(){return a(e,"GET",t,r,s)}))}function c(e,t,r,s,n){return i(this,void 0,void 0,(function*(){return a(e,"POST",t,s,n,r)}))}function u(e,t,r,s,n){return i(this,void 0,void 0,(function*(){return a(e,"DELETE",t,s,n,r)}))}const l={"X-Client-Info":"storage-js/0.0.0"};var d=function(e,t,r,s){return new(r||(r=Promise))((function(n,i){function o(e){try{h(s.next(e))}catch(e){i(e)}}function a(e){try{h(s.throw(e))}catch(e){i(e)}}function h(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}h((s=s.apply(e,t||[])).next())}))},p=function(e,t,r,s){return new(r||(r=Promise))((function(n,i){function o(e){try{h(s.next(e))}catch(e){i(e)}}function a(e){try{h(s.throw(e))}catch(e){i(e)}}function h(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}h((s=s.apply(e,t||[])).next())}))};const f={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},m={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class y{constructor(e,t={},r,s){this.url=e,this.headers=t,this.bucketId=r,this.fetch=s}uploadOrUpdate(e,t,r,s){return p(this,void 0,void 0,(function*(){try{let i;const o=Object.assign(Object.assign({},m),s),a=Object.assign(Object.assign({},this.headers),"POST"===e&&{"x-upsert":String(o.upsert)});"undefined"!=typeof Blob&&r instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),i.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(i=r,i.append("cacheControl",o.cacheControl)):(i=r,a["cache-control"]="max-age="+o.cacheControl,a["content-type"]=o.contentType);const h=this._getFinalPath(t),c=yield n()(`${this.url}/object/${h}`,{method:e,body:i,headers:a});return c.ok?{data:{Key:h},error:null}:{data:null,error:yield c.json()}}catch(e){return{data:null,error:e}}}))}upload(e,t,r){return p(this,void 0,void 0,(function*(){return this.uploadOrUpdate("POST",e,t,r)}))}update(e,t,r){return p(this,void 0,void 0,(function*(){return this.uploadOrUpdate("PUT",e,t,r)}))}move(e,t){return p(this,void 0,void 0,(function*(){try{return{data:yield c(this.fetch,this.url+"/object/move",{bucketId:this.bucketId,sourceKey:e,destinationKey:t},{headers:this.headers}),error:null}}catch(e){return{data:null,error:e}}}))}createSignedUrl(e,t){return p(this,void 0,void 0,(function*(){try{const r=this._getFinalPath(e);let s=yield c(this.fetch,`${this.url}/object/sign/${r}`,{expiresIn:t},{headers:this.headers});const n=`${this.url}${s.signedURL}`;return s={signedURL:n},{data:s,error:null,signedURL:n}}catch(e){return{data:null,error:e,signedURL:null}}}))}download(e){return p(this,void 0,void 0,(function*(){try{const t=this._getFinalPath(e),r=yield h(this.fetch,`${this.url}/object/${t}`,{headers:this.headers,noResolveJson:!0});return{data:yield r.blob(),error:null}}catch(e){return{data:null,error:e}}}))}getPublicUrl(e){try{const t=this._getFinalPath(e),r=`${this.url}/object/public/${t}`;return{data:{publicURL:r},error:null,publicURL:r}}catch(e){return{data:null,error:e,publicURL:null}}}remove(e){return p(this,void 0,void 0,(function*(){try{return{data:yield u(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(e){return{data:null,error:e}}}))}list(e,t,r){return p(this,void 0,void 0,(function*(){try{const s=Object.assign(Object.assign(Object.assign({},f),t),{prefix:e||""});return{data:yield c(this.fetch,`${this.url}/object/list/${this.bucketId}`,s,{headers:this.headers},r),error:null}}catch(e){return{data:null,error:e}}}))}_getFinalPath(e){return`${this.bucketId}/${e}`}}class v extends class{constructor(e,t={},r){this.url=e,this.headers=Object.assign(Object.assign({},l),t),this.fetch=r}listBuckets(){return d(this,void 0,void 0,(function*(){try{return{data:yield h(this.fetch,this.url+"/bucket",{headers:this.headers}),error:null}}catch(e){return{data:null,error:e}}}))}getBucket(e){return d(this,void 0,void 0,(function*(){try{return{data:yield h(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(e){return{data:null,error:e}}}))}createBucket(e,t={public:!1}){return d(this,void 0,void 0,(function*(){try{return{data:(yield c(this.fetch,this.url+"/bucket",{id:e,name:e,public:t.public},{headers:this.headers})).name,error:null}}catch(e){return{data:null,error:e}}}))}updateBucket(e,t){return d(this,void 0,void 0,(function*(){try{return{data:yield function(e,t,r,s,n){return i(this,void 0,void 0,(function*(){return a(e,"PUT",t,s,undefined,r)}))}(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:t.public},{headers:this.headers}),error:null}}catch(e){return{data:null,error:e}}}))}emptyBucket(e){return d(this,void 0,void 0,(function*(){try{return{data:yield c(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(e){return{data:null,error:e}}}))}deleteBucket(e){return d(this,void 0,void 0,(function*(){try{return{data:yield u(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(e){return{data:null,error:e}}}))}}{constructor(e,t={},r){super(e,t,r)}from(e){return new y(this.url,this.headers,e,this.fetch)}}},98:function(e,t){var r="undefined"!=typeof self?self:this,s=function(){function e(){this.fetch=!1,this.DOMException=r.DOMException}return e.prototype=r,new e}();!function(e){!function(t){var r="URLSearchParams"in e,s="Symbol"in e&&"iterator"in Symbol,n="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),i="FormData"in e,o="ArrayBuffer"in e;if(o)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(e){return e&&a.indexOf(Object.prototype.toString.call(e))>-1};function c(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function u(e){return"string"!=typeof e&&(e=String(e)),e}function l(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return s&&(t[Symbol.iterator]=function(){return t}),t}function d(e){this.map={},e instanceof d?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function p(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function f(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function m(e){var t=new FileReader,r=f(t);return t.readAsArrayBuffer(e),r}function y(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:n&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:i&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():o&&n&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=y(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):o&&(ArrayBuffer.prototype.isPrototypeOf(e)||h(e))?this._bodyArrayBuffer=y(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},n&&(this.blob=function(){var e=p(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(m)}),this.text=function(){var e,t,r,s=p(this);if(s)return s;if(this._bodyBlob)return e=this._bodyBlob,r=f(t=new FileReader),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),s=0;s<t.length;s++)r[s]=String.fromCharCode(t[s]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i&&(this.formData=function(){return this.text().then(_)}),this.json=function(){return this.text().then(JSON.parse)},this}d.prototype.append=function(e,t){e=c(e),t=u(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},d.prototype.delete=function(e){delete this.map[c(e)]},d.prototype.get=function(e){return e=c(e),this.has(e)?this.map[e]:null},d.prototype.has=function(e){return this.map.hasOwnProperty(c(e))},d.prototype.set=function(e,t){this.map[c(e)]=u(t)},d.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},d.prototype.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),l(e)},d.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),l(e)},d.prototype.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),l(e)},s&&(d.prototype[Symbol.iterator]=d.prototype.entries);var g=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function b(e,t){var r,s,n=(t=t||{}).body;if(e instanceof b){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new d(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new d(t.headers)),this.method=(s=(r=t.method||this.method||"GET").toUpperCase(),g.indexOf(s)>-1?s:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function _(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),s=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(s),decodeURIComponent(n))}})),t}function w(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new d(t.headers),this.url=t.url||"",this._initBody(e)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},v.call(b.prototype),v.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},w.error=function(){var e=new w(null,{status:0,statusText:""});return e.type="error",e};var S=[301,302,303,307,308];w.redirect=function(e,t){if(-1===S.indexOf(t))throw new RangeError("Invalid status code");return new w(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function T(e,r){return new Promise((function(s,i){var o=new b(e,r);if(o.signal&&o.signal.aborted)return i(new t.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function h(){a.abort()}a.onload=function(){var e,t,r={status:a.status,statusText:a.statusText,headers:(e=a.getAllResponseHeaders()||"",t=new d,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var r=e.split(":"),s=r.shift().trim();if(s){var n=r.join(":").trim();t.append(s,n)}})),t)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var n="response"in a?a.response:a.responseText;s(new w(n,r))},a.onerror=function(){i(new TypeError("Network request failed"))},a.ontimeout=function(){i(new TypeError("Network request failed"))},a.onabort=function(){i(new t.DOMException("Aborted","AbortError"))},a.open(o.method,o.url,!0),"include"===o.credentials?a.withCredentials=!0:"omit"===o.credentials&&(a.withCredentials=!1),"responseType"in a&&n&&(a.responseType="blob"),o.headers.forEach((function(e,t){a.setRequestHeader(t,e)})),o.signal&&(o.signal.addEventListener("abort",h),a.onreadystatechange=function(){4===a.readyState&&o.signal.removeEventListener("abort",h)}),a.send(void 0===o._bodyInit?null:o._bodyInit)}))}T.polyfill=!0,e.fetch||(e.fetch=T,e.Headers=d,e.Request=b,e.Response=w),t.Headers=d,t.Request=b,t.Response=w,t.fetch=T,Object.defineProperty(t,"__esModule",{value:!0})}({})}(s),s.fetch.ponyfill=!0,delete s.fetch.polyfill;var n=s;(t=n.fetch).default=n.fetch,t.fetch=n.fetch,t.Headers=n.Headers,t.Request=n.Request,t.Response=n.Response,e.exports=t},284:e=>{var t=function(){if("object"==typeof self&&self)return self;if("object"==typeof window&&window)return window;throw new Error("Unable to resolve global `this`")};e.exports=function(){if(this)return this;if("object"==typeof globalThis&&globalThis)return globalThis;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:!0})}catch(e){return t()}try{return __global__||t()}finally{delete Object.prototype.__global__}}()},296:function(e,t,r){"use strict";var s=this&&this.__awaiter||function(e,t,r,s){return new(r||(r=Promise))((function(n,i){function o(e){try{h(s.next(e))}catch(e){i(e)}}function a(e){try{h(s.throw(e))}catch(e){i(e)}}function h(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}h((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const n=r(678),i=r(610),o=r(283),a=r(528),h=r(122),c=r(501),u=r(498),l={schema:"public",autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:n.DEFAULT_HEADERS};t.default=class{constructor(e,t,r){if(this.supabaseUrl=e,this.supabaseKey=t,!e)throw new Error("supabaseUrl is required.");if(!t)throw new Error("supabaseKey is required.");e=i.stripTrailingSlash(e);const s=Object.assign(Object.assign({},l),r);this.restUrl=e+"/rest/v1",this.realtimeUrl=(e+"/realtime/v1").replace("http","ws"),this.authUrl=e+"/auth/v1",this.storageUrl=e+"/storage/v1",this.schema=s.schema,this.auth=this._initSupabaseAuthClient(s),this.realtime=this._initRealtimeClient(s.realtime)}get storage(){return new h.SupabaseStorageClient(this.storageUrl,this._getAuthHeaders())}from(e){const t=`${this.restUrl}/${e}`;return new a.SupabaseQueryBuilder(t,{headers:this._getAuthHeaders(),schema:this.schema,realtime:this.realtime,table:e})}rpc(e,t,{head:r=!1,count:s=null}={}){return this._initPostgRESTClient().rpc(e,t,{head:r,count:s})}removeSubscription(e){return new Promise((t=>s(this,void 0,void 0,(function*(){try{yield this._closeSubscription(e);const r=this.getSubscriptions().length;if(!r){const{error:e}=yield this.realtime.disconnect();if(e)return t({error:e})}return t({error:null,data:{openSubscriptions:r}})}catch(e){return t({error:e})}}))))}_closeSubscription(e){return s(this,void 0,void 0,(function*(){e.isClosed()||(yield this._closeChannel(e))}))}getSubscriptions(){return this.realtime.channels}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,localStorage:s,headers:n}){const i={Authorization:"Bearer "+this.supabaseKey,apikey:""+this.supabaseKey};return new o.SupabaseAuthClient({url:this.authUrl,headers:Object.assign(Object.assign({},n),i),autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,localStorage:s})}_initRealtimeClient(e){return new u.RealtimeClient(this.realtimeUrl,Object.assign(Object.assign({},e),{params:Object.assign(Object.assign({},null==e?void 0:e.params),{apikey:this.supabaseKey})}))}_initPostgRESTClient(){return new c.PostgrestClient(this.restUrl,{headers:this._getAuthHeaders(),schema:this.schema})}_getAuthHeaders(){var e,t;const r=n.DEFAULT_HEADERS,s=null!==(t=null===(e=this.auth.session())||void 0===e?void 0:e.access_token)&&void 0!==t?t:this.supabaseKey;return r.apikey=this.supabaseKey,r.Authorization="Bearer "+s,r}_closeChannel(e){return new Promise(((t,r)=>{e.unsubscribe().receive("ok",(()=>(this.realtime.remove(e),t(!0)))).receive("error",(e=>r(e)))}))}}},341:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||s(t,e,r)},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AuthSession=t.AuthUser=t.SupabaseRealtimePayload=t.SupabaseClientOptions=t.SupabaseClient=t.createClient=t.PostgrestError=t.PostgrestMaybeSingleResponse=t.PostgrestSingleResponse=t.PostgrestResponse=void 0;const o=i(r(296));t.SupabaseClient=o.default;const a=r(717);Object.defineProperty(t,"SupabaseClientOptions",{enumerable:!0,get:function(){return a.SupabaseClientOptions}}),Object.defineProperty(t,"SupabaseRealtimePayload",{enumerable:!0,get:function(){return a.SupabaseRealtimePayload}});const h=r(271);Object.defineProperty(t,"AuthUser",{enumerable:!0,get:function(){return h.User}}),Object.defineProperty(t,"AuthSession",{enumerable:!0,get:function(){return h.Session}}),n(r(271),t);var c=r(501);Object.defineProperty(t,"PostgrestResponse",{enumerable:!0,get:function(){return c.PostgrestResponse}}),Object.defineProperty(t,"PostgrestSingleResponse",{enumerable:!0,get:function(){return c.PostgrestSingleResponse}}),Object.defineProperty(t,"PostgrestMaybeSingleResponse",{enumerable:!0,get:function(){return c.PostgrestMaybeSingleResponse}}),Object.defineProperty(t,"PostgrestError",{enumerable:!0,get:function(){return c.PostgrestError}}),n(r(498),t),t.createClient=(e,t,r)=>new o.default(e,t,r)},283:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SupabaseAuthClient=void 0;const s=r(271);class n extends s.GoTrueClient{constructor(e){super(e)}}t.SupabaseAuthClient=n},528:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SupabaseQueryBuilder=void 0;const s=r(501),n=r(308);class i extends s.PostgrestQueryBuilder{constructor(e,{headers:t={},schema:r,realtime:s,table:i}){super(e,{headers:t,schema:r}),this._subscription=new n.SupabaseRealtimeClient(s,t,r,i),this._realtime=s}on(e,t){return this._realtime.isConnected()||this._realtime.connect(),this._subscription.on(e,t)}}t.SupabaseQueryBuilder=i},308:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SupabaseRealtimeClient=void 0;const s=r(498);t.SupabaseRealtimeClient=class{constructor(e,t,r,s){const n={},i="*"===s?"realtime:"+r:`realtime:${r}:${s}`,o=t.Authorization.split(" ")[1];o&&(n.user_token=o),this.subscription=e.channel(i,n)}getPayloadRecords(e){const t={new:{},old:{}};return"INSERT"!==e.type&&"UPDATE"!==e.type||(t.new=s.Transformers.convertChangeData(e.columns,e.record)),"UPDATE"!==e.type&&"DELETE"!==e.type||(t.old=s.Transformers.convertChangeData(e.columns,e.old_record)),t}on(e,t){return this.subscription.on(e,(e=>{let r={schema:e.schema,table:e.table,commit_timestamp:e.commit_timestamp,eventType:e.type,new:{},old:{}};r=Object.assign(Object.assign({},r),this.getPayloadRecords(e)),t(r)})),this}subscribe(e=(()=>{})){return this.subscription.onError((t=>e("SUBSCRIPTION_ERROR",t))),this.subscription.onClose((()=>e("CLOSED"))),this.subscription.subscribe().receive("ok",(()=>e("SUBSCRIBED"))).receive("error",(t=>e("SUBSCRIPTION_ERROR",t))).receive("timeout",(()=>e("RETRYING_AFTER_TIMEOUT"))),this.subscription}}},678:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_HEADERS=void 0;const s=r(506);t.DEFAULT_HEADERS={"X-Client-Info":"supabase-js/"+s.version}},610:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.stripTrailingSlash=t.uuid=void 0,t.uuid=function(){return"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)}))},t.stripTrailingSlash=function(e){return e.replace(/\/$/,"")}},717:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},506:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version=void 0,t.version="0.0.0"},840:(e,t,r)=>{var s;if("object"==typeof globalThis)s=globalThis;else try{s=r(284)}catch(e){}finally{if(s||"undefined"==typeof window||(s=window),!s)throw new Error("Could not determine global this")}var n=s.WebSocket||s.MozWebSocket,i=r(387);function o(e,t){return t?new n(e,t):new n(e)}n&&["CONNECTING","OPEN","CLOSING","CLOSED"].forEach((function(e){Object.defineProperty(o,e,{get:function(){return n[e]}})})),e.exports={w3cwebsocket:n?o:null,version:i}},387:(e,t,r)=>{e.exports=r(847).version},847:e=>{"use strict";e.exports={version:"1.0.34"}}},t={};function r(s){if(t[s])return t[s].exports;var n=t[s]={exports:{}};return e[s].call(n.exports,n,n.exports,r),n.exports}return r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var s in t)r.o(t,s)&&!r.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(341)})()}));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.supabase=t():e.supabase=t()}(self,(function(){return(()=>{var e={271:(e,t,r)=>{"use strict";r.r(t),r.d(t,{GoTrueApi:()=>g,GoTrueClient:()=>w});var s=r(98),n=r.n(s),i=function(e,t,r,s){return new(r||(r=Promise))((function(n,i){function o(e){try{h(s.next(e))}catch(e){i(e)}}function a(e){try{h(s.throw(e))}catch(e){i(e)}}function h(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}h((s=s.apply(e,t||[])).next())}))};const o=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e);function a(e=n(),t,r,s,a){return i(this,void 0,void 0,(function*(){return new Promise(((n,i)=>{e(r,((e,t,r)=>{const s={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"===e||(s.headers=Object.assign({"Content-Type":"text/plain;charset=UTF-8"},null==t?void 0:t.headers),s.body=JSON.stringify(r)),s})(t,s,a)).then((e=>{if(!e.ok)throw e;return(null==s?void 0:s.noResolveJson)?n:e.json()})).then((e=>n(e))).catch((e=>((e,t)=>{if("function"!=typeof e.json)return t(e);e.json().then((r=>t({message:o(r),status:(null==e?void 0:e.status)||500})))})(e,i)))}))}))}function h(e,t,r){return i(this,void 0,void 0,(function*(){return a(e,"GET",t,r)}))}function c(e,t,r,s){return i(this,void 0,void 0,(function*(){return a(e,"POST",t,s,r)}))}const u="supabase.auth.token",l={name:"sb:token",lifetime:28800,domain:"",path:"/",sameSite:"lax"};function d(e,t,r){const s=r.map((t=>{return r=t,s=function(e){if(!e||!e.headers||!e.headers.host)throw new Error('The "host" request header is not available');const t=e.headers.host.indexOf(":")>-1&&e.headers.host.split(":")[0]||e.headers.host;return!(["localhost","127.0.0.1"].indexOf(t)>-1||t.endsWith(".local"))}(e),function(e,t,r){const s=r||{},n=encodeURIComponent,i=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;if("function"!=typeof n)throw new TypeError("option encode is invalid");if(!i.test(e))throw new TypeError("argument name is invalid");const o=n(t);if(o&&!i.test(o))throw new TypeError("argument val is invalid");let a=e+"="+o;if(null!=s.maxAge){const e=s.maxAge-0;if(isNaN(e)||!isFinite(e))throw new TypeError("option maxAge is invalid");a+="; Max-Age="+Math.floor(e)}if(s.domain){if(!i.test(s.domain))throw new TypeError("option domain is invalid");a+="; Domain="+s.domain}if(s.path){if(!i.test(s.path))throw new TypeError("option path is invalid");a+="; Path="+s.path}if(s.expires){if("function"!=typeof s.expires.toUTCString)throw new TypeError("option expires is invalid");a+="; Expires="+s.expires.toUTCString()}if(s.httpOnly&&(a+="; HttpOnly"),s.secure&&(a+="; Secure"),s.sameSite)switch("string"==typeof s.sameSite?s.sameSite.toLowerCase():s.sameSite){case"lax":a+="; SameSite=Lax";break;case"strict":a+="; SameSite=Strict";break;case"none":a+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return a}(r.name,r.value,{maxAge:r.maxAge,expires:new Date(Date.now()+1e3*r.maxAge),httpOnly:!0,secure:s,path:null!==(n=r.path)&&void 0!==n?n:"/",domain:null!==(i=r.domain)&&void 0!==i?i:"",sameSite:null!==(o=r.sameSite)&&void 0!==o?o:"lax"});var r,s,n,i,o})),n=t.getHeader("Set-Cookie");n&&(n instanceof Array?Array.prototype.push.apply(s,n):"string"==typeof n&&s.push(n)),t.setHeader("Set-Cookie",s)}function f(e,t,r){d(e,t,[r])}function p(e){return Math.round(Date.now()/1e3)+e}const m=()=>"undefined"!=typeof window;function y(e,t){var r;t||(t=(null===(r=null===window||void 0===window?void 0:window.location)||void 0===r?void 0:r.href)||""),e=e.replace(/[\[\]]/g,"\\$&");const s=new RegExp("[?&#]"+e+"(=([^&#]*)|&|#|$)").exec(t);return s?s[2]?decodeURIComponent(s[2].replace(/\+/g," ")):"":null}var v=function(e,t,r,s){return new(r||(r=Promise))((function(n,i){function o(e){try{h(s.next(e))}catch(e){i(e)}}function a(e){try{h(s.throw(e))}catch(e){i(e)}}function h(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}h((s=s.apply(e,t||[])).next())}))};class g{constructor({url:e="",headers:t={},cookieOptions:r,fetch:s}){this.url=e,this.headers=t,this.cookieOptions=Object.assign(Object.assign({},l),r),this.fetch=s}createUser(e){return v(this,void 0,void 0,(function*(){try{return{data:yield c(this.fetch,this.url+"/admin/users",e,{headers:this.headers}),error:null}}catch(e){return{data:null,error:e}}}))}listUsers(){return v(this,void 0,void 0,(function*(){try{return{data:(yield h(this.fetch,this.url+"/admin/users",{headers:this.headers})).users,error:null}}catch(e){return{data:null,error:e}}}))}signUpWithEmail(e,t,r={}){return v(this,void 0,void 0,(function*(){try{const s=Object.assign({},this.headers);let n="";r.redirectTo&&(n="?redirect_to="+encodeURIComponent(r.redirectTo));const i=yield c(this.fetch,`${this.url}/signup${n}`,{email:e,password:t,data:r.data},{headers:s}),o=Object.assign({},i);return o.expires_in&&(o.expires_at=p(i.expires_in)),{data:o,error:null}}catch(e){return{data:null,error:e}}}))}signInWithEmail(e,t,r={}){return v(this,void 0,void 0,(function*(){try{const s=Object.assign({},this.headers);let n="?grant_type=password";r.redirectTo&&(n+="&redirect_to="+encodeURIComponent(r.redirectTo));const i=yield c(this.fetch,`${this.url}/token${n}`,{email:e,password:t},{headers:s}),o=Object.assign({},i);return o.expires_in&&(o.expires_at=p(i.expires_in)),{data:o,error:null}}catch(e){return{data:null,error:e}}}))}signUpWithPhone(e,t,r={}){return v(this,void 0,void 0,(function*(){try{const s=Object.assign({},this.headers),n=yield c(this.fetch,this.url+"/signup",{phone:e,password:t,data:r.data},{headers:s}),i=Object.assign({},n);return i.expires_in&&(i.expires_at=p(n.expires_in)),{data:i,error:null}}catch(e){return{data:null,error:e}}}))}signInWithPhone(e,t){return v(this,void 0,void 0,(function*(){try{const r=Object.assign({},this.headers),s="?grant_type=password",n=yield c(this.fetch,`${this.url}/token${s}`,{phone:e,password:t},{headers:r}),i=Object.assign({},n);return i.expires_in&&(i.expires_at=p(n.expires_in)),{data:i,error:null}}catch(e){return{data:null,error:e}}}))}sendMagicLinkEmail(e,t={}){return v(this,void 0,void 0,(function*(){try{const r=Object.assign({},this.headers);let s="";return t.redirectTo&&(s+="?redirect_to="+encodeURIComponent(t.redirectTo)),{data:yield c(this.fetch,`${this.url}/magiclink${s}`,{email:e},{headers:r}),error:null}}catch(e){return{data:null,error:e}}}))}sendMobileOTP(e){return v(this,void 0,void 0,(function*(){try{const t=Object.assign({},this.headers);return{data:yield c(this.fetch,this.url+"/otp",{phone:e},{headers:t}),error:null}}catch(e){return{data:null,error:e}}}))}verifyMobileOTP(e,t,r={}){return v(this,void 0,void 0,(function*(){try{const s=Object.assign({},this.headers);return{data:yield c(this.fetch,this.url+"/verify",{phone:e,token:t,type:"sms",redirect_to:r.redirectTo},{headers:s}),error:null}}catch(e){return{data:null,error:e}}}))}inviteUserByEmail(e,t={}){return v(this,void 0,void 0,(function*(){try{const r=Object.assign({},this.headers);let s="";return t.redirectTo&&(s+="?redirect_to="+encodeURIComponent(t.redirectTo)),{data:yield c(this.fetch,`${this.url}/invite${s}`,{email:e,data:t.data},{headers:r}),error:null}}catch(e){return{data:null,error:e}}}))}resetPasswordForEmail(e,t={}){return v(this,void 0,void 0,(function*(){try{const r=Object.assign({},this.headers);let s="";return t.redirectTo&&(s+="?redirect_to="+encodeURIComponent(t.redirectTo)),{data:yield c(this.fetch,`${this.url}/recover${s}`,{email:e},{headers:r}),error:null}}catch(e){return{data:null,error:e}}}))}_createRequestHeaders(e){const t=Object.assign({},this.headers);return t.Authorization="Bearer "+e,t}signOut(e){return v(this,void 0,void 0,(function*(){try{return yield c(this.fetch,this.url+"/logout",{},{headers:this._createRequestHeaders(e),noResolveJson:!0}),{error:null}}catch(e){return{error:e}}}))}getUrlForProvider(e,t){const r=["provider="+encodeURIComponent(e)];return(null==t?void 0:t.redirectTo)&&r.push("redirect_to="+encodeURIComponent(t.redirectTo)),(null==t?void 0:t.scopes)&&r.push("scopes="+encodeURIComponent(t.scopes)),`${this.url}/authorize?${r.join("&")}`}getUser(e){return v(this,void 0,void 0,(function*(){try{const t=yield h(this.fetch,this.url+"/user",{headers:this._createRequestHeaders(e)});return{user:t,data:t,error:null}}catch(e){return{user:null,data:null,error:e}}}))}updateUser(e,t){return v(this,void 0,void 0,(function*(){try{const r=yield function(e,t,r,s){return i(this,void 0,void 0,(function*(){return a(e,"PUT",t,s,r)}))}(this.fetch,this.url+"/user",t,{headers:this._createRequestHeaders(e)});return{user:r,data:r,error:null}}catch(e){return{user:null,data:null,error:e}}}))}deleteUser(e,t){return v(this,void 0,void 0,(function*(){try{const r=yield function(e,t,r,s){return i(this,void 0,void 0,(function*(){return a(e,"DELETE",t,s,r)}))}(this.fetch,`${this.url}/admin/users/${e}`,{},{headers:this._createRequestHeaders(t)});return{user:r,data:r,error:null}}catch(e){return{user:null,data:null,error:e}}}))}refreshAccessToken(e){return v(this,void 0,void 0,(function*(){try{const t=yield c(this.fetch,this.url+"/token?grant_type=refresh_token",{refresh_token:e},{headers:this.headers}),r=Object.assign({},t);return r.expires_in&&(r.expires_at=p(t.expires_in)),{data:r,error:null}}catch(e){return{data:null,error:e}}}))}setAuthCookie(e,t){"POST"!==e.method&&(t.setHeader("Allow","POST"),t.status(405).end("Method Not Allowed"));const{event:r,session:s}=e.body;if(!r)throw new Error("Auth event missing!");if("SIGNED_IN"===r){if(!s)throw new Error("Auth session missing!");f(e,t,{name:this.cookieOptions.name,value:s.access_token,domain:this.cookieOptions.domain,maxAge:this.cookieOptions.lifetime,path:this.cookieOptions.path,sameSite:this.cookieOptions.sameSite})}"SIGNED_OUT"===r&&function(e,t,r){f(e,t,{name:r,value:"",maxAge:-1})}(e,t,this.cookieOptions.name),t.status(200).json({})}getUserByCookie(e){return v(this,void 0,void 0,(function*(){try{if(!e.cookies)throw new Error("Not able to parse cookies! When using Express make sure the cookie-parser middleware is in use!");if(!e.cookies[this.cookieOptions.name])throw new Error("No cookie found!");const t=e.cookies[this.cookieOptions.name],{user:r,error:s}=yield this.getUser(t);if(s)throw s;return{token:t,user:r,data:r,error:null}}catch(e){return{token:null,user:null,data:null,error:e}}}))}generateLink(e,t,r={}){return v(this,void 0,void 0,(function*(){try{return{data:yield c(this.fetch,this.url+"/admin/generate_link",{type:e,email:t,password:r.password,data:r.data,redirect_to:r.redirectTo},{headers:this.headers}),error:null}}catch(e){return{data:null,error:e}}}))}}var b=function(e,t,r,s){return new(r||(r=Promise))((function(n,i){function o(e){try{h(s.next(e))}catch(e){i(e)}}function a(e){try{h(s.throw(e))}catch(e){i(e)}}function h(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}h((s=s.apply(e,t||[])).next())}))};!function(){if("object"!=typeof globalThis)try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch(e){"undefined"!=typeof self&&(self.globalThis=self)}}();const _={url:"http://localhost:9999",autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:{"X-Client-Info":"gotrue-js/1.21.0"}};class w{constructor(e){this.stateChangeEmitters=new Map;const t=Object.assign(Object.assign({},_),e);this.currentUser=null,this.currentSession=null,this.autoRefreshToken=t.autoRefreshToken,this.persistSession=t.persistSession,this.localStorage=t.localStorage||globalThis.localStorage,this.api=new g({url:t.url,headers:t.headers,cookieOptions:t.cookieOptions,fetch:t.fetch}),this._recoverSession(),this._recoverAndRefresh(),t.detectSessionInUrl&&m()&&y("access_token")&&this.getSessionFromUrl({storeSession:!0}).then((({error:e})=>{e&&console.error("Error getting session from URL.",e)}))}signUp({email:e,password:t,phone:r},s={}){return b(this,void 0,void 0,(function*(){try{this._removeSession();const{data:n,error:i}=r&&t?yield this.api.signUpWithPhone(r,t,{data:s.data}):yield this.api.signUpWithEmail(e,t,{redirectTo:s.redirectTo,data:s.data});if(i)throw i;if(!n)throw"An error occurred on sign up.";let o=null,a=null;return n.access_token&&(o=n,a=o.user,this._saveSession(o),this._notifyAllSubscribers("SIGNED_IN")),n.id&&(a=n),{data:n,user:a,session:o,error:null}}catch(e){return{data:null,user:null,session:null,error:e}}}))}signIn({email:e,phone:t,password:r,refreshToken:s,provider:n},i={}){return b(this,void 0,void 0,(function*(){try{if(this._removeSession(),e&&!r){const{error:t}=yield this.api.sendMagicLinkEmail(e,{redirectTo:i.redirectTo});return{data:null,user:null,session:null,error:t}}if(e&&r)return this._handleEmailSignIn(e,r,{redirectTo:i.redirectTo});if(t&&!r){const{error:e}=yield this.api.sendMobileOTP(t);return{data:null,user:null,session:null,error:e}}if(t&&r)return this._handlePhoneSignIn(t,r);if(s){const{error:e}=yield this._callRefreshToken(s);if(e)throw e;return{data:this.currentSession,user:this.currentUser,session:this.currentSession,error:null}}if(n)return this._handleProviderSignIn(n,{redirectTo:i.redirectTo,scopes:i.scopes});throw new Error("You must provide either an email, phone number or a third-party provider.")}catch(e){return{data:null,user:null,session:null,error:e}}}))}verifyOTP({phone:e,token:t},r={}){return b(this,void 0,void 0,(function*(){try{this._removeSession();const{data:s,error:n}=yield this.api.verifyMobileOTP(e,t,r);if(n)throw n;if(!s)throw"An error occurred on token verification.";let i=null,o=null;return s.access_token&&(i=s,o=i.user,this._saveSession(i),this._notifyAllSubscribers("SIGNED_IN")),s.id&&(o=s),{data:s,user:o,session:i,error:null}}catch(e){return{data:null,user:null,session:null,error:e}}}))}user(){return this.currentUser}session(){return this.currentSession}refreshSession(){var e;return b(this,void 0,void 0,(function*(){try{if(!(null===(e=this.currentSession)||void 0===e?void 0:e.access_token))throw new Error("Not logged in.");const{error:t}=yield this._callRefreshToken();if(t)throw t;return{data:this.currentSession,user:this.currentUser,error:null}}catch(e){return{data:null,user:null,error:e}}}))}update(e){var t;return b(this,void 0,void 0,(function*(){try{if(!(null===(t=this.currentSession)||void 0===t?void 0:t.access_token))throw new Error("Not logged in.");const{user:r,error:s}=yield this.api.updateUser(this.currentSession.access_token,e);if(s)throw s;if(!r)throw Error("Invalid user data.");const n=Object.assign(Object.assign({},this.currentSession),{user:r});return this._saveSession(n),this._notifyAllSubscribers("USER_UPDATED"),{data:r,user:r,error:null}}catch(e){return{data:null,user:null,error:e}}}))}setSession(e){return b(this,void 0,void 0,(function*(){try{if(!e)throw new Error("No current session.");const{data:t,error:r}=yield this.api.refreshAccessToken(e);return r?{session:null,error:r}:(this._saveSession(t),this._notifyAllSubscribers("SIGNED_IN"),{session:t,error:null})}catch(e){return{error:e,session:null}}}))}setAuth(e){return this.currentSession=Object.assign(Object.assign({},this.currentSession),{access_token:e,token_type:"bearer",user:null}),this.currentSession}getSessionFromUrl(e){return b(this,void 0,void 0,(function*(){try{if(!m())throw new Error("No browser detected.");const t=y("error_description");if(t)throw new Error(t);const r=y("provider_token"),s=y("access_token");if(!s)throw new Error("No access_token detected.");const n=y("expires_in");if(!n)throw new Error("No expires_in detected.");const i=y("refresh_token");if(!i)throw new Error("No refresh_token detected.");const o=y("token_type");if(!o)throw new Error("No token_type detected.");const a=Math.round(Date.now()/1e3)+parseInt(n),{user:h,error:c}=yield this.api.getUser(s);if(c)throw c;const u={provider_token:r,access_token:s,expires_in:parseInt(n),expires_at:a,refresh_token:i,token_type:o,user:h};return(null==e?void 0:e.storeSession)&&(this._saveSession(u),this._notifyAllSubscribers("SIGNED_IN"),"recovery"===y("type")&&this._notifyAllSubscribers("PASSWORD_RECOVERY")),window.location.hash="",{data:u,error:null}}catch(e){return{data:null,error:e}}}))}signOut(){var e;return b(this,void 0,void 0,(function*(){const t=null===(e=this.currentSession)||void 0===e?void 0:e.access_token;if(this._removeSession(),this._notifyAllSubscribers("SIGNED_OUT"),t){const{error:e}=yield this.api.signOut(t);if(e)return{error:e}}return{error:null}}))}onAuthStateChange(e){try{const t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})),r={id:t,callback:e,unsubscribe:()=>{this.stateChangeEmitters.delete(t)}};return this.stateChangeEmitters.set(t,r),{data:r,error:null}}catch(e){return{data:null,error:e}}}_handleEmailSignIn(e,t,r={}){var s,n;return b(this,void 0,void 0,(function*(){try{const{data:i,error:o}=yield this.api.signInWithEmail(e,t,{redirectTo:r.redirectTo});return o||!i?{data:null,user:null,session:null,error:o}:(((null===(s=null==i?void 0:i.user)||void 0===s?void 0:s.confirmed_at)||(null===(n=null==i?void 0:i.user)||void 0===n?void 0:n.email_confirmed_at))&&(this._saveSession(i),this._notifyAllSubscribers("SIGNED_IN")),{data:i,user:i.user,session:i,error:null})}catch(e){return{data:null,user:null,session:null,error:e}}}))}_handlePhoneSignIn(e,t){var r;return b(this,void 0,void 0,(function*(){try{const{data:s,error:n}=yield this.api.signInWithPhone(e,t);return n||!s?{data:null,user:null,session:null,error:n}:((null===(r=null==s?void 0:s.user)||void 0===r?void 0:r.phone_confirmed_at)&&(this._saveSession(s),this._notifyAllSubscribers("SIGNED_IN")),{data:s,user:s.user,session:s,error:null})}catch(e){return{data:null,user:null,session:null,error:e}}}))}_handleProviderSignIn(e,t={}){const r=this.api.getUrlForProvider(e,{redirectTo:t.redirectTo,scopes:t.scopes});try{return m()&&(window.location.href=r),{provider:e,url:r,data:null,session:null,user:null,error:null}}catch(t){return r?{provider:e,url:r,data:null,session:null,user:null,error:null}:{data:null,user:null,session:null,error:t}}}_recoverSession(){var e;try{const t=m()&&(null===(e=this.localStorage)||void 0===e?void 0:e.getItem(u));if(!t||"string"!=typeof t)return null;const r=JSON.parse(t),{currentSession:s,expiresAt:n}=r;n>=Math.round(Date.now()/1e3)&&(null==s?void 0:s.user)&&(this._saveSession(s),this._notifyAllSubscribers("SIGNED_IN"))}catch(e){console.log("error",e)}}_recoverAndRefresh(){return b(this,void 0,void 0,(function*(){try{const e=m()&&(yield this.localStorage.getItem(u));if(!e)return null;const t=JSON.parse(e),{currentSession:r,expiresAt:s}=t;if(s<Math.round(Date.now()/1e3))if(this.autoRefreshToken&&r.refresh_token){const{error:e}=yield this._callRefreshToken(r.refresh_token);e&&(console.log(e.message),yield this._removeSession())}else this._removeSession();else r&&r.user?(this._saveSession(r),this._notifyAllSubscribers("SIGNED_IN")):(console.log("Current session is missing data."),this._removeSession())}catch(e){return console.error(e),null}}))}_callRefreshToken(e){var t;return void 0===e&&(e=null===(t=this.currentSession)||void 0===t?void 0:t.refresh_token),b(this,void 0,void 0,(function*(){try{if(!e)throw new Error("No current session.");const{data:t,error:r}=yield this.api.refreshAccessToken(e);if(r)throw r;if(!t)throw Error("Invalid session data.");return this._saveSession(t),this._notifyAllSubscribers("SIGNED_IN"),{data:t,error:null}}catch(e){return{data:null,error:e}}}))}_notifyAllSubscribers(e){this.stateChangeEmitters.forEach((t=>t.callback(e,this.currentSession)))}_saveSession(e){this.currentSession=e,this.currentUser=e.user;const t=e.expires_at;if(t){const e=t-Math.round(Date.now()/1e3),r=e>60?60:.5;this._startAutoRefreshToken(1e3*(e-r))}this.persistSession&&e.expires_at&&this._persistSession(this.currentSession)}_persistSession(e){const t={currentSession:e,expiresAt:e.expires_at};m()&&this.localStorage.setItem(u,JSON.stringify(t))}_removeSession(){return b(this,void 0,void 0,(function*(){this.currentSession=null,this.currentUser=null,this.refreshTokenTimer&&clearTimeout(this.refreshTokenTimer),m()&&(yield this.localStorage.removeItem(u))}))}_startAutoRefreshToken(e){this.refreshTokenTimer&&clearTimeout(this.refreshTokenTimer),e<=0||!this.autoRefreshToken||(this.refreshTokenTimer=setTimeout((()=>this._callRefreshToken()),e),"function"==typeof this.refreshTokenTimer.unref&&this.refreshTokenTimer.unref())}}},501:(e,t,r)=>{"use strict";r.r(t),r.d(t,{PostgrestBuilder:()=>i,PostgrestClient:()=>l,PostgrestFilterBuilder:()=>a,PostgrestQueryBuilder:()=>h});var s=r(98),n=r.n(s);class i{constructor(e){this.shouldThrowOnError=!1,Object.assign(this,e),this.fetch=e.fetch||n()}throwOnError(){return this.shouldThrowOnError=!0,this}then(e,t){void 0===this.schema||(["GET","HEAD"].includes(this.method)?this.headers["Accept-Profile"]=this.schema:this.headers["Content-Profile"]=this.schema),"GET"!==this.method&&"HEAD"!==this.method&&(this.headers["Content-Type"]="application/json");let r=this.fetch(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then((e=>{return t=this,r=void 0,n=function*(){var t,r,s;let n=null,i=null,o=null;if(e.ok){const n=null===(t=this.headers.Prefer)||void 0===t?void 0:t.split(",").includes("return=minimal");if("HEAD"!==this.method&&!n){const t=yield e.text();t&&(i="text/csv"===this.headers.Accept?t:JSON.parse(t))}const a=null===(r=this.headers.Prefer)||void 0===r?void 0:r.match(/count=(exact|planned|estimated)/),h=null===(s=e.headers.get("content-range"))||void 0===s?void 0:s.split("/");a&&h&&h.length>1&&(o=parseInt(h[1]))}else if(n=yield e.json(),n&&this.shouldThrowOnError)throw n;return{error:n,data:i,count:o,status:e.status,statusText:e.statusText,body:i}},new((s=void 0)||(s=Promise))((function(e,i){function o(e){try{h(n.next(e))}catch(e){i(e)}}function a(e){try{h(n.throw(e))}catch(e){i(e)}}function h(t){var r;t.done?e(t.value):(r=t.value,r instanceof s?r:new s((function(e){e(r)}))).then(o,a)}h((n=n.apply(t,r||[])).next())}));var t,r,s,n}));return this.shouldThrowOnError||(r=r.catch((e=>({error:{message:"FetchError: "+e.message,details:"",hint:"",code:e.code||""},data:null,body:null,count:null,status:400,statusText:"Bad Request"})))),r.then(e,t)}}class o extends i{select(e="*"){let t=!1;const r=e.split("").map((e=>/\s/.test(e)&&!t?"":('"'===e&&(t=!t),e))).join("");return this.url.searchParams.set("select",r),this}order(e,{ascending:t=!0,nullsFirst:r=!1,foreignTable:s}={}){const n=void 0===s?"order":s+".order",i=this.url.searchParams.get(n);return this.url.searchParams.set(n,`${i?i+",":""}${e}.${t?"asc":"desc"}.${r?"nullsfirst":"nullslast"}`),this}limit(e,{foreignTable:t}={}){const r=void 0===t?"limit":t+".limit";return this.url.searchParams.set(r,""+e),this}range(e,t,{foreignTable:r}={}){const s=void 0===r?"offset":r+".offset",n=void 0===r?"limit":r+".limit";return this.url.searchParams.set(s,""+e),this.url.searchParams.set(n,""+(t-e+1)),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.Accept="application/vnd.pgrst.object+json",this}maybeSingle(){this.headers.Accept="application/vnd.pgrst.object+json";const e=new o(this);return e.then=(e,t)=>this.then((t=>{var r,s;return(null===(s=null===(r=t.error)||void 0===r?void 0:r.details)||void 0===s?void 0:s.includes("Results contain 0 rows"))?e({error:null,data:null,count:t.count,status:200,statusText:"OK",body:null}):e(t)}),t),e}csv(){return this.headers.Accept="text/csv",this}}class a extends o{constructor(){super(...arguments),this.cs=this.contains,this.cd=this.containedBy,this.sl=this.rangeLt,this.sr=this.rangeGt,this.nxl=this.rangeGte,this.nxr=this.rangeLte,this.adj=this.rangeAdjacent,this.ov=this.overlaps}not(e,t,r){return this.url.searchParams.append(""+e,`not.${t}.${r}`),this}or(e,{foreignTable:t}={}){const r=void 0===t?"or":t+".or";return this.url.searchParams.append(r,`(${e})`),this}eq(e,t){return this.url.searchParams.append(""+e,"eq."+t),this}neq(e,t){return this.url.searchParams.append(""+e,"neq."+t),this}gt(e,t){return this.url.searchParams.append(""+e,"gt."+t),this}gte(e,t){return this.url.searchParams.append(""+e,"gte."+t),this}lt(e,t){return this.url.searchParams.append(""+e,"lt."+t),this}lte(e,t){return this.url.searchParams.append(""+e,"lte."+t),this}like(e,t){return this.url.searchParams.append(""+e,"like."+t),this}ilike(e,t){return this.url.searchParams.append(""+e,"ilike."+t),this}is(e,t){return this.url.searchParams.append(""+e,"is."+t),this}in(e,t){const r=t.map((e=>"string"==typeof e&&new RegExp("[,()]").test(e)?`"${e}"`:""+e)).join(",");return this.url.searchParams.append(""+e,`in.(${r})`),this}contains(e,t){return"string"==typeof t?this.url.searchParams.append(""+e,"cs."+t):Array.isArray(t)?this.url.searchParams.append(""+e,`cs.{${t.join(",")}}`):this.url.searchParams.append(""+e,"cs."+JSON.stringify(t)),this}containedBy(e,t){return"string"==typeof t?this.url.searchParams.append(""+e,"cd."+t):Array.isArray(t)?this.url.searchParams.append(""+e,`cd.{${t.join(",")}}`):this.url.searchParams.append(""+e,"cd."+JSON.stringify(t)),this}rangeLt(e,t){return this.url.searchParams.append(""+e,"sl."+t),this}rangeGt(e,t){return this.url.searchParams.append(""+e,"sr."+t),this}rangeGte(e,t){return this.url.searchParams.append(""+e,"nxl."+t),this}rangeLte(e,t){return this.url.searchParams.append(""+e,"nxr."+t),this}rangeAdjacent(e,t){return this.url.searchParams.append(""+e,"adj."+t),this}overlaps(e,t){return"string"==typeof t?this.url.searchParams.append(""+e,"ov."+t):this.url.searchParams.append(""+e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:s=null}={}){let n="";"plain"===s?n="pl":"phrase"===s?n="ph":"websearch"===s&&(n="w");const i=void 0===r?"":`(${r})`;return this.url.searchParams.append(""+e,`${n}fts${i}.${t}`),this}fts(e,t,{config:r}={}){const s=void 0===r?"":`(${r})`;return this.url.searchParams.append(""+e,`fts${s}.${t}`),this}plfts(e,t,{config:r}={}){const s=void 0===r?"":`(${r})`;return this.url.searchParams.append(""+e,`plfts${s}.${t}`),this}phfts(e,t,{config:r}={}){const s=void 0===r?"":`(${r})`;return this.url.searchParams.append(""+e,`phfts${s}.${t}`),this}wfts(e,t,{config:r}={}){const s=void 0===r?"":`(${r})`;return this.url.searchParams.append(""+e,`wfts${s}.${t}`),this}filter(e,t,r){return this.url.searchParams.append(""+e,`${t}.${r}`),this}match(e){return Object.keys(e).forEach((t=>{this.url.searchParams.append(""+t,"eq."+e[t])})),this}}class h extends i{constructor(e,{headers:t={},schema:r,fetch:s}={}){super({fetch:s}),this.url=new URL(e),this.headers=Object.assign({},t),this.schema=r}select(e="*",{head:t=!1,count:r=null}={}){this.method="GET";let s=!1;const n=e.split("").map((e=>/\s/.test(e)&&!s?"":('"'===e&&(s=!s),e))).join("");return this.url.searchParams.set("select",n),r&&(this.headers.Prefer="count="+r),t&&(this.method="HEAD"),new a(this)}insert(e,{upsert:t=!1,onConflict:r,returning:s="representation",count:n=null}={}){this.method="POST";const i=["return="+s];if(t&&i.push("resolution=merge-duplicates"),t&&void 0!==r&&this.url.searchParams.set("on_conflict",r),this.body=e,n&&i.push("count="+n),this.headers.Prefer=i.join(","),Array.isArray(e)){const t=e.reduce(((e,t)=>e.concat(Object.keys(t))),[]);if(t.length>0){const e=[...new Set(t)].map((e=>`"${e}"`));this.url.searchParams.set("columns",e.join(","))}}return new a(this)}upsert(e,{onConflict:t,returning:r="representation",count:s=null,ignoreDuplicates:n=!1}={}){this.method="POST";const i=[`resolution=${n?"ignore":"merge"}-duplicates`,"return="+r];return void 0!==t&&this.url.searchParams.set("on_conflict",t),this.body=e,s&&i.push("count="+s),this.headers.Prefer=i.join(","),new a(this)}update(e,{returning:t="representation",count:r=null}={}){this.method="PATCH";const s=["return="+t];return this.body=e,r&&s.push("count="+r),this.headers.Prefer=s.join(","),new a(this)}delete({returning:e="representation",count:t=null}={}){this.method="DELETE";const r=["return="+e];return t&&r.push("count="+t),this.headers.Prefer=r.join(","),new a(this)}}class c extends i{constructor(e,{headers:t={},schema:r,fetch:s}={}){super({fetch:s}),this.url=new URL(e),this.headers=Object.assign({},t),this.schema=r}rpc(e,{head:t=!1,count:r=null}={}){return t?(this.method="HEAD",e&&Object.entries(e).forEach((([e,t])=>{this.url.searchParams.append(e,t)}))):(this.method="POST",this.body=e),r&&(void 0!==this.headers.Prefer?this.headers.Prefer+=",count="+r:this.headers.Prefer="count="+r),new a(this)}}const u={"X-Client-Info":"postgrest-js/0.35.0"};class l{constructor(e,{headers:t={},schema:r,fetch:s}={}){this.url=e,this.headers=Object.assign(Object.assign({},u),t),this.schema=r,this.fetch=s}auth(e){return this.headers.Authorization="Bearer "+e,this}from(e){const t=`${this.url}/${e}`;return new h(t,{headers:this.headers,schema:this.schema,fetch:this.fetch})}rpc(e,t,{head:r=!1,count:s=null}={}){const n=`${this.url}/rpc/${e}`;return new c(n,{headers:this.headers,schema:this.schema,fetch:this.fetch}).rpc(t,{head:r,count:s})}}},498:(e,t,r)=>{"use strict";r.r(t),r.d(t,{RealtimeClient:()=>E,RealtimeSubscription:()=>w,Transformers:()=>n});var s,n={};r.r(n),r.d(n,{PostgresTypes:()=>s,convertCell:()=>a,convertChangeData:()=>i,convertColumn:()=>o,toArray:()=>d,toBoolean:()=>c,toJson:()=>l,toNumber:()=>u,toTimestampString:()=>f}),function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"}(s||(s={}));const i=(e,t,r={})=>{var s;const n=null!==(s=r.skipTypes)&&void 0!==s?s:[];return Object.keys(t).reduce(((r,s)=>(r[s]=o(s,e,t,n),r)),{})},o=(e,t,r,s)=>{const n=t.find((t=>t.name===e)),i=null==n?void 0:n.type,o=r[e];return i&&!s.includes(i)?a(i,o):h(o)},a=(e,t)=>{if("_"===e.charAt(0)){const r=e.slice(1,e.length);return d(t,r)}switch(e){case s.bool:return c(t);case s.float4:case s.float8:case s.int2:case s.int4:case s.int8:case s.numeric:case s.oid:return u(t);case s.json:case s.jsonb:return l(t);case s.timestamp:return f(t);case s.abstime:case s.date:case s.daterange:case s.int4range:case s.int8range:case s.money:case s.reltime:case s.text:case s.time:case s.timestamptz:case s.timetz:case s.tsrange:case s.tstzrange:default:return h(t)}},h=e=>e,c=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},u=e=>{if("string"==typeof e){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},l=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(t){return console.log("JSON parse error: "+t),e}return e},d=(e,t)=>{if("string"!=typeof e)return e;const r=e.length-1,s=e[r];if("{"===e[0]&&"}"===s){let s;const n=e.slice(1,r);try{s=JSON.parse("["+n+"]")}catch(e){s=n?n.split(","):[]}return s.map((e=>a(t,e)))}return e},f=e=>"string"==typeof e?e.replace(" ","T"):e,p={"X-Client-Info":"realtime-js/1.2.1"};var m,y,v,g;!function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"}(m||(m={})),function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"}(y||(y={})),function(e){e.close="phx_close",e.error="phx_error",e.join="phx_join",e.reply="phx_reply",e.leave="phx_leave"}(v||(v={})),function(e){e.websocket="websocket"}(g||(g={}));class b{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=t}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout((()=>{this.tries=this.tries+1,this.callback()}),this.timerCalc(this.tries+1))}}class _{constructor(e,t,r={},s=1e4){this.channel=e,this.event=t,this.payload=r,this.timeout=s,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref}))}receive(e,t){var r;return this._hasReceived(e)&&t(null===(r=this.receivedResp)||void 0===r?void 0:r.response),this.recHooks.push({status:e,callback:t}),this}startTimeout(){this.timeoutTimer||(this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,(e=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=e,this._matchReceive(e)})),this.timeoutTimer=setTimeout((()=>{this.trigger("timeout",{})}),this.timeout))}trigger(e,t){this.refEvent&&this.channel.trigger(this.refEvent,{status:e,response:t})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:t}){this.recHooks.filter((t=>t.status===e)).forEach((e=>e.callback(t)))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}class w{constructor(e,t={},r){this.topic=e,this.params=t,this.socket=r,this.bindings=[],this.state=y.closed,this.joinedOnce=!1,this.pushBuffer=[],this.timeout=this.socket.timeout,this.joinPush=new _(this,v.join,this.params,this.timeout),this.rejoinTimer=new b((()=>this.rejoinUntilConnected()),this.socket.reconnectAfterMs),this.joinPush.receive("ok",(()=>{this.state=y.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach((e=>e.send())),this.pushBuffer=[]})),this.onClose((()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=y.closed,this.socket.remove(this)})),this.onError((e=>{this.isLeaving()||this.isClosed()||(this.socket.log("channel","error "+this.topic,e),this.state=y.errored,this.rejoinTimer.scheduleTimeout())})),this.joinPush.receive("timeout",(()=>{this.isJoining()&&(this.socket.log("channel","timeout "+this.topic,this.joinPush.timeout),this.state=y.errored,this.rejoinTimer.scheduleTimeout())})),this.on(v.reply,((e,t)=>{this.trigger(this.replyEventName(t),e)}))}rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this.rejoin()}subscribe(e=this.timeout){if(this.joinedOnce)throw"tried to subscribe multiple times. 'subscribe' can only be called a single time per channel instance";return this.joinedOnce=!0,this.rejoin(e),this.joinPush}onClose(e){this.on(v.close,e)}onError(e){this.on(v.error,(t=>e(t)))}on(e,t){this.bindings.push({event:e,callback:t})}off(e){this.bindings=this.bindings.filter((t=>t.event!==e))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let s=new _(this,e,t,r);return this.canPush()?s.send():(s.startTimeout(),this.pushBuffer.push(s)),s}unsubscribe(e=this.timeout){this.state=y.leaving;let t=()=>{this.socket.log("channel","leave "+this.topic),this.trigger(v.close,"leave",this.joinRef())};this.joinPush.destroy();let r=new _(this,v.leave,{},e);return r.receive("ok",(()=>t())).receive("timeout",(()=>t())),r.send(),this.canPush()||r.trigger("ok",{}),r}onMessage(e,t,r){return t}isMember(e){return this.topic===e}joinRef(){return this.joinPush.ref}sendJoin(e){this.state=y.joining,this.joinPush.resend(e)}rejoin(e=this.timeout){this.isLeaving()||this.sendJoin(e)}trigger(e,t,r){let{close:s,error:n,leave:i,join:o}=v;if(r&&[s,n,i,o].indexOf(e)>=0&&r!==this.joinRef())return;let a=this.onMessage(e,t,r);if(t&&!a)throw"channel onMessage callbacks must return the payload, modified or unmodified";this.bindings.filter((r=>"*"===r.event?e===(null==t?void 0:t.type):r.event===e)).map((e=>e.callback(a,r)))}replyEventName(e){return"chan_reply_"+e}isClosed(){return this.state===y.closed}isErrored(){return this.state===y.errored}isJoined(){return this.state===y.joined}isJoining(){return this.state===y.joining}isLeaving(){return this.state===y.leaving}}var S=r(840);class T{constructor(){this.HEADER_LENGTH=1}decode(e,t){return e.constructor===ArrayBuffer?t(this._binaryDecode(e)):t("string"==typeof e?JSON.parse(e):{})}_binaryDecode(e){const t=new DataView(e),r=new TextDecoder;return this._decodeBroadcast(e,t,r)}_decodeBroadcast(e,t,r){const s=t.getUint8(1),n=t.getUint8(2);let i=this.HEADER_LENGTH+2;const o=r.decode(e.slice(i,i+s));i+=s;const a=r.decode(e.slice(i,i+n));return i+=n,{ref:null,topic:o,event:a,payload:JSON.parse(r.decode(e.slice(i,e.byteLength)))}}}const x=()=>{};class E{constructor(e,t){this.channels=[],this.endPoint="",this.headers=p,this.params={},this.timeout=1e4,this.transport=S.w3cwebsocket,this.heartbeatIntervalMs=3e4,this.longpollerTimeout=2e4,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.ref=0,this.logger=x,this.conn=null,this.sendBuffer=[],this.serializer=new T,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.endPoint=`${e}/${g.websocket}`,(null==t?void 0:t.params)&&(this.params=t.params),(null==t?void 0:t.headers)&&(this.headers=Object.assign(Object.assign({},this.headers),t.headers)),(null==t?void 0:t.timeout)&&(this.timeout=t.timeout),(null==t?void 0:t.logger)&&(this.logger=t.logger),(null==t?void 0:t.transport)&&(this.transport=t.transport),(null==t?void 0:t.heartbeatIntervalMs)&&(this.heartbeatIntervalMs=t.heartbeatIntervalMs),(null==t?void 0:t.longpollerTimeout)&&(this.longpollerTimeout=t.longpollerTimeout),this.reconnectAfterMs=(null==t?void 0:t.reconnectAfterMs)?t.reconnectAfterMs:e=>[1e3,2e3,5e3,1e4][e-1]||1e4,this.encode=(null==t?void 0:t.encode)?t.encode:(e,t)=>t(JSON.stringify(e)),this.decode=(null==t?void 0:t.decode)?t.decode:this.serializer.decode.bind(this.serializer),this.reconnectTimer=new b((()=>{return e=this,t=void 0,s=function*(){yield this.disconnect(),this.connect()},new((r=void 0)||(r=Promise))((function(n,i){function o(e){try{h(s.next(e))}catch(e){i(e)}}function a(e){try{h(s.throw(e))}catch(e){i(e)}}function h(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}h((s=s.apply(e,t||[])).next())}));var e,t,r,s}),this.reconnectAfterMs)}connect(){this.conn||(this.conn=new this.transport(this.endPointURL(),[],null,this.headers),this.conn&&(this.conn.binaryType="arraybuffer",this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e)))}disconnect(e,t){return new Promise(((r,s)=>{try{this.conn&&(this.conn.onclose=function(){},e?this.conn.close(e,t||""):this.conn.close(),this.conn=null,this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.reset()),r({error:null,data:!0})}catch(e){r({error:e,data:!1})}}))}log(e,t,r){this.logger(e,t,r)}onOpen(e){this.stateChangeCallbacks.open.push(e)}onClose(e){this.stateChangeCallbacks.close.push(e)}onError(e){this.stateChangeCallbacks.error.push(e)}onMessage(e){this.stateChangeCallbacks.message.push(e)}connectionState(){switch(this.conn&&this.conn.readyState){case m.connecting:return"connecting";case m.open:return"open";case m.closing:return"closing";default:return"closed"}}isConnected(){return"open"===this.connectionState()}remove(e){this.channels=this.channels.filter((t=>t.joinRef()!==e.joinRef()))}channel(e,t={}){let r=new w(e,t,this);return this.channels.push(r),r}push(e){let{topic:t,event:r,payload:s,ref:n}=e,i=()=>{this.encode(e,(e=>{var t;null===(t=this.conn)||void 0===t||t.send(e)}))};this.log("push",`${t} ${r} (${n})`,s),this.isConnected()?i():this.sendBuffer.push(i)}onConnMessage(e){this.decode(e.data,(e=>{let{topic:t,event:r,payload:s,ref:n}=e;n&&n===this.pendingHeartbeatRef?this.pendingHeartbeatRef=null:r===(null==s?void 0:s.type)&&this._resetHeartbeat(),this.log("receive",`${s.status||""} ${t} ${r} ${n&&"("+n+")"||""}`,s),this.channels.filter((e=>e.isMember(t))).forEach((e=>e.trigger(r,s,n))),this.stateChangeCallbacks.message.forEach((t=>t(e)))}))}endPointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:"1.0.0"}))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_onConnOpen(){this.log("transport","connected to "+this.endPointURL()),this._flushSendBuffer(),this.reconnectTimer.reset(),this._resetHeartbeat(),this.stateChangeCallbacks.open.forEach((e=>e()))}_onConnClose(e){this.log("transport","close",e),this._triggerChanError(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach((t=>t(e)))}_onConnError(e){this.log("transport",e.message),this._triggerChanError(),this.stateChangeCallbacks.error.forEach((t=>t(e)))}_triggerChanError(){this.channels.forEach((e=>e.trigger(v.error)))}_appendParams(e,t){if(0===Object.keys(t).length)return e;const r=e.match(/\?/)?"&":"?";return`${e}${r}${new URLSearchParams(t)}`}_flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach((e=>e())),this.sendBuffer=[])}_resetHeartbeat(){this.pendingHeartbeatRef=null,this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval((()=>this._sendHeartbeat()),this.heartbeatIntervalMs)}_sendHeartbeat(){var e;if(this.isConnected()){if(this.pendingHeartbeatRef)return this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),void(null===(e=this.conn)||void 0===e||e.close(1e3,"hearbeat timeout"));this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef})}}}},122:(e,t,r)=>{"use strict";r.r(t),r.d(t,{SupabaseStorageClient:()=>v});var s=r(98),n=r.n(s),i=function(e,t,r,s){return new(r||(r=Promise))((function(n,i){function o(e){try{h(s.next(e))}catch(e){i(e)}}function a(e){try{h(s.throw(e))}catch(e){i(e)}}function h(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}h((s=s.apply(e,t||[])).next())}))};const o=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e);function a(e=n(),t,r,s,a,h){return i(this,void 0,void 0,(function*(){return new Promise(((n,i)=>{e(r,((e,t,r,s)=>{const n={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"===e?n:(n.headers=Object.assign({"Content-Type":"application/json"},null==t?void 0:t.headers),n.body=JSON.stringify(s),Object.assign(Object.assign({},n),r))})(t,s,a,h)).then((e=>{if(!e.ok)throw e;return(null==s?void 0:s.noResolveJson)?n(e):e.json()})).then((e=>n(e))).catch((e=>((e,t)=>{if("function"!=typeof e.json)return t(e);e.json().then((r=>t({message:o(r),status:(null==e?void 0:e.status)||500})))})(e,i)))}))}))}function h(e,t,r,s){return i(this,void 0,void 0,(function*(){return a(e,"GET",t,r,s)}))}function c(e,t,r,s,n){return i(this,void 0,void 0,(function*(){return a(e,"POST",t,s,n,r)}))}function u(e,t,r,s,n){return i(this,void 0,void 0,(function*(){return a(e,"DELETE",t,s,n,r)}))}const l={"X-Client-Info":"storage-js/0.0.0"};var d=function(e,t,r,s){return new(r||(r=Promise))((function(n,i){function o(e){try{h(s.next(e))}catch(e){i(e)}}function a(e){try{h(s.throw(e))}catch(e){i(e)}}function h(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}h((s=s.apply(e,t||[])).next())}))},f=function(e,t,r,s){return new(r||(r=Promise))((function(n,i){function o(e){try{h(s.next(e))}catch(e){i(e)}}function a(e){try{h(s.throw(e))}catch(e){i(e)}}function h(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}h((s=s.apply(e,t||[])).next())}))};const p={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},m={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class y{constructor(e,t={},r,s){this.url=e,this.headers=t,this.bucketId=r,this.fetch=s}uploadOrUpdate(e,t,r,s){return f(this,void 0,void 0,(function*(){try{let i;const o=Object.assign(Object.assign({},m),s),a=Object.assign(Object.assign({},this.headers),"POST"===e&&{"x-upsert":String(o.upsert)});"undefined"!=typeof Blob&&r instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),i.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(i=r,i.append("cacheControl",o.cacheControl)):(i=r,a["cache-control"]="max-age="+o.cacheControl,a["content-type"]=o.contentType);const h=this._getFinalPath(t),c=yield n()(`${this.url}/object/${h}`,{method:e,body:i,headers:a});return c.ok?{data:{Key:h},error:null}:{data:null,error:yield c.json()}}catch(e){return{data:null,error:e}}}))}upload(e,t,r){return f(this,void 0,void 0,(function*(){return this.uploadOrUpdate("POST",e,t,r)}))}update(e,t,r){return f(this,void 0,void 0,(function*(){return this.uploadOrUpdate("PUT",e,t,r)}))}move(e,t){return f(this,void 0,void 0,(function*(){try{return{data:yield c(this.fetch,this.url+"/object/move",{bucketId:this.bucketId,sourceKey:e,destinationKey:t},{headers:this.headers}),error:null}}catch(e){return{data:null,error:e}}}))}createSignedUrl(e,t){return f(this,void 0,void 0,(function*(){try{const r=this._getFinalPath(e);let s=yield c(this.fetch,`${this.url}/object/sign/${r}`,{expiresIn:t},{headers:this.headers});const n=`${this.url}${s.signedURL}`;return s={signedURL:n},{data:s,error:null,signedURL:n}}catch(e){return{data:null,error:e,signedURL:null}}}))}download(e){return f(this,void 0,void 0,(function*(){try{const t=this._getFinalPath(e),r=yield h(this.fetch,`${this.url}/object/${t}`,{headers:this.headers,noResolveJson:!0});return{data:yield r.blob(),error:null}}catch(e){return{data:null,error:e}}}))}getPublicUrl(e){try{const t=this._getFinalPath(e),r=`${this.url}/object/public/${t}`;return{data:{publicURL:r},error:null,publicURL:r}}catch(e){return{data:null,error:e,publicURL:null}}}remove(e){return f(this,void 0,void 0,(function*(){try{return{data:yield u(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(e){return{data:null,error:e}}}))}list(e,t,r){return f(this,void 0,void 0,(function*(){try{const s=Object.assign(Object.assign(Object.assign({},p),t),{prefix:e||""});return{data:yield c(this.fetch,`${this.url}/object/list/${this.bucketId}`,s,{headers:this.headers},r),error:null}}catch(e){return{data:null,error:e}}}))}_getFinalPath(e){return`${this.bucketId}/${e}`}}class v extends class{constructor(e,t={},r){this.url=e,this.headers=Object.assign(Object.assign({},l),t),this.fetch=r}listBuckets(){return d(this,void 0,void 0,(function*(){try{return{data:yield h(this.fetch,this.url+"/bucket",{headers:this.headers}),error:null}}catch(e){return{data:null,error:e}}}))}getBucket(e){return d(this,void 0,void 0,(function*(){try{return{data:yield h(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(e){return{data:null,error:e}}}))}createBucket(e,t={public:!1}){return d(this,void 0,void 0,(function*(){try{return{data:(yield c(this.fetch,this.url+"/bucket",{id:e,name:e,public:t.public},{headers:this.headers})).name,error:null}}catch(e){return{data:null,error:e}}}))}updateBucket(e,t){return d(this,void 0,void 0,(function*(){try{return{data:yield function(e,t,r,s,n){return i(this,void 0,void 0,(function*(){return a(e,"PUT",t,s,undefined,r)}))}(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:t.public},{headers:this.headers}),error:null}}catch(e){return{data:null,error:e}}}))}emptyBucket(e){return d(this,void 0,void 0,(function*(){try{return{data:yield c(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(e){return{data:null,error:e}}}))}deleteBucket(e){return d(this,void 0,void 0,(function*(){try{return{data:yield u(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(e){return{data:null,error:e}}}))}}{constructor(e,t={},r){super(e,t,r)}from(e){return new y(this.url,this.headers,e,this.fetch)}}},98:function(e,t){var r="undefined"!=typeof self?self:this,s=function(){function e(){this.fetch=!1,this.DOMException=r.DOMException}return e.prototype=r,new e}();!function(e){!function(t){var r="URLSearchParams"in e,s="Symbol"in e&&"iterator"in Symbol,n="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),i="FormData"in e,o="ArrayBuffer"in e;if(o)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(e){return e&&a.indexOf(Object.prototype.toString.call(e))>-1};function c(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function u(e){return"string"!=typeof e&&(e=String(e)),e}function l(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return s&&(t[Symbol.iterator]=function(){return t}),t}function d(e){this.map={},e instanceof d?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function f(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function m(e){var t=new FileReader,r=p(t);return t.readAsArrayBuffer(e),r}function y(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:n&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:i&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():o&&n&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=y(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):o&&(ArrayBuffer.prototype.isPrototypeOf(e)||h(e))?this._bodyArrayBuffer=y(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},n&&(this.blob=function(){var e=f(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(m)}),this.text=function(){var e,t,r,s=f(this);if(s)return s;if(this._bodyBlob)return e=this._bodyBlob,r=p(t=new FileReader),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),s=0;s<t.length;s++)r[s]=String.fromCharCode(t[s]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i&&(this.formData=function(){return this.text().then(_)}),this.json=function(){return this.text().then(JSON.parse)},this}d.prototype.append=function(e,t){e=c(e),t=u(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},d.prototype.delete=function(e){delete this.map[c(e)]},d.prototype.get=function(e){return e=c(e),this.has(e)?this.map[e]:null},d.prototype.has=function(e){return this.map.hasOwnProperty(c(e))},d.prototype.set=function(e,t){this.map[c(e)]=u(t)},d.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},d.prototype.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),l(e)},d.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),l(e)},d.prototype.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),l(e)},s&&(d.prototype[Symbol.iterator]=d.prototype.entries);var g=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function b(e,t){var r,s,n=(t=t||{}).body;if(e instanceof b){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new d(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new d(t.headers)),this.method=(s=(r=t.method||this.method||"GET").toUpperCase(),g.indexOf(s)>-1?s:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function _(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),s=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(s),decodeURIComponent(n))}})),t}function w(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new d(t.headers),this.url=t.url||"",this._initBody(e)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},v.call(b.prototype),v.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},w.error=function(){var e=new w(null,{status:0,statusText:""});return e.type="error",e};var S=[301,302,303,307,308];w.redirect=function(e,t){if(-1===S.indexOf(t))throw new RangeError("Invalid status code");return new w(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function T(e,r){return new Promise((function(s,i){var o=new b(e,r);if(o.signal&&o.signal.aborted)return i(new t.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function h(){a.abort()}a.onload=function(){var e,t,r={status:a.status,statusText:a.statusText,headers:(e=a.getAllResponseHeaders()||"",t=new d,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var r=e.split(":"),s=r.shift().trim();if(s){var n=r.join(":").trim();t.append(s,n)}})),t)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var n="response"in a?a.response:a.responseText;s(new w(n,r))},a.onerror=function(){i(new TypeError("Network request failed"))},a.ontimeout=function(){i(new TypeError("Network request failed"))},a.onabort=function(){i(new t.DOMException("Aborted","AbortError"))},a.open(o.method,o.url,!0),"include"===o.credentials?a.withCredentials=!0:"omit"===o.credentials&&(a.withCredentials=!1),"responseType"in a&&n&&(a.responseType="blob"),o.headers.forEach((function(e,t){a.setRequestHeader(t,e)})),o.signal&&(o.signal.addEventListener("abort",h),a.onreadystatechange=function(){4===a.readyState&&o.signal.removeEventListener("abort",h)}),a.send(void 0===o._bodyInit?null:o._bodyInit)}))}T.polyfill=!0,e.fetch||(e.fetch=T,e.Headers=d,e.Request=b,e.Response=w),t.Headers=d,t.Request=b,t.Response=w,t.fetch=T,Object.defineProperty(t,"__esModule",{value:!0})}({})}(s),s.fetch.ponyfill=!0,delete s.fetch.polyfill;var n=s;(t=n.fetch).default=n.fetch,t.fetch=n.fetch,t.Headers=n.Headers,t.Request=n.Request,t.Response=n.Response,e.exports=t},284:e=>{var t=function(){if("object"==typeof self&&self)return self;if("object"==typeof window&&window)return window;throw new Error("Unable to resolve global `this`")};e.exports=function(){if(this)return this;if("object"==typeof globalThis&&globalThis)return globalThis;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:!0})}catch(e){return t()}try{return __global__||t()}finally{delete Object.prototype.__global__}}()},296:function(e,t,r){"use strict";var s=this&&this.__awaiter||function(e,t,r,s){return new(r||(r=Promise))((function(n,i){function o(e){try{h(s.next(e))}catch(e){i(e)}}function a(e){try{h(s.throw(e))}catch(e){i(e)}}function h(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}h((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const n=r(678),i=r(610),o=r(283),a=r(528),h=r(122),c=r(501),u=r(498),l={schema:"public",autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:n.DEFAULT_HEADERS};t.default=class{constructor(e,t,r){if(this.supabaseUrl=e,this.supabaseKey=t,!e)throw new Error("supabaseUrl is required.");if(!t)throw new Error("supabaseKey is required.");e=i.stripTrailingSlash(e);const s=Object.assign(Object.assign({},l),r);this.restUrl=e+"/rest/v1",this.realtimeUrl=(e+"/realtime/v1").replace("http","ws"),this.authUrl=e+"/auth/v1",this.storageUrl=e+"/storage/v1",this.schema=s.schema,this.fetch=s.fetch,this.headers=Object.assign(Object.assign({},n.DEFAULT_HEADERS),null==r?void 0:r.headers),this.auth=this._initSupabaseAuthClient(s),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers},s.realtime))}get storage(){return new h.SupabaseStorageClient(this.storageUrl,this._getAuthHeaders(),this.fetch)}from(e){const t=`${this.restUrl}/${e}`;return new a.SupabaseQueryBuilder(t,{headers:this._getAuthHeaders(),schema:this.schema,realtime:this.realtime,table:e,fetch:this.fetch})}rpc(e,t,{head:r=!1,count:s=null}={}){return this._initPostgRESTClient().rpc(e,t,{head:r,count:s})}removeSubscription(e){return new Promise((t=>s(this,void 0,void 0,(function*(){try{yield this._closeSubscription(e);const r=this.getSubscriptions().length;if(!r){const{error:e}=yield this.realtime.disconnect();if(e)return t({error:e})}return t({error:null,data:{openSubscriptions:r}})}catch(e){return t({error:e})}}))))}_closeSubscription(e){return s(this,void 0,void 0,(function*(){e.isClosed()||(yield this._closeChannel(e))}))}getSubscriptions(){return this.realtime.channels}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,localStorage:s,headers:n,fetch:i}){const a={Authorization:"Bearer "+this.supabaseKey,apikey:""+this.supabaseKey};return new o.SupabaseAuthClient({url:this.authUrl,headers:Object.assign(Object.assign({},n),a),autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,localStorage:s,fetch:i})}_initRealtimeClient(e){return new u.RealtimeClient(this.realtimeUrl,Object.assign(Object.assign({},e),{params:Object.assign(Object.assign({},null==e?void 0:e.params),{apikey:this.supabaseKey})}))}_initPostgRESTClient(){return new c.PostgrestClient(this.restUrl,{headers:this._getAuthHeaders(),schema:this.schema,fetch:this.fetch})}_getAuthHeaders(){var e,t;const r=this.headers,s=null!==(t=null===(e=this.auth.session())||void 0===e?void 0:e.access_token)&&void 0!==t?t:this.supabaseKey;return r.apikey=this.supabaseKey,r.Authorization="Bearer "+s,r}_closeChannel(e){return new Promise(((t,r)=>{e.unsubscribe().receive("ok",(()=>(this.realtime.remove(e),t(!0)))).receive("error",(e=>r(e)))}))}}},341:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||s(t,e,r)},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AuthSession=t.AuthUser=t.SupabaseRealtimePayload=t.SupabaseClientOptions=t.SupabaseClient=t.createClient=t.PostgrestError=t.PostgrestMaybeSingleResponse=t.PostgrestSingleResponse=t.PostgrestResponse=void 0;const o=i(r(296));t.SupabaseClient=o.default;const a=r(717);Object.defineProperty(t,"SupabaseClientOptions",{enumerable:!0,get:function(){return a.SupabaseClientOptions}}),Object.defineProperty(t,"SupabaseRealtimePayload",{enumerable:!0,get:function(){return a.SupabaseRealtimePayload}});const h=r(271);Object.defineProperty(t,"AuthUser",{enumerable:!0,get:function(){return h.User}}),Object.defineProperty(t,"AuthSession",{enumerable:!0,get:function(){return h.Session}}),n(r(271),t);var c=r(501);Object.defineProperty(t,"PostgrestResponse",{enumerable:!0,get:function(){return c.PostgrestResponse}}),Object.defineProperty(t,"PostgrestSingleResponse",{enumerable:!0,get:function(){return c.PostgrestSingleResponse}}),Object.defineProperty(t,"PostgrestMaybeSingleResponse",{enumerable:!0,get:function(){return c.PostgrestMaybeSingleResponse}}),Object.defineProperty(t,"PostgrestError",{enumerable:!0,get:function(){return c.PostgrestError}}),n(r(498),t),t.createClient=(e,t,r)=>new o.default(e,t,r)},283:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SupabaseAuthClient=void 0;const s=r(271);class n extends s.GoTrueClient{constructor(e){super(e)}}t.SupabaseAuthClient=n},528:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SupabaseQueryBuilder=void 0;const s=r(501),n=r(308);class i extends s.PostgrestQueryBuilder{constructor(e,{headers:t={},schema:r,realtime:s,table:i,fetch:o}){super(e,{headers:t,schema:r,fetch:o}),this._subscription=new n.SupabaseRealtimeClient(s,t,r,i),this._realtime=s}on(e,t){return this._realtime.isConnected()||this._realtime.connect(),this._subscription.on(e,t)}}t.SupabaseQueryBuilder=i},308:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SupabaseRealtimeClient=void 0;const s=r(498);t.SupabaseRealtimeClient=class{constructor(e,t,r,s){const n={},i="*"===s?"realtime:"+r:`realtime:${r}:${s}`,o=t.Authorization.split(" ")[1];o&&(n.user_token=o),this.subscription=e.channel(i,n)}getPayloadRecords(e){const t={new:{},old:{}};return"INSERT"!==e.type&&"UPDATE"!==e.type||(t.new=s.Transformers.convertChangeData(e.columns,e.record)),"UPDATE"!==e.type&&"DELETE"!==e.type||(t.old=s.Transformers.convertChangeData(e.columns,e.old_record)),t}on(e,t){return this.subscription.on(e,(e=>{let r={schema:e.schema,table:e.table,commit_timestamp:e.commit_timestamp,eventType:e.type,new:{},old:{}};r=Object.assign(Object.assign({},r),this.getPayloadRecords(e)),t(r)})),this}subscribe(e=(()=>{})){return this.subscription.onError((t=>e("SUBSCRIPTION_ERROR",t))),this.subscription.onClose((()=>e("CLOSED"))),this.subscription.subscribe().receive("ok",(()=>e("SUBSCRIBED"))).receive("error",(t=>e("SUBSCRIPTION_ERROR",t))).receive("timeout",(()=>e("RETRYING_AFTER_TIMEOUT"))),this.subscription}}},678:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_HEADERS=void 0;const s=r(506);t.DEFAULT_HEADERS={"X-Client-Info":"supabase-js/"+s.version}},610:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.stripTrailingSlash=t.uuid=void 0,t.uuid=function(){return"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)}))},t.stripTrailingSlash=function(e){return e.replace(/\/$/,"")}},717:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},506:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version=void 0,t.version="0.0.0"},840:(e,t,r)=>{var s;if("object"==typeof globalThis)s=globalThis;else try{s=r(284)}catch(e){}finally{if(s||"undefined"==typeof window||(s=window),!s)throw new Error("Could not determine global this")}var n=s.WebSocket||s.MozWebSocket,i=r(387);function o(e,t){return t?new n(e,t):new n(e)}n&&["CONNECTING","OPEN","CLOSING","CLOSED"].forEach((function(e){Object.defineProperty(o,e,{get:function(){return n[e]}})})),e.exports={w3cwebsocket:n?o:null,version:i}},387:(e,t,r)=>{e.exports=r(847).version},847:e=>{"use strict";e.exports={version:"1.0.34"}}},t={};function r(s){if(t[s])return t[s].exports;var n=t[s]={exports:{}};return e[s].call(n.exports,n,n.exports,r),n.exports}return r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var s in t)r.o(t,s)&&!r.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(341)})()}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supabase/supabase-js",
3
- "version": "1.26.0",
3
+ "version": "1.28.2",
4
4
  "description": "Isomorphic Javascript client for Supabase.",
5
5
  "keywords": [
6
6
  "javascript",
@@ -36,8 +36,8 @@
36
36
  "docs:json": "typedoc --json docs/spec.json --mode modules --includeDeclarations --excludeExternals"
37
37
  },
38
38
  "dependencies": {
39
- "@supabase/gotrue-js": "^1.20.0",
40
- "@supabase/postgrest-js": "^0.34.1",
39
+ "@supabase/gotrue-js": "^1.21.0",
40
+ "@supabase/postgrest-js": "^0.35.0",
41
41
  "@supabase/realtime-js": "^1.2.1",
42
42
  "@supabase/storage-js": "^1.5.0"
43
43
  },
@@ -1,6 +1,6 @@
1
1
  import { DEFAULT_HEADERS } from './lib/constants'
2
2
  import { stripTrailingSlash } from './lib/helpers'
3
- import { SupabaseClientOptions } from './lib/types'
3
+ import { Fetch, SupabaseClientOptions } from './lib/types'
4
4
  import { SupabaseAuthClient } from './lib/SupabaseAuthClient'
5
5
  import { SupabaseQueryBuilder } from './lib/SupabaseQueryBuilder'
6
6
  import { SupabaseStorageClient } from '@supabase/storage-js'
@@ -32,6 +32,10 @@ export default class SupabaseClient {
32
32
  protected authUrl: string
33
33
  protected storageUrl: string
34
34
  protected realtime: RealtimeClient
35
+ protected fetch?: Fetch
36
+ protected headers: {
37
+ [key: string]: string
38
+ }
35
39
 
36
40
  /**
37
41
  * Create a new client for use in the browser.
@@ -43,6 +47,7 @@ export default class SupabaseClient {
43
47
  * @param options.detectSessionInUrl Set to "true" if you want to automatically detects OAuth grants in the URL and signs in the user.
44
48
  * @param options.headers Any additional headers to send with each network request.
45
49
  * @param options.realtime Options passed along to realtime-js constructor.
50
+ * @param options.fetch A custom fetch implementation.
46
51
  */
47
52
  constructor(
48
53
  protected supabaseUrl: string,
@@ -60,9 +65,11 @@ export default class SupabaseClient {
60
65
  this.authUrl = `${supabaseUrl}/auth/v1`
61
66
  this.storageUrl = `${supabaseUrl}/storage/v1`
62
67
  this.schema = settings.schema
68
+ this.fetch = settings.fetch
69
+ this.headers = { ...DEFAULT_HEADERS, ...options?.headers }
63
70
 
64
71
  this.auth = this._initSupabaseAuthClient(settings)
65
- this.realtime = this._initRealtimeClient(settings.realtime)
72
+ this.realtime = this._initRealtimeClient({ headers: this.headers, ...settings.realtime })
66
73
 
67
74
  // In the future we might allow the user to pass in a logger to receive these events.
68
75
  // this.realtime.onOpen(() => console.log('OPEN'))
@@ -74,7 +81,7 @@ export default class SupabaseClient {
74
81
  * Supabase Storage allows you to manage user-generated content, such as photos or videos.
75
82
  */
76
83
  get storage() {
77
- return new SupabaseStorageClient(this.storageUrl, this._getAuthHeaders())
84
+ return new SupabaseStorageClient(this.storageUrl, this._getAuthHeaders(), this.fetch)
78
85
  }
79
86
 
80
87
  /**
@@ -89,6 +96,7 @@ export default class SupabaseClient {
89
96
  schema: this.schema,
90
97
  realtime: this.realtime,
91
98
  table,
99
+ fetch: this.fetch,
92
100
  })
93
101
  }
94
102
 
@@ -154,6 +162,7 @@ export default class SupabaseClient {
154
162
  detectSessionInUrl,
155
163
  localStorage,
156
164
  headers,
165
+ fetch,
157
166
  }: SupabaseClientOptions) {
158
167
  const authHeaders = {
159
168
  Authorization: `Bearer ${this.supabaseKey}`,
@@ -166,6 +175,7 @@ export default class SupabaseClient {
166
175
  persistSession,
167
176
  detectSessionInUrl,
168
177
  localStorage,
178
+ fetch,
169
179
  })
170
180
  }
171
181
 
@@ -180,11 +190,12 @@ export default class SupabaseClient {
180
190
  return new PostgrestClient(this.restUrl, {
181
191
  headers: this._getAuthHeaders(),
182
192
  schema: this.schema,
193
+ fetch: this.fetch,
183
194
  })
184
195
  }
185
196
 
186
197
  private _getAuthHeaders(): { [key: string]: string } {
187
- const headers: { [key: string]: string } = DEFAULT_HEADERS
198
+ const headers: { [key: string]: string } = this.headers
188
199
  const authBearer = this.auth.session()?.access_token ?? this.supabaseKey
189
200
  headers['apikey'] = this.supabaseKey
190
201
  headers['Authorization'] = `Bearer ${authBearer}`
@@ -1,7 +1,7 @@
1
1
  import { PostgrestQueryBuilder } from '@supabase/postgrest-js'
2
2
  import { SupabaseRealtimeClient } from './SupabaseRealtimeClient'
3
3
  import { RealtimeClient } from '@supabase/realtime-js'
4
- import { SupabaseEventTypes, SupabaseRealtimePayload } from './types'
4
+ import { Fetch, SupabaseEventTypes, SupabaseRealtimePayload } from './types'
5
5
 
6
6
  export class SupabaseQueryBuilder<T> extends PostgrestQueryBuilder<T> {
7
7
  private _subscription: SupabaseRealtimeClient
@@ -14,14 +14,16 @@ export class SupabaseQueryBuilder<T> extends PostgrestQueryBuilder<T> {
14
14
  schema,
15
15
  realtime,
16
16
  table,
17
+ fetch,
17
18
  }: {
18
19
  headers?: { [key: string]: string }
19
20
  schema: string
20
21
  realtime: RealtimeClient
21
22
  table: string
23
+ fetch?: Fetch
22
24
  }
23
25
  ) {
24
- super(url, { headers, schema })
26
+ super(url, { headers, schema, fetch })
25
27
 
26
28
  this._subscription = new SupabaseRealtimeClient(realtime, headers, schema, table)
27
29
  this._realtime = realtime
package/src/lib/types.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { GoTrueClient } from '@supabase/gotrue-js'
2
2
  import { RealtimeClientOptions } from '@supabase/realtime-js'
3
3
 
4
+ export type Fetch = typeof fetch
5
+
4
6
  type GoTrueClientOptions = ConstructorParameters<typeof GoTrueClient>[0]
5
7
 
6
8
  export interface SupabaseAuthClientOptions extends GoTrueClientOptions {}
@@ -35,6 +37,11 @@ export type SupabaseClientOptions = {
35
37
  * Options passed to the realtime-js instance
36
38
  */
37
39
  realtime?: RealtimeClientOptions
40
+
41
+ /**
42
+ * A custom `fetch` implementation.
43
+ */
44
+ fetch?: Fetch
38
45
  }
39
46
 
40
47
  export type SupabaseRealtimePayload<T> = {
@@ -1,2 +1,2 @@
1
1
  // generated by genversion
2
- export const version = '1.26.0'
2
+ export const version = '1.28.2'