LocalCDN-Firefox-Chrome-Brave/resources/supabase-js/2.39.3/supabase.min.jsm

1 line
100 KiB
JavaScript
Raw Normal View History

2024-02-04 08:15:30 +01:00
!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,(()=>(()=>{"use strict";var e,t,s,r,i={982:(e,t,s)=>{s.r(t),s.d(t,{FunctionsClient:()=>a,FunctionsError:()=>r,FunctionsFetchError:()=>i,FunctionsHttpError:()=>o,FunctionsRelayError:()=>n});class r extends Error{constructor(e,t="FunctionsError",s){super(e),this.name=t,this.context=s}}class i extends r{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class n extends r{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class o extends r{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}class a{constructor(e,{headers:t={},customFetch:r}={}){this.url=e,this.headers=t,this.fetch=(e=>{let t;return t=e||("undefined"==typeof fetch?(...e)=>Promise.resolve().then(s.t.bind(s,743,23)).then((({default:t})=>t(...e))):fetch),(...e)=>t(...e)})(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e,t={}){var s,r,a,c,l;return r=this,a=void 0,l=function*(){try{const{headers:r,method:a,body:c}=t;let l,h={};c&&(r&&!Object.prototype.hasOwnProperty.call(r,"Content-Type")||!r)&&("undefined"!=typeof Blob&&c instanceof Blob||c instanceof ArrayBuffer?(h["Content-Type"]="application/octet-stream",l=c):"string"==typeof c?(h["Content-Type"]="text/plain",l=c):"undefined"!=typeof FormData&&c instanceof FormData?l=c:(h["Content-Type"]="application/json",l=JSON.stringify(c)));const u=yield this.fetch(`${this.url}/${e}`,{method:a||"POST",headers:Object.assign(Object.assign(Object.assign({},h),this.headers),r),body:l}).catch((e=>{throw new i(e)})),d=u.headers.get("x-relay-error");if(d&&"true"===d)throw new n(u);if(!u.ok)throw new o(u);let f,p=(null!==(s=u.headers.get("Content-Type"))&&void 0!==s?s:"text/plain").split(";")[0].trim();return f="application/json"===p?yield u.json():"application/octet-stream"===p?yield u.blob():"multipart/form-data"===p?yield u.formData():yield u.text(),{data:f,error:null}}catch(e){return{data:null,error:e}}},new((c=void 0)||(c=Promise))((function(e,t){function s(e){try{n(l.next(e))}catch(e){t(e)}}function i(e){try{n(l.throw(e))}catch(e){t(e)}}function n(t){var r;t.done?e(t.value):(r=t.value,r instanceof c?r:new c((function(e){e(r)}))).then(s,i)}n((l=l.apply(r,a||[])).next())}))}}},765:(e,t,s)=>{s.r(t),s.d(t,{AuthApiError:()=>_,AuthError:()=>v,AuthImplicitGrantRedirectError:()=>j,AuthInvalidCredentialsError:()=>E,AuthInvalidTokenResponseError:()=>T,AuthPKCEGrantCodeExchangeError:()=>O,AuthRetryableFetchError:()=>P,AuthSessionMissingError:()=>S,AuthUnknownError:()=>w,AuthWeakPasswordError:()=>x,CustomAuthError:()=>k,GoTrueAdminApi:()=>q,GoTrueClient:()=>Z,NavigatorLockAcquireTimeoutError:()=>V,isAuthApiError:()=>b,isAuthError:()=>m,isAuthRetryableFetchError:()=>$,isAuthWeakPasswordError:()=>A,lockInternals:()=>G,navigatorLock:()=>W});const r=()=>"undefined"!=typeof document,i={tested:!1,writable:!1},n=()=>{if(!r())return!1;try{if("object"!=typeof globalThis.localStorage)return!1}catch(e){return!1}if(i.tested)return i.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),i.tested=!0,i.writable=!0}catch(e){i.tested=!0,i.writable=!1}return i.writable};function o(e){const t={},s=new URL(e);if(s.hash&&"#"===s.hash[0])try{new URLSearchParams(s.hash.substring(1)).forEach(((e,s)=>{t[s]=e}))}catch(e){}return s.searchParams.forEach(((e,s)=>{t[s]=e})),t}const a=e=>{let t;return t=e||("undefined"==typeof fetch?(...e)=>Promise.resolve().then(s.t.bind(s,743,23)).then((({default:t})=>t(...e))):fetch),(...e)=>t(...e)},c=e=>"object"==typeof e&&null!==e&&"status"in e&&"ok"in e&&"json"in e&&"function"==typeof e.json,l=async(e,t,s)=>{await e.setItem(t,JSON.stringify(s))},h=async(e,t)=>{const s=await e.getItem(t);if(!s)return null;try{return JSON.parse(s)}catch(e){return s}},u=async(e,t)=>{await e.removeItem(t)};class d{constructor(){this