PageSourceSearch

https://calmclip-studio-frontend.onrender.com/_next/static/chunks/6549-573a4a6cb2778144.js

js calmclip-studio-frontend.onrender.com collected 2026-10-03 11:39:33 UTC 140,188 bytes, 11 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6549],{95973:function(e,t,r){r.r(t),r.d(t,{Headers:function(){return s},Request:function(){return o},Response:function(){return a},fetch:function(){return n}});var i="undefined"!=typeof self?self:window;let n=i.fetch;t.default=i.fetch.bind(i);let s=i.Headers,o=i.Request,a=i.Response},33017:function(e,t,r){var i=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});let n=i(r(95973)),s=i(r(47649));class o{throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=Object.assign({},this.headers),this.headers[e]=t,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=(0,this.fetch)(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async e=>{var t,r,i;let n=null,o=null,a=null,l=e.status,c=e.statusText;if(e.ok){if("HEAD"!==this.method){let t=await e.text();""===t||(o="text/csv"===this.headers.Accept?t:this.headers.Accept&&this.headers.Accept.includes("application/vnd.pgrst.plan+text")?t:JSON.parse(t))}let i=null===(t=this.headers.Prefer)||void 0===t?void 0:t.match(/count=(exact|planned|estimated)/),s=null===(r=e.headers.get("content-range"))||void 0===r?void 0:r.split("/");i&&s&&s.length>1&&(a=parseInt(s[1])),this.isMaybeSingle&&"GET"===this.method&&Array.isArray(o)&&(o.length>1?(n={code:"PGRST116",details:"Results contain ".concat(o.length," rows, application/vnd.pgrst.object+json requires 1 row"),hint:null,message:"JSON object requested, multiple (or no) rows returned"},o=null,a=null,l=406,c="Not Acceptable"):o=1===o.length?o[0]:null)}else{let t=await e.text();try{n=JSON.parse(t),Array.isArray(n)&&404===e.status&&(o=[],n=null,l=200,c="OK")}catch(r){404===e.status&&""===t?(l=204,c="No Content"):n={message:t}}if(n&&this.isMaybeSingle&&(null===(i=null==n?void 0:n.details)||void 0===i?void 0:i.includes("0 rows"))&&(n=null,l=200,c="OK"),n&&this.shouldThrowOnError)throw new s.default(n)}return{error:n,data:o,count:a,status:l,statusText:c}});return this.shouldThrowOnError||(r=r.catch(e=>{var t,r,i;return{error:{message:"".concat(null!==(t=null==e?void 0:e.name)&&void 0!==t?t:"FetchError",": ").concat(null==e?void 0:e.message),details:"".concat(null!==(r=null==e?void 0:e.stack)&&void 0!==r?r:""),hint:"",code:"".concat(null!==(i=null==e?void 0:e.code)&&void 0!==i?i:"")},data:null,count:null,status:0,statusText:""}})),r.then(e,t)}constructor(e){this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=e.headers,this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=e.shouldThrowOnError,this.signal=e.signal,this.isMaybeSingle=e.isMaybeSingle,e.fetch?this.fetch=e.fetch:"undefined"==typeof fetch?this.fetch=n.default:this.fetch=fetch}}t.default=o},64355:function(e,t,r){var i=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});let n=i(r(22673)),s=i(r(17893)),o=r(13688);class a{from(e){let t=new URL("".concat(this.url,"/").concat(e));return new n.default(t,{headers:Object.assign({},this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new a(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e){let t,r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{head:n=!1,get:o=!1,count:a}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},l=new URL("".concat(this.url,"/rpc/").concat(e));n||o?(t=n?"HEAD":"GET",Object.entries(i).filter(e=>{let[t,r]=e;return void 0!==r}).map(e=>{let[t,r]=e;return[t,Array.isArray(r)?"{".concat(r.join(","),"}"):"".concat(r)]}).forEach(e=>{let[t,r]=e;l.searchParams.append(t,r)})):(t="POST",r=i);let c=Object.assign({},this.headers);return a&&(c.Prefer="count=".concat(a)),new s.default({method:t,url:l,headers:c,schema:this.schemaName,body:r,fetch:this.fetch,allowEmpty:!1})}constructor(e,{headers:t={},schema:r,fetch:i}={}){this.url=e,this.headers=Object.assign(Object.assign({},o.DEFAULT_HEADERS),t),this.schemaName=r,this.fetch=i}}t.default=a}
1,47649:function(e,t){Object.defineProperty(t,"__esModule",{value:!0});class r extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}}t.default=r},17893:function(e,t,r){var i;Object.defineProperty(t,"__esModule",{value:!0});let n=(i=r(45421))&&i.__esModule?i:{default:i};class s extends n.default{eq(e,t){return this.url.searchParams.append(e,"eq.".concat(t)),this}neq(e,t){return this.url.searchParams.append(e,"neq.".concat(t)),this}gt(e,t){return this.url.searchParams.append(e,"gt.".concat(t)),this}gte(e,t){return this.url.searchParams.append(e,"gte.".concat(t)),this}lt(e,t){return this.url.searchParams.append(e,"lt.".concat(t)),this}lte(e,t){return this.url.searchParams.append(e,"lte.".concat(t)),this}like(e,t){return this.url.searchParams.append(e,"like.".concat(t)),this}likeAllOf(e,t){return this.url.searchParams.append(e,"like(all).{".concat(t.join(","),"}")),this}likeAnyOf(e,t){return this.url.searchParams.append(e,"like(any).{".concat(t.join(","),"}")),this}ilike(e,t){return this.url.searchParams.append(e,"ilike.".concat(t)),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,"ilike(all).{".concat(t.join(","),"}")),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,"ilike(any).{".concat(t.join(","),"}")),this}is(e,t){return this.url.searchParams.append(e,"is.".concat(t)),this}in(e,t){let r=Array.from(new Set(t)).map(e=>"string"==typeof e&&RegExp("[,()]").test(e)?'"'.concat(e,'"'):"".concat(e)).join(",");return this.url.searchParams.append(e,"in.(".concat(r,")")),this}contains(e,t){return"string"==typeof t?this.url.searchParams.append(e,"cs.".concat(t)):Array.isArray(t)?this.url.searchParams.append(e,"cs.{".concat(t.join(","),"}")):this.url.searchParams.append(e,"cs.".concat(JSON.stringify(t))),this}containedBy(e,t){return"string"==typeof t?this.url.searchParams.append(e,"cd.".concat(t)):Array.isArray(t)?this.url.searchParams.append(e,"cd.{".concat(t.join(","),"}")):this.url.searchParams.append(e,"cd.".concat(JSON.stringify(t))),this}rangeGt(e,t){return this.url.searchParams.append(e,"sr.".concat(t)),this}rangeGte(e,t){return this.url.searchParams.append(e,"nxl.".concat(t)),this}rangeLt(e,t){return this.url.searchParams.append(e,"sl.".concat(t)),this}rangeLte(e,t){return this.url.searchParams.append(e,"nxr.".concat(t)),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,"adj.".concat(t)),this}overlaps(e,t){return"string"==typeof t?this.url.searchParams.append(e,"ov.".concat(t)):this.url.searchParams.append(e,"ov.{".concat(t.join(","),"}")),this}textSearch(e,t){let{config:r,type:i}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="";return"plain"===i?n="pl":"phrase"===i?n="ph":"websearch"===i&&(n="w"),this.url.searchParams.append(e,"".concat(n,"fts").concat(void 0===r?"":"(".concat(r,")"),".").concat(t)),this}match(e){return Object.entries(e).forEach(e=>{let[t,r]=e;this.url.searchParams.append(t,"eq.".concat(r))}),this}not(e,t,r){return this.url.searchParams.append(e,"not.".concat(t,".").concat(r)),this}or(e){let{foreignTable:t,referencedTable:r=t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.url.searchParams.append(r?"".concat(r,".or"):"or","(".concat(e,")")),this}filter(e,t,r){return this.url.searchParams.append(e,"".concat(t,".").concat(r)),this}}t.default=s},22673:function(e,t,r){var i;Object.defineProperty(t,"__esModule",{value:!0});let n=(i=r(17893))&&i.__esModule?i:{default:i};class s{select(e){let{head:t=!1,count:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=!1,s=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!i?"":('"'===e&&(i=!i),e)).join("");return this.url.searchParams.set("select",s),r&&(this.headers.Prefer="count=".concat(r)),new n.default({method:t?"HEAD":"GET",url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}insert(e){let{count:t,defaultToNull:r=!0}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=[];if(this.headers.Prefer&&i.push(this.headers.Prefer),t&&i.push("count=".concat(t)),r||i.push("missing=default"),this.headers.Prefer=i.join(","),Array.isArray(e)){let t=e.reduce((e,t)=>
1e.concat(Object.keys(t)),[]);if(t.length>0){let e=[...new Set(t)].map(e=>'"'.concat(e,'"'));this.url.searchParams.set("columns",e.join(","))}}return new n.default({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}upsert(e){let{onConflict:t,ignoreDuplicates:r=!1,count:i,defaultToNull:s=!0}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=["resolution=".concat(r?"ignore":"merge","-duplicates")];if(void 0!==t&&this.url.searchParams.set("on_conflict",t),this.headers.Prefer&&o.push(this.headers.Prefer),i&&o.push("count=".concat(i)),s||o.push("missing=default"),this.headers.Prefer=o.join(","),Array.isArray(e)){let t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){let e=[...new Set(t)].map(e=>'"'.concat(e,'"'));this.url.searchParams.set("columns",e.join(","))}}return new n.default({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}update(e){let{count:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=[];return this.headers.Prefer&&r.push(this.headers.Prefer),t&&r.push("count=".concat(t)),this.headers.Prefer=r.join(","),new n.default({method:"PATCH",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}delete(){let{count:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=[];return e&&t.push("count=".concat(e)),this.headers.Prefer&&t.unshift(this.headers.Prefer),this.headers.Prefer=t.join(","),new n.default({method:"DELETE",url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}constructor(e,{headers:t={},schema:r,fetch:i}){this.url=e,this.headers=t,this.schema=r,this.fetch=i}}t.default=s},45421:function(e,t,r){var i;Object.defineProperty(t,"__esModule",{value:!0});let n=(i=r(33017))&&i.__esModule?i:{default:i};class s extends n.default{select(e){let t=!1,r=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!t?"":('"'===e&&(t=!t),e)).join("");return this.url.searchParams.set("select",r),this.headers.Prefer&&(this.headers.Prefer+=","),this.headers.Prefer+="return=representation",this}order(e){let{ascending:t=!0,nullsFirst:r,foreignTable:i,referencedTable:n=i}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=n?"".concat(n,".order"):"order",o=this.url.searchParams.get(s);return this.url.searchParams.set(s,"".concat(o?"".concat(o,","):"").concat(e,".").concat(t?"asc":"desc").concat(void 0===r?"":r?".nullsfirst":".nullslast")),this}limit(e){let{foreignTable:t,referencedTable:r=t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.url.searchParams.set(void 0===r?"limit":"".concat(r,".limit"),"".concat(e)),this}range(e,t){let{foreignTable:r,referencedTable:i=r}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=void 0===i?"offset":"".concat(i,".offset"),s=void 0===i?"limit":"".concat(i,".limit");return this.url.searchParams.set(n,"".concat(e)),this.url.searchParams.set(s,"".concat(t-e+1)),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.Accept="application/vnd.pgrst.object+json",this}maybeSingle(){return"GET"===this.method?this.headers.Accept="application/json":this.headers.Accept="application/vnd.pgrst.object+json",this.isMaybeSingle=!0,this}csv(){return this.headers.Accept="text/csv",this}geojson(){return this.headers.Accept="application/geo+json",this}explain(){var e;let{analyze:t=!1,verbose:r=!1,settings:i=!1,buffers:n=!1,wal:s=!1,format:o="text"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=[t?"analyze":null,r?"verbose":null,i?"settings":null,n?"buffers":null,s?"wal":null].filter(Boolean).join("|"),l=null!==(e=this.headers.Accept)&&void 0!==e?e:"application/json";return this.headers.Accept="application/vnd.pgrst.plan+".concat(o,'; for="').concat(l,'"; options=').concat(a,";"),this}rollback(){var e;return(null!==(e=this.headers.Prefer)&&void 0!==e?e:"").trim().length>0?this.headers.Prefer+=",tx=rollback":this.headers.Prefer="tx=rollback",this}returns(){return this}}t.default=s}
1,13688:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_HEADERS=void 0;let i=r(56311);t.DEFAULT_HEADERS={"X-Client-Info":"postgrest-js/".concat(i.version)}},95302:function(e,t,r){var i=function(e){return e&&e.__esModule?e:{default:e}};t.PostgrestBuilder=t.PostgrestTransformBuilder=t.PostgrestFilterBuilder=t.PostgrestQueryBuilder=t.PostgrestClient=void 0;let n=i(r(64355));t.PostgrestClient=n.default;let s=i(r(22673));t.PostgrestQueryBuilder=s.default;let o=i(r(17893));t.PostgrestFilterBuilder=o.default;let a=i(r(45421));t.PostgrestTransformBuilder=a.default;let l=i(r(33017));t.PostgrestBuilder=l.default,n.default,s.default,o.default,a.default,l.default},56311:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.version=void 0,t.version="0.0.0-automated"},56549:function(e,t,r){let i;r.d(t,{createBrowserClient:function(){return tG}});let n=e=>{let t;return t=e||("undefined"==typeof fetch?function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];return Promise.resolve().then(r.bind(r,95973)).then(e=>{let{default:r}=e;return r(...t)})}:fetch),function(){for(var e=arguments.length,r=Array(e),i=0;i<e;i++)r[i]=arguments[i];return t(...r)}};class s extends Error{constructor(e,t="FunctionsError",r){super(e),this.name=t,this.context=r}}class o extends s{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class a extends s{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class l extends s{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}(z=J||(J={})).Any="any",z.ApNortheast1="ap-northeast-1",z.ApNortheast2="ap-northeast-2",z.ApSouth1="ap-south-1",z.ApSoutheast1="ap-southeast-1",z.ApSoutheast2="ap-southeast-2",z.CaCentral1="ca-central-1",z.EuCentral1="eu-central-1",z.EuWest1="eu-west-1",z.EuWest2="eu-west-2",z.EuWest3="eu-west-3",z.SaEast1="sa-east-1",z.UsEast1="us-east-1",z.UsWest1="us-west-1",z.UsWest2="us-west-2";class c{setAuth(e){this.headers.Authorization="Bearer ".concat(e)}invoke(e){var t,r,i,n,s;let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r=this,i=void 0,n=void 0,s=function*(){try{let r;let{headers:i,method:n,body:s}=c,h={},{region:u}=c;u||(u=this.region),u&&"any"!==u&&(h["x-region"]=u),s&&(i&&!Object.prototype.hasOwnProperty.call(i,"Content-Type")||!i)&&("undefined"!=typeof Blob&&s instanceof Blob||s instanceof ArrayBuffer?(h["Content-Type"]="application/octet-stream",r=s):"string"==typeof s?(h["Content-Type"]="text/plain",r=s):"undefined"!=typeof FormData&&s instanceof FormData?r=s:(h["Content-Type"]="application/json",r=JSON.stringify(s)));let d=yield this.fetch("".concat(this.url,"/").concat(e),{method:n||"POST",headers:Object.assign(Object.assign(Object.assign({},h),this.headers),i),body:r}).catch(e=>{throw new o(e)}),f=d.headers.get("x-relay-error");if(f&&"true"===f)throw new a(d);if(!d.ok)throw new l(d);let p=(null!==(t=d.headers.get("Content-Type"))&&void 0!==t?t:"text/plain").split(";")[0].trim();return{data:"application/json"===p?yield d.json():"application/octet-stream"===p?yield d.blob():"text/event-stream"===p?d:"multipart/form-data"===p?yield d.formData():yield d.text(),error:null}}catch(e){return{data:null,error:e}}},new(n||(n=Promise))(function(e,t){function o(e){try{l(s.next(e))}catch(e){t(e)}}function a(e){try{l(s.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):((r=t.value)instanceof n?r:new n(function(e){e(r)})).then(o,a)}l((s=s.apply(r,i||[])).next())})}constructor(e,{headers:t={},customFetch:r,region:i=J.Any}={}){this.url=e,this.headers=t,this.region=i,this.fetch=n(r)}}let{PostgrestClient:h,PostgrestQueryBuilder:u,PostgrestFilterBuilder:d,PostgrestTransformBuilder:f,PostgrestBuilder:p}=r(95302),g={"X-Client-Info":"realtime-js/".concat("2.10.2")};(ee=K||(K={}))[ee.connecting=0]="connecting",ee[ee.open=1]="open",ee[ee.closing=2]="closing",ee[ee.closed=3]="closed",(et=H||(H={})).closed="closed",et.errored="errored",et.joined="joined",et.joining="joining",et.leaving="leaving",(er=G||(G={})).close="phx_close",er.error="phx_error",er.join="phx_join",er.reply="phx_reply",er.leave="phx_leave",er.access_token="access_token",(W||(W={})).websocket="websocket",(ei=V||(V={})).Connecting="connecting",ei.Open="open",ei.Closing="closing",ei.Closed="closed";class y{decode(e,t){return e.constructor===ArrayBuffer?t(this._binaryDecode(e)):"string"==typeof e?t(JSON.parse(e)):t({})}
1_binaryDecode(e){let t=new DataView(e),r=new TextDecoder;return this._decodeBroadcast(e,t,r)}_decodeBroadcast(e,t,r){let i=t.getUint8(1),n=t.getUint8(2),s=this.HEADER_LENGTH+2,o=r.decode(e.slice(s,s+i));s+=i;let a=r.decode(e.slice(s,s+n));return s+=n,{ref:null,topic:o,event:a,payload:JSON.parse(r.decode(e.slice(s,e.byteLength)))}}constructor(){this.HEADER_LENGTH=1}}class v{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))}constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=t}}(en=Y||(Y={})).abstime="abstime",en.bool="bool",en.date="date",en.daterange="daterange",en.float4="float4",en.float8="float8",en.int2="int2",en.int4="int4",en.int4range="int4range",en.int8="int8",en.int8range="int8range",en.json="json",en.jsonb="jsonb",en.money="money",en.numeric="numeric",en.oid="oid",en.reltime="reltime",en.text="text",en.time="time",en.timestamp="timestamp",en.timestamptz="timestamptz",en.timetz="timetz",en.tsrange="tsrange",en.tstzrange="tstzrange";let m=function(e,t){var r;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=null!==(r=i.skipTypes)&&void 0!==r?r:[];return Object.keys(t).reduce((r,i)=>(r[i]=w(i,e,t,n),r),{})},w=(e,t,r,i)=>{let n=t.find(t=>t.name===e),s=null==n?void 0:n.type,o=r[e];return s&&!i.includes(s)?b(s,o):_(o)},b=(e,t)=>{if("_"===e.charAt(0))return E(t,e.slice(1,e.length));switch(e){case Y.bool:return k(t);case Y.float4:case Y.float8:case Y.int2:case Y.int4:case Y.int8:case Y.numeric:case Y.oid:return S(t);case Y.json:case Y.jsonb:return T(t);case Y.timestamp:return A(t);case Y.abstime:case Y.date:case Y.daterange:case Y.int4range:case Y.int8range:case Y.money:case Y.reltime:case Y.text:case Y.time:case Y.timestamptz:case Y.timetz:case Y.tsrange:case Y.tstzrange:default:return _(t)}},_=e=>e,k=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},S=e=>{if("string"==typeof e){let t=parseFloat(e);if(!Number.isNaN(t))return t}return e},T=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){console.log("JSON parse error: ".concat(e))}return e},E=(e,t)=>{if("string"!=typeof e)return e;let r=e.length-1,i=e[r];if("{"===e[0]&&"}"===i){let i;let n=e.slice(1,r);try{i=JSON.parse("["+n+"]")}catch(e){i=n?n.split(","):[]}return i.map(e=>b(t,e))}return e},A=e=>"string"==typeof e?e.replace(" ","T"):e,O=e=>{let t=e;return(t=(t=t.replace(/^ws/i,"http")).replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,"")).replace(/\/+$/,"")};class j{resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,t){var r;return this._hasReceived(e)&&t(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(e){let{status:t,response:r}=e;this.recHooks.filter(e=>e.status===t).forEach(e=>e.callback(r))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}constructor(e,t,r={},i=1e4){this.channel=e,this.event=t,this.payload=r,this.timeout=i,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHo
1oks=[],this.refEvent=null}}(es=X||(X={})).SYNC="sync",es.JOIN="join",es.LEAVE="leave";class P{static syncState(e,t,r,i){let n=this.cloneDeep(e),s=this.transformState(t),o={},a={};return this.map(n,(e,t)=>{s[e]||(a[e]=t)}),this.map(s,(e,t)=>{let r=n[e];if(r){let i=t.map(e=>e.presence_ref),n=r.map(e=>e.presence_ref),s=t.filter(e=>0>n.indexOf(e.presence_ref)),l=r.filter(e=>0>i.indexOf(e.presence_ref));s.length>0&&(o[e]=s),l.length>0&&(a[e]=l)}else o[e]=t}),this.syncDiff(n,{joins:o,leaves:a},r,i)}static syncDiff(e,t,r,i){let{joins:n,leaves:s}={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)};return r||(r=()=>{}),i||(i=()=>{}),this.map(n,(t,i)=>{var n;let s=null!==(n=e[t])&&void 0!==n?n:[];if(e[t]=this.cloneDeep(i),s.length>0){let r=e[t].map(e=>e.presence_ref),i=s.filter(e=>0>r.indexOf(e.presence_ref));e[t].unshift(...i)}r(t,s,i)}),this.map(s,(t,r)=>{let n=e[t];if(!n)return;let s=r.map(e=>e.presence_ref);n=n.filter(e=>0>s.indexOf(e.presence_ref)),e[t]=n,i(t,n,r),0===n.length&&delete e[t]}),e}static map(e,t){return Object.getOwnPropertyNames(e).map(r=>t(r,e[r]))}static transformState(e){return Object.getOwnPropertyNames(e=this.cloneDeep(e)).reduce((t,r)=>{let i=e[r];return"metas"in i?t[r]=i.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e)):t[r]=i,t},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}constructor(e,t){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};let r=(null==t?void 0:t.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(r.state,{},e=>{let{onJoin:t,onLeave:r,onSync:i}=this.caller;this.joinRef=this.channel._joinRef(),this.state=P.syncState(this.state,e,t,r),this.pendingDiffs.forEach(e=>{this.state=P.syncDiff(this.state,e,t,r)}),this.pendingDiffs=[],i()}),this.channel._on(r.diff,{},e=>{let{onJoin:t,onLeave:r,onSync:i}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(e):(this.state=P.syncDiff(this.state,e,t,r),i())}),this.onJoin((e,t,r)=>{this.channel._trigger("presence",{event:"join",key:e,currentPresences:t,newPresences:r})}),this.onLeave((e,t,r)=>{this.channel._trigger("presence",{event:"leave",key:e,currentPresences:t,leftPresences:r})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}}(eo=$||($={})).ALL="*",eo.INSERT="INSERT",eo.UPDATE="UPDATE",eo.DELETE="DELETE",(ea=Q||(Q={})).BROADCAST="broadcast",ea.PRESENCE="presence",ea.POSTGRES_CHANGES="postgres_changes",(el=Z||(Z={})).SUBSCRIBED="SUBSCRIBED",el.TIMED_OUT="TIMED_OUT",el.CLOSED="CLOSED",el.CHANNEL_ERROR="CHANNEL_ERROR";class C{subscribe(e){var t,r;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.timeout;if(this.socket.isConnected()||this.socket.connect(),this.joinedOnce)throw"tried to subscribe multiple times. 'subscribe' can only be called a single time per channel instance";{let{config:{broadcast:n,presence:s,private:o}}=this.params;this._onError(t=>e&&e("CHANNEL_ERROR",t)),this._onClose(()=>e&&e("CLOSED"));let a={},l={broadcast:n,presence:s,postgres_changes:null!==(r=null===(t=this.bindings.postgres_changes)||void 0===t?void 0:t.map(e=>e.filter))&&void 0!==r?r:[],private:o};this.socket.accessToken&&(a.access_token=this.socket.accessToken),this.updateJoinPayload(Object.assign({config:l},a)),this.joinedOnce=!0,this._rejoin(i),this.joinPush.receive("ok",t=>{var r;let{postgres_changes:i}=t;if(this.socket.accessToken&&this.socket.setAuth(this.socket.accessToken),void 0===i){e&&e("SUBSCRIBED");return}{let t=this.bindings.postgres_changes,n=null!==(r=null==t?void 0:t.length)&&void 0!==r?r:0,s=[];for(let r=0;r<n;r++){let n=t[r],{filter:{event:o,schema:a,table:l,filter:c}}=n,h=i&&i[r];if(h&&h.event===o&&h.schema===a&&h.table===l&&h.filter===c)s.push(Object.assign(Object.assign({},n),{id:h.id}));else{this.unsubscribe(),e&&e("CHANNEL_ERROR",Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=s,e&&e("SUBSCRIBED");return}}).receive("error",t=>{e&&e("CHANNEL_ERROR",Error(JSON.stringify(Object.values(t).join(", ")||"error")))}).receive("timeout",()=>{e&&e("TIMED_OUT")})}return this}presenceState(){return this.presence.state}async track(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return await this.send({type:"presence",event:"track",payload:e},t.timeout||this.timeout)}async untrack(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return await this.send({type:"presence",event:"untrack"},e)}on(e,t,r){return this._on(e,t,r)}async send(e){var t,r;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._canPush()||"broadcast"!==e.type)return new Promise(t=>{var r,n,s;let o=this._push(e.type,e,i.timeout||this.timeout);"broadcast"!==e.type||(null===(s=null===(n=null===(r=this.params)||void 0===r?void 0:r.config)||void 0===n?void 0:n.broadcast)||void 0===s?void 0:s.ack)||t("ok"),o.receive("ok",()=>t("ok")),o.receive("error",()=>t("error")),o.receive("timeout",()=>t("timed out"))});{let{event:n,payload:s}=e,o={method:"POST",headers:{Authorization:this.socket.accessToken?"Bearer ".concat(this.socket.accessToken):"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:n,payload:s}]})};try{let e=await this._fetchWithTimeout(this.broadcastEndpointURL,o,null!==(t=i.timeout)&&void 0!==t?t:this.timeout);return await (null===(r=e.body)||void 0===r?void 0:r.cancel()),e.ok?"ok":"error"}catch(e){if("AbortError"===e.name)return"timed out";return"error"}}}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.timeout;this.state=H.leaving;let t=()=>{this.socket.log("channel","leave ".concat(this.topic)),this._trigger(G.close,"leave",this._joinRef())};return this.rejoinTimer.reset(),this.joinPush.destroy(),new Promise(r=>{let i=new j(this,G.leave,{},e);i.receive("ok",()=>{t(),r("ok")}).receive("timeout",()=>{t(),r("timed out")}).receive("error",()=>{r("error")}),i.send(),this._canPush()||i.trigger("ok",{})})}async _fetchWithTimeout(e,t,r){let i=new AbortController,n=setTimeout(()=>i.abort(),r),s=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:i.signal}));return clearTimeout(n),s}_push(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.timeout;if(!this.joinedOnce)throw"tried to push '".concat(e,"' to '").concat(this.topic,"' before joining. Use channel.subscribe() before pushing events");let i=new j(this,e,t,r);return this._canPush()?i.send():(i.startTimeout(),this.pushBuffer.push(i)),i}_onMessage(e,t,r){return t}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,t,r){var i,n;let s=e.toLocaleLowerCase(),{close:o,error:a,leave:l,join:c}=G;if(r&&[o,a,l,c].indexOf(s)>=0&&r!==this._joinRef())return;let h=this._onMessage(s,t,r);if(t&&!h)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(s)?null===(i=this.bindings.postgres_changes)||void 0===i||i.filter(e=>{var t,r,i;return(null===(t=e.filter)||void 0===t?void 0:t.event)==="*"||(null===(i=null===(r=e.filter)||void 0===r?void 0:r.event)||void 0===i?void 0:i.toLocaleLowerCase())===s}).map(e=>e.callback(h,r)):null===(n=this.bindings[s])||void 0===n||n.filter(e=>{var r,i,n,o,a,l;if(!["broadcast","presence","postgres_changes"].includes(s))return e.type.toLocaleLowerCase()===s;if("id"in e){let s=e.id,o=null===(r=e.filter)||void 0===r?void 0:r.event;return s&&(null===(i=t.ids)||void 0===i?void 0:i.includes(s))&&("*"===o||(null==o?void 0:o.toLocaleLowerCase())===(null===(n=t.data)||void 0===n?void 0:n.type.toLocaleLowerCase()))}{let r=null===(a=null===(o=null==e?void 0:e.filter)||void 0===o?void 0:o.event)||void 0===a?void 0:a.toLocaleLowerCase();return"*"===r||r===(null===(l=null==t?void 0:t.event)||void 0===l?void 0:l.toLocaleLowerCase())}}).map(e=>{if("object"==typeof h&&"ids"in h){let e=h.data,{schema:t,table:r,commit_timestamp:i,type:n,errors:s}=e;h=Object.assign(Object.assign({},{schema:t,table:r,commit_timestamp:i,eventType:n,new:{},old:{},errors:s}),this._getPayloadRecords(e))}e.callback(h,r)})}_isClosed(){return this.state===H.closed}_isJoined(){return this.state===H.joined}_isJoining(){return this.state===H.joining}_isLeaving(){return this.state===H.leaving}_replyEventName(e){return"chan_reply_".concat(e)}_on(e,t,r){let i=e.toLocaleLowerCase(),n={type:i,filter:t,callback:r};return this.bindings[i]?this.bindings[i].push(n):this.bindings[i]=[n],this}_off(e,t){let r=e.toLocaleLowerCase();return this.bindings[r]=this.bindings[r].filter(e=>{var i;return!((null===(i=e.type)||void 0===i?void 0:i.toLocaleLowerCase())===r&&C.isEqual(e.filter,t))}),this}static isEqual(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(e[r]!==t[r])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(G.close,{},e)}_onError(e){this._on(G.error,{},t=>e(t))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.timeout;this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=H.joining,this.joinPush.resend(e))}_getPayloadRecords(e){let t={new:{},old:{}};return("INSERT"===e.type||"UPDATE"===e.type)&&(t.new=m(e.columns,e.record)),("UPDATE"===e.type||"DELET
1E"===e.type)&&(t.old=m(e.columns,e.old_record)),t}constructor(e,t={config:{}},r){this.topic=e,this.params=t,this.socket=r,this.bindings={},this.state=H.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:""},private:!1},t.config),this.timeout=this.socket.timeout,this.joinPush=new j(this,G.join,this.params,this.timeout),this.rejoinTimer=new v(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=H.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(e=>e.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel","close ".concat(this.topic," ").concat(this._joinRef())),this.state=H.closed,this.socket._remove(this)}),this._onError(e=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel","error ".concat(this.topic),e),this.state=H.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel","timeout ".concat(this.topic),this.joinPush.timeout),this.state=H.errored,this.rejoinTimer.scheduleTimeout())}),this._on(G.reply,{},(e,t)=>{this._trigger(this._replyEventName(t),e)}),this.presence=new P(this),this.broadcastEndpointURL=O(this.socket.endPoint)+"/api/broadcast"}}let x=()=>{},R="undefined"!=typeof WebSocket;class I{connect(){if(!this.conn){if(this.transport){this.conn=new this.transport(this._endPointURL(),void 0,{headers:this.headers});return}if(R){this.conn=new WebSocket(this._endPointURL()),this.setupConnection();return}this.conn=new U(this._endPointURL(),void 0,{close:()=>{this.conn=null}}),r.e(8212).then(r.t.bind(r,68212,23)).then(e=>{let{default:t}=e;this.conn=new t(this._endPointURL(),void 0,{headers:this.headers}),this.setupConnection()})}}disconnect(e,t){this.conn&&(this.conn.onclose=function(){},e?this.conn.close(e,null!=t?t:""):this.conn.close(),this.conn=null,this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.reset())}getChannels(){return this.channels}async removeChannel(e){let t=await e.unsubscribe();return 0===this.channels.length&&this.disconnect(),t}async removeAllChannels(){let e=await Promise.all(this.channels.map(e=>e.unsubscribe()));return this.disconnect(),e}log(e,t,r){this.logger(e,t,r)}connectionState(){switch(this.conn&&this.conn.readyState){case K.connecting:return V.Connecting;case K.open:return V.Open;case K.closing:return V.Closing;default:return V.Closed}}isConnected(){return this.connectionState()===V.Open}channel(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{config:{}},r=new C("realtime:".concat(e),t,this);return this.channels.push(r),r}push(e){let{topic:t,event:r,payload:i,ref:n}=e,s=()=>{this.encode(e,e=>{var t;null===(t=this.conn)||void 0===t||t.send(e)})};this.log("push","".concat(t," ").concat(r," (").concat(n,")"),i),this.isConnected()?s():this.sendBuffer.push(s)}setAuth(e){this.accessToken=e,this.channels.forEach(t=>{e&&t.updateJoinPayload({access_token:e}),t.joinedOnce&&t._isJoined()&&t._push(G.access_token,{access_token:e})})}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let t=this.channels.find(t=>t.topic===e&&(t._isJoined()||t._isJoining()));t&&(this.log("transport",'leaving duplicate topic "'.concat(e,'"')),t.unsubscribe())}_remove(e){this.channels=this.channels.filter(t=>t._joinRef()!==e._joinRef())}setupConnection(){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))}_endPointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:"1.0.0"}))}_onConnMessage(e){this.decode(e.data,e=>{let{topic:t,event:r,payload:i,ref:n}=e;(n&&n===this.pendingHeartbeatRef||r===(null==i?void 0:i.type))&&(this.pendingHeartbeatRef=null),this.log("receive","".concat(i.status||""," ").concat(t," ").concat(r," ").concat(n&&"("+n+")"||""),i),this.channels.filter(e=>
1e._isMember(t)).forEach(e=>e._trigger(r,i,n)),this.stateChangeCallbacks.message.forEach(t=>t(e))})}_onConnOpen(){this.log("transport","connected to ".concat(this._endPointURL())),this._flushSendBuffer(),this.reconnectTimer.reset(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this._sendHeartbeat(),this.heartbeatIntervalMs),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(G.error))}_appendParams(e,t){if(0===Object.keys(t).length)return e;let r=e.match(/\?/)?"&":"?",i=new URLSearchParams(t);return"".concat(e).concat(r).concat(i)}_flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_sendHeartbeat(){var e;if(this.isConnected()){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),null===(e=this.conn)||void 0===e||e.close(1e3,"hearbeat timeout");return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.setAuth(this.accessToken)}}constructor(e,t){var i;this.accessToken=null,this.apiKey=null,this.channels=[],this.endPoint="",this.httpEndpoint="",this.headers=g,this.params={},this.timeout=1e4,this.heartbeatIntervalMs=3e4,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.ref=0,this.logger=x,this.conn=null,this.sendBuffer=[],this.serializer=new y,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this._resolveFetch=e=>{let t;return t=e||("undefined"==typeof fetch?function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];return Promise.resolve().then(r.bind(r,95973)).then(e=>{let{default:r}=e;return r(...t)})}:fetch),function(){for(var e=arguments.length,r=Array(e),i=0;i<e;i++)r[i]=arguments[i];return t(...r)}},this.endPoint="".concat(e,"/").concat(W.websocket),this.httpEndpoint=O(e),(null==t?void 0:t.transport)?this.transport=t.transport:this.transport=null,(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.heartbeatIntervalMs)&&(this.heartbeatIntervalMs=t.heartbeatIntervalMs);let n=null===(i=null==t?void 0:t.params)||void 0===i?void 0:i.apikey;n&&(this.accessToken=n,this.apiKey=n),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 v(async()=>{this.disconnect(),this.connect()},this.reconnectAfterMs),this.fetch=this._resolveFetch(null==t?void 0:t.fetch)}}class U{constructor(e,t,r){this.binaryType="arraybuffer",this.onclose=()=>{},this.onerror=()=>{},this.onmessage=()=>{},this.onopen=()=>{},this.readyState=K.connecting,this.send=()=>{},this.url=null,this.url=e,this.close=r.close}}class L extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function B(e){return"object"==typeof e&&null!==e&&"__isStorageError"in e}class N extends L{toJSON(){return{name:this.name,message:this.message,status:this.status}}constructor(e,t){super(e),this.name="StorageApiError",this.status=t}}class D extends L{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}}let M=e=>{let t;return t=e||("undefined"==typeof fetch?function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];return Promise.resolve().then(r.bind(r,95973)).then(e=>{let{default:r}=e;return r(...t)})}:fetch),function(){for(var e=arguments.length,r=Array(e),i=0;i<e;i++)r[i]=arguments[i];return t(...r)}},q=()=>{var e,t,i,n;return e=void 0,t=void 0,i=void 0,n=function*(){return"undefined"==typeof Response?(yield Promise.resolve().then(r.bind(r,95973))).Response:Response}
1,new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})},F=e=>{if(Array.isArray(e))return e.map(e=>F(e));if("function"==typeof e||e!==Object(e))return e;let t={};return Object.entries(e).forEach(e=>{let[r,i]=e;t[r.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(/[-_]/g,""))]=F(i)}),t};var z,J,K,H,G,W,V,Y,X,$,Q,Z,ee,et,er,ei,en,es,eo,ea,el,ec=function(e,t,r,i){return new(r||(r=Promise))(function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})};let eh=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),eu=(e,t,r)=>ec(void 0,void 0,void 0,function*(){e instanceof(yield q())&&!(null==r?void 0:r.noResolveJson)?e.json().then(r=>{t(new N(eh(r),e.status||500))}).catch(e=>{t(new D(eh(e),e))}):t(new D(eh(e),e))}),ed=(e,t,r,i)=>{let 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),i&&(n.body=JSON.stringify(i)),Object.assign(Object.assign({},n),r))};function ef(e,t,r,i,n,s){return ec(this,void 0,void 0,function*(){return new Promise((o,a)=>{e(r,ed(t,i,n,s)).then(e=>{if(!e.ok)throw e;return(null==i?void 0:i.noResolveJson)?e:e.json()}).then(e=>o(e)).catch(e=>eu(e,a,i))})})}function ep(e,t,r,i){return ec(this,void 0,void 0,function*(){return ef(e,"GET",t,r,i)})}function eg(e,t,r,i,n){return ec(this,void 0,void 0,function*(){return ef(e,"POST",t,i,n,r)})}function ey(e,t,r,i,n){return ec(this,void 0,void 0,function*(){return ef(e,"DELETE",t,i,n,r)})}var ev=r(8620).Buffer,em=function(e,t,r,i){return new(r||(r=Promise))(function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})};let ew={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},eb={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class e_{uploadOrUpdate(e,t,r,i){return em(this,void 0,void 0,function*(){try{let n;let s=Object.assign(Object.assign({},eb),i),o=Object.assign(Object.assign({},this.headers),"POST"===e&&{"x-upsert":String(s.upsert)}),a=s.metadata;"undefined"!=typeof Blob&&r instanceof Blob?((n=new FormData).append("cacheControl",s.cacheControl),n.append("",r),a&&n.append("metadata",this.encodeMetadata(a))):"undefined"!=typeof FormData&&r instanceof FormData?((n=r).append("cacheControl",s.cacheControl),a&&n.append("metadata",this.encodeMetadata(a))):(n=r,o["cache-control"]="max-age=".concat(s.cacheControl),o["content-type"]=s.contentType,a&&(o["x-metadata"]=this.toBase64(this.encodeMetadata(a)))),(null==i?void 0:i.headers)&&(o=Object.assign(Object.assign({},o),i.headers));let l=this._removeEmptyFolders(t),c=this._getFinalPath(l),h=yield this.fetch("".concat(this.url,"/object/").concat(c),Object.assign({method:e,body:n,headers:o},(null==s?void 0:s.duplex)?{duplex:s.duplex}:{})),u=yield h.json();if(h.ok)return{data:{path:l,id:u.Id,fullPath:u.Key},error:null};return{data:null,error:u}}catch(e){if(B(e))return{data:null,error:e};throw e}})}upload(e,t,r){return em(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,t,r)})}uploadToSignedUrl(e,t,r,i){return em(this,void 0,void 0,function*(){let n=this._removeEmptyFolders(e),s=this._getFinalPath(n),o=new URL(this.url+"/object/upload/sign/".concat(s));o.searchParams.set("token",t);try{let e;let t=Object.assign({upsert:eb.upsert},i),s=Object.assign(Object.assign({},this.headers),{"x-upsert":String(t.upsert)});"undefined"!=typeof Blob&&r instanceof Blob?((e=new FormData).append("cacheControl",t.cacheControl),e.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(e=r).append("cacheControl",t.cacheControl):(e=r,s["cache-control"]="max-age=".concat(t.cacheControl),s["content-type"]=t.contentType);let a=yield this.fetch(o.toString(),{method:"PUT",body:e,headers:s}),l=yield a.json();if(a.ok)return{data:{path:n,fullPath:l.Key},error:null};return{data:null,error:l}}catch(e){if(B(e))return{data:null,error:e};throw e}})}createSignedUploadUrl(e,t){return em(this,void 0,void 0,function*(){try{let r=this._getFinalPath(e),i=Object.assign({},this.headers);(null==t?void 0:t.upsert)&&(i["x-upsert"]="true");let n=yield eg(this.fetch,"".concat(this.url,"/object/upload/sign/").concat(r),{},{headers:i}),s=new URL(this.url+n.url),o=s.searchParams.get("token");if(!o)throw new L("No token returned by API");return{data:{signedUrl:s.toString(),path:e,token:o},error:null}}catch(e){if(B(e))return{data:null,error:e};throw e}})}update(e,t,r){return em(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,t,r)})}move(e,t,r){return em(this,void 0,void 0,function*(){try{return{data:yield eg(this.fetch,"".concat(this.url,"/object/move"),{bucketId:this.bucketId,sourceKey:e,destinationKey:t,de
1stinationBucket:null==r?void 0:r.destinationBucket},{headers:this.headers}),error:null}}catch(e){if(B(e))return{data:null,error:e};throw e}})}copy(e,t,r){return em(this,void 0,void 0,function*(){try{return{data:{path:(yield eg(this.fetch,"".concat(this.url,"/object/copy"),{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:this.headers})).Key},error:null}}catch(e){if(B(e))return{data:null,error:e};throw e}})}createSignedUrl(e,t,r){return em(this,void 0,void 0,function*(){try{let i=this._getFinalPath(e),n=yield eg(this.fetch,"".concat(this.url,"/object/sign/").concat(i),Object.assign({expiresIn:t},(null==r?void 0:r.transform)?{transform:r.transform}:{}),{headers:this.headers}),s=(null==r?void 0:r.download)?"&download=".concat(!0===r.download?"":r.download):"";return{data:n={signedUrl:encodeURI("".concat(this.url).concat(n.signedURL).concat(s))},error:null}}catch(e){if(B(e))return{data:null,error:e};throw e}})}createSignedUrls(e,t,r){return em(this,void 0,void 0,function*(){try{let i=yield eg(this.fetch,"".concat(this.url,"/object/sign/").concat(this.bucketId),{expiresIn:t,paths:e},{headers:this.headers}),n=(null==r?void 0:r.download)?"&download=".concat(!0===r.download?"":r.download):"";return{data:i.map(e=>Object.assign(Object.assign({},e),{signedUrl:e.signedURL?encodeURI("".concat(this.url).concat(e.signedURL).concat(n)):null})),error:null}}catch(e){if(B(e))return{data:null,error:e};throw e}})}download(e,t){return em(this,void 0,void 0,function*(){let r=void 0!==(null==t?void 0:t.transform),i=this.transformOptsToQueryString((null==t?void 0:t.transform)||{});try{let t=this._getFinalPath(e),n=yield ep(this.fetch,"".concat(this.url,"/").concat(r?"render/image/authenticated":"object","/").concat(t).concat(i?"?".concat(i):""),{headers:this.headers,noResolveJson:!0});return{data:yield n.blob(),error:null}}catch(e){if(B(e))return{data:null,error:e};throw e}})}info(e){return em(this,void 0,void 0,function*(){let t=this._getFinalPath(e);try{let e=yield ep(this.fetch,"".concat(this.url,"/object/info/").concat(t),{headers:this.headers});return{data:F(e),error:null}}catch(e){if(B(e))return{data:null,error:e};throw e}})}exists(e){return em(this,void 0,void 0,function*(){let t=this._getFinalPath(e);try{return yield function(e,t,r,i){return ec(this,void 0,void 0,function*(){return ef(e,"HEAD",t,Object.assign(Object.assign({},r),{noResolveJson:!0}),void 0)})}(this.fetch,"".concat(this.url,"/object/").concat(t),{headers:this.headers}),{data:!0,error:null}}catch(e){if(B(e)&&e instanceof D){let t=e.originalError;if([400,404].includes(null==t?void 0:t.status))return{data:!1,error:e}}throw e}})}getPublicUrl(e,t){let r=this._getFinalPath(e),i=[],n=(null==t?void 0:t.download)?"download=".concat(!0===t.download?"":t.download):"";""!==n&&i.push(n);let s=void 0!==(null==t?void 0:t.transform),o=this.transformOptsToQueryString((null==t?void 0:t.transform)||{});""!==o&&i.push(o);let a=i.join("&");return""!==a&&(a="?".concat(a)),{data:{publicUrl:encodeURI("".concat(this.url,"/").concat(s?"render/image":"object","/public/").concat(r).concat(a))}}}remove(e){return em(this,void 0,void 0,function*(){try{return{data:yield ey(this.fetch,"".concat(this.url,"/object/").concat(this.bucketId),{prefixes:e},{headers:this.headers}),error:null}}catch(e){if(B(e))return{data:null,error:e};throw e}})}list(e,t,r){return em(this,void 0,void 0,function*(){try{let i=Object.assign(Object.assign(Object.assign({},ew),t),{prefix:e||""});return{data:yield eg(this.fetch,"".concat(this.url,"/object/list/").concat(this.bucketId),i,{headers:this.headers},r),error:null}}catch(e){if(B(e))return{data:null,error:e};throw e}})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return void 0!==ev?ev.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return"".concat(this.bucketId,"/").concat(e)}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){let t=[];return e.width&&t.push("width=".concat(e.width)),e.height&&t.push("height=".concat(e.height)),e.resize&&t.push("resize=".concat(e.resize)),e.format&&t.push("format=".concat(e.format)),e.quality&&t.push("quality=".concat(e.quality)),t.join("&")}constructor(e,t={},r,i){this.url=e,this.headers=t,this.bucketId=r,this.fetch=M(i)}}let ek={"X-Client-Info":"storage-js/".concat("2.7.0")};var eS=function(e,t,r,i){return new(r||(r=Promise))(function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})};class eT{listBuckets(){return eS(this,void 0,void 0,function*(){try{return{data:yield ep(this.fetch,"".concat(this.url,"/bucket"),{headers:this.headers}),error:null}}catch(e){if(B(e))return{data:null,error:e};throw e}})}getBucket(e){return eS(this,void 0,void 0,function*(){try{return{data:yield ep(this.fetch,"".concat(this.url,"/bucket/").concat(e),{headers:this.headers}),error:null}}catch(e){if(B(e))return{data:null,error:e};throw e}})}createBucket(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{public:!1};return eS(this,void 0,void 0,function*(){try{return{data:yield eg(this.fetch,"".concat(this.url,"/bucket"),{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(e){if(B(e))return{data:null,error:e};throw e}})}updateBucket(e,t){return eS(this,void 0,void 0,function*(){try{return{data:yield function(e,t,r,i,n){return ec(this,void 0,void 0,function*(){return ef(e,"PUT",t,i,void 0,r)})}(this.fetch,"".concat(this.url,"/bucket/").concat(e),{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(e){if(B(e))return{data:null,error:e};throw e}})}emptyBucket(e){return eS(this,void 0,void 0,function*(){try{return{data:yield eg(this.fetch,"".concat(this.url,"/bucket/").concat(e,"/empty"),{},{headers:this.headers}),error:null}}catch(e){if(B(e))return{data:null,error:e};throw e}})}deleteBucket(e){return eS(this,void 0,void 0,function*(){try{return{data:yield ey(this.fetch,"".concat(this.url,"/bucket/").concat(e),{},{headers:this.headers}),error:null}}catch(e){if(B(e))return{data:null,error:e};throw e}})}constructor(e,t={},r){this.url=e,this.headers=Object.assign(Object.assign({},ek),t),this.fetch=M(r)}}class eE extends eT{from(e){return new e_(this.url,this.headers,e,this.fetch)}constructor(e,t={},r){super(e,t,r)}}let eA="";eA="undefined"!=typeof Deno?"deno":"undefined"!=typeof document?"web":"undefined"!=typeof navigator&&"ReactNative"===navigator.product?"react-native":"node";let eO={headers:{"X-Client-Info":"supabase-js-".concat(eA,"/").concat("2.45.4")}},ej={schema:"public"},eP={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},eC={};var ex=r(95973);let eR=e=>{let t;return t=e||("undefined"==typeof fetch?ex.default:fetch),function(){for(var e=arguments.length,r=Array(e),i=0;i<e;i++)r[i]=arguments[i];return t(...r)}},eI=()=>"undefined"==typeof Headers?ex.Headers:Headers,eU=(e,t,r)=>{let i=eR(r),n=eI();return(r,s)=>{var o,a,l,c;return o=void 0,a=void 0,l=void 0,c=function*(){var o;let a=null!==(o=yield t())&&void 0!==o?o:e,l=new n(null==s?void 0:s.headers);return l.has("apikey")||l.set("apikey",e),l.has("Authorization")||l.set("Authorization","Bearer ".concat(a)),i(r,Object.assign(Object.assign({},s),{headers:l}))},new(l||(l=Promise))(function(e,t){function r(e){try{n(c.next(e))}catch(e){t(e)}}function i(e){try{n(c.throw(e))}catch(e){t(e)}}function n(t){var n;t.done?e(t.value):((n=t.value)instanceof l?n:new l(function(e){e(n)})).then(r,i)}n((c=c.apply(o,a||[])).next())})}},eL="2.65.0",eB="X-Supabase-Api-Version",eN={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},eD=()=>"undefined"!=typeof document,eM={tested:!1,writable:!1},eq=()=>{if(!eD())return!1;try{if("object"!=typeof globalThis.localStorage)return!1}catch(e){return!1}if(eM.tested)return eM.writable;let e="lswt-".concat(Math.random()).concat(Math.random());try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),eM.tested=!0,eM.writable=!0}catch(e){eM.tested=!0,eM.writable=!1}return eM.writable};function eF(e){let t={},r=new URL(e);if(r.hash&&"#"===r.hash[0])try{new URLSearchParams(r.hash.substring(1)).forEac
1h((e,r)=>{t[r]=e})}catch(e){}return r.searchParams.forEach((e,r)=>{t[r]=e}),t}let ez=e=>{let t;return t=e||("undefined"==typeof fetch?function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];return Promise.resolve().then(r.bind(r,95973)).then(e=>{let{default:r}=e;return r(...t)})}:fetch),function(){for(var e=arguments.length,r=Array(e),i=0;i<e;i++)r[i]=arguments[i];return t(...r)}},eJ=e=>"object"==typeof e&&null!==e&&"status"in e&&"ok"in e&&"json"in e&&"function"==typeof e.json,eK=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))},eH=async(e,t)=>{let r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch(e){return r}},eG=async(e,t)=>{await e.removeItem(t)};class eW{constructor(){this.promise=new eW.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}function eV(e){let t=e.split(".");if(3!==t.length)throw Error("JWT is not valid: not a JWT structure");if(!/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}=?$|[a-z0-9_-]{2}(==)?$)$/i.test(t[1]))throw Error("JWT is not valid: payload is not in base64url format");return JSON.parse(function(e){let t,r,i,n,s,o,a;let l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c="",h=0;for(e=e.replace("-","+").replace("_","/");h<e.length;)n=l.indexOf(e.charAt(h++)),s=l.indexOf(e.charAt(h++)),o=l.indexOf(e.charAt(h++)),a=l.indexOf(e.charAt(h++)),t=n<<2|s>>4,r=(15&s)<<4|o>>2,i=(3&o)<<6|a,c+=String.fromCharCode(t),64!=o&&0!=r&&(c+=String.fromCharCode(r)),64!=a&&0!=i&&(c+=String.fromCharCode(i));return c}(t[1]))}async function eY(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function eX(e){return("0"+e.toString(16)).substr(-2)}async function e$(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(r)).map(e=>String.fromCharCode(e)).join("")}async function eQ(e){return"undefined"!=typeof crypto&&void 0!==crypto.subtle&&"undefined"!=typeof TextEncoder?btoa(await e$(e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):(console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e)}async function eZ(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=function(){let e=new Uint32Array(56);if("undefined"==typeof crypto){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",t=e.length,r="";for(let i=0;i<56;i++)r+=e.charAt(Math.floor(Math.random()*t));return r}return crypto.getRandomValues(e),Array.from(e,eX).join("")}(),n=i;r&&(n+="/PASSWORD_RECOVERY"),await eK(e,"".concat(t,"-code-verifier"),n);let s=await eQ(i),o=i===s?"plain":"s256";return[s,o]}eW.promiseConstructor=Promise;let e0=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;class e1 extends Error{constructor(e,t,r){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t,this.code=r}}function e2(e){return"object"==typeof e&&null!==e&&"__isAuthError"in e}class e6 extends e1{constructor(e,t,r){super(e,t,r),this.name="AuthApiError",this.status=t,this.code=r}}class e3 extends e1{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}}
1class e5 extends e1{constructor(e,t,r,i){super(e,r,i),this.name=t,this.status=r}}class e8 extends e5{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}class e4 extends e5{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class e9 extends e5{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class e7 extends e5{toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}constructor(e,t=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=t}}class te extends e5{toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}constructor(e,t=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=t}}class tt extends e5{constructor(e,t){super(e,"AuthRetryableFetchError",t,void 0)}}function tr(e){return e2(e)&&"AuthRetryableFetchError"===e.name}class ti extends e5{constructor(e,t,r){super(e,"AuthWeakPasswordError",t,"weak_password"),this.reasons=r}}var tn=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)0>t.indexOf(i[n])&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r};let ts=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),to=[502,503,504];async function ta(e){var t;let r,i;if(!eJ(e))throw new tt(ts(e),0);if(to.includes(e.status))throw new tt(ts(e),e.status);try{r=await e.json()}catch(e){throw new e3(ts(e),e)}let n=function(e){let t=e.headers.get(eB);if(!t||!t.match(e0))return null;try{return new Date("".concat(t,"T00:00:00.0Z"))}catch(e){return null}}(e);if(n&&n.getTime()>=eN["2024-01-01"].timestamp&&"object"==typeof r&&r&&"string"==typeof r.code?i=r.code:"object"==typeof r&&r&&"string"==typeof r.error_code&&(i=r.error_code),i){if("weak_password"===i)throw new ti(ts(r),e.status,(null===(t=r.weak_password)||void 0===t?void 0:t.reasons)||[]);if("session_not_found"===i)throw new e8}else if("object"==typeof r&&r&&"object"==typeof r.weak_password&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((e,t)=>e&&"string"==typeof t,!0))throw new ti(ts(r),e.status,r.weak_password.reasons);throw new e6(ts(r),e.status||500,i)}let tl=(e,t,r,i)=>{let n={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"===e?n:(n.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},null==t?void 0:t.headers),n.body=JSON.stringify(i),Object.assign(Object.assign({},n),r))};async function tc(e,t,r,i){var n;let s=Object.assign({},null==i?void 0:i.headers);s[eB]||(s[eB]=eN["2024-01-01"].name),(null==i?void 0:i.jwt)&&(s.Authorization="Bearer ".concat(i.jwt));let o=null!==(n=null==i?void 0:i.query)&&void 0!==n?n:{};(null==i?void 0:i.redirectTo)&&(o.redirect_to=i.redirectTo);let a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",l=await th(e,t,r+a,{headers:s,noResolveJson:null==i?void 0:i.noResolveJson},{},null==i?void 0:i.body);return(null==i?void 0:i.xform)?null==i?void 0:i.xform(l):{data:Object.assign({},l),error:null}}async function th(e,t,r,i,n,s){let o;let a=tl(t,i,n,s);try{o=await e(r,Object.assign({},a))}catch(e){throw console.error(e),new tt(ts(e),0)}if(o.ok||await ta(o),null==i?void 0:i.noResolveJson)return o;try{return await o.json()}catch(e){await ta(e)}}function tu(e){var t,r;let i=null;return e.access_token&&e.refresh_token&&e.expires_in&&(i=Object.assign({},e),!e.expires_at)&&(i.expires_at=(r=e.expires_in,Math.round(Date.now()/1e3)+r)),{data:{session:i,user:null!==(t=e.user)&&void 0!==t?t:e},error:null}}function td(e){let t=tu(e);return!t.error&&e.weak_password&&"object"==typeof e.weak_password&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&"string"==typeof e.weak_password.message&&e.weak_password.reasons.reduce((e,t)=>e&&"string"==typeof t,!0)&&(t.data.weak_password=e.weak_password),t}function tf(e){var t;return{data:{user:null!==(t=e.user)&&void 0!==t?t:e},error:null}}function tp(e){return{data:e,error:null}}function tg(e){let{action_link:t,email_otp:r,hashed_token:i,redirect_to:n,verification_type:s}=e;return{data:{properties:{action_link:t,email_otp:r,hashed_token:i,redirect_to:n,verification_type:s},user:Object.assign({},tn(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]))},error:null}}function ty(e){return e}var tv=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)0>t.indexOf(i[n])&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r};class tm{async signOut(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"global";try{return await tc(this.fetch,"POST","".concat(this.url,"/logout?scope=").concat(t),{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(e){if(e2(e))return{data:null,error:e};throw e}}async inviteUserByEmail(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{return await tc(this.fetch,"POST","".concat(this.url,"/invite"),{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:tf})}catch(e){if(e2(e))return{data:{user:null},error:e};throw e}}async generateLink(e){try{let{options:t}=e,r=tv(e,["options"]),i=Object.assign(Object.assign({},r),t);return"newEmail"in r&&(i.new_email=null==r?void 0:r.newEmail,delete i.newEmail),await tc(this.fetch,"POST","".concat(this.url,"/admin/generate_link"),{body:i,headers:this.headers,xform:tg,redirectTo:null==t?void 0:t.redirectTo})}catch(e){if(e2(e))return{data:{properties:null,user:null},error:e};throw e}}async createUser(e){try{return await tc(this.fetch,"POST","".concat(this.url,"/admin/users"),{body:e,headers:this.headers,xform:tf})}catch(e){if(e2(e))return{data:{user:null},error:e};throw e}}async listUsers(e){var t,r,i,n,s,o,a;try{let l={nextPage:null,lastPage:0,total:0},c=await tc(this.fetch,"GET","".concat(this.url,"/admin/users"),{headers:this.headers,noResolveJson:!0,query:{page:null!==(r=null===(t=null==e?void 0:e.page)||void 0===t?void 0:t.toString())&&void 0!==r?r:"",per_page:null!==(n=null===(i=null==e?void 0:e.perPage)||void 0===i?void 0:i.toString())&&void 0!==n?n:""},xform:ty});if(c.error)throw c.error;let h=await c.json(),u=null!==(s=c.headers.get("x-total-count"))&&void 0!==s?s:0,d=null!==(a=null===(o=c.headers.get("link"))||void 0===o?void 0:o.split(","))&&void 0!==a?a:[];return d.length>
10&&(d.forEach(e=>{let t=parseInt(e.split(";")[0].split("=")[1].substring(0,1)),r=JSON.parse(e.split(";")[1].split("=")[1]);l["".concat(r,"Page")]=t}),l.total=parseInt(u)),{data:Object.assign(Object.assign({},h),l),error:null}}catch(e){if(e2(e))return{data:{users:[]},error:e};throw e}}async getUserById(e){try{return await tc(this.fetch,"GET","".concat(this.url,"/admin/users/").concat(e),{headers:this.headers,xform:tf})}catch(e){if(e2(e))return{data:{user:null},error:e};throw e}}async updateUserById(e,t){try{return await tc(this.fetch,"PUT","".concat(this.url,"/admin/users/").concat(e),{body:t,headers:this.headers,xform:tf})}catch(e){if(e2(e))return{data:{user:null},error:e};throw e}}async deleteUser(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];try{return await tc(this.fetch,"DELETE","".concat(this.url,"/admin/users/").concat(e),{headers:this.headers,body:{should_soft_delete:t},xform:tf})}catch(e){if(e2(e))return{data:{user:null},error:e};throw e}}async _listFactors(e){try{let{data:t,error:r}=await tc(this.fetch,"GET","".concat(this.url,"/admin/users/").concat(e.userId,"/factors"),{headers:this.headers,xform:e=>({data:{factors:e},error:null})});return{data:t,error:r}}catch(e){if(e2(e))return{data:null,error:e};throw e}}async _deleteFactor(e){try{return{data:await tc(this.fetch,"DELETE","".concat(this.url,"/admin/users/").concat(e.userId,"/factors/").concat(e.id),{headers:this.headers}),error:null}}catch(e){if(e2(e))return{data:null,error:e};throw e}}constructor({url:e="",headers:t={},fetch:r}){this.url=e,this.headers=t,this.fetch=ez(r),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)}}}let tw={getItem:e=>eq()?globalThis.localStorage.getItem(e):null,setItem:(e,t)=>{eq()&&globalThis.localStorage.setItem(e,t)},removeItem:e=>{eq()&&globalThis.localStorage.removeItem(e)}};function tb(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}let t_={debug:!!(globalThis&&eq()&&globalThis.localStorage&&"true"===globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug"))};class tk extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class tS extends tk{}async function tT(e,t,r){t_.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);let i=new globalThis.AbortController;return t>0&&setTimeout(()=>{i.abort(),t_.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),await globalThis.navigator.locks.request(e,0===t?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:i.signal},async i=>{if(i){t_.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,i.name);try{return await r()}finally{t_.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,i.name)}}else{if(0===t)throw t_.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new tS('Acquiring an exclusive Navigator LockManager lock "'.concat(e,'" immediately failed'));if(t_.debug)try{let e=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(e,null,"  "))}catch(e){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",e)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await r()}})}!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)}}();let tE={url:"http://localhost:9999",storageKey:"supabase.auth.token",autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:{"X-Client-Info":"gotrue-js/".concat(eL)},flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function tA(e,t,r){return await r()}class tO{_debug(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.logDebugMessages&&this.logger("GoTrueClient@".concat(this.instanceID," (").concat(eL,") ").concat(new Date().toISOString()),...t),this}async initialize(){return this.initializePromise||(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))()),await this.initializePromise}async _initialize(){try{let e=!!eD()&&await this._isPKCEFlow();if(this._debug("#_initialize()","begin","is PKCE flow",e),e||this.detectSessionInUrl&&this._isImplicitGrantFlow()){let{data:t,error:r}=await this._getSessionFromURL(e);if(r){if(this._debug("#_initialize()","error detecting session from URL",r),(null==r?void 0:r.message)==="Identity is already linked"||(null==r?void 0:r.message)==="Identity is already linked to another user")return{error:r};return await this._removeSession(),{error:r}}let{session:i,redirectType:n}=t;return this._debug("#_initialize()","detected session in URL",i,"redirect type",n),await this._saveSession(i),setTimeout(async()=>{"recovery"===n?await this._notifyAllSubscribers("PASSWORD_RECOVERY",i):await this._notifyAllSubscribers("SIGNED_IN",i)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){if(e2(e))return{error:e};return{error:new e3("Unexpected error during initialization",e)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var t,r,i;try{let{data:n,error:s}=await tc(this.fetch,"POST","".concat(this.url,"/signup"),{headers:this.headers,body:{data:null!==(r=null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.data)&&void 0!==r?r:{},gotrue_meta_security:{captcha_token:null===(i=null==e?void 0:e.options)||void 0===i?void 0:i.captchaToken}},xform:tu});if(s||!n)return{data:{user:null,session:null},error:s};let o=n.session,a=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",o)),{data:{user:a,session:o},error:null}}catch(e){if(e2(e))return{data:{user:null,session:null},error:e};throw e}}async signUp(e){var t,r,i;try{let n;if("email"in e){let{email:r,password:i,options:s}=e,o=null,a=null;"pkce"===this.flowType&&([o,a]=await eZ(this.storage,this.storageKey)),n=await tc(this.fetch,"POST","".concat(this.url,"/signup"),{headers:this.headers,redirectTo:null==s?void 0:s.emailRedirectTo,body:{email:r,password:i,data:null!==(t=null==s?void 0:s.data)&&void 0!==t?t:{},gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}
1,code_challenge:o,code_challenge_method:a},xform:tu})}else if("phone"in e){let{phone:t,password:s,options:o}=e;n=await tc(this.fetch,"POST","".concat(this.url,"/signup"),{headers:this.headers,body:{phone:t,password:s,data:null!==(r=null==o?void 0:o.data)&&void 0!==r?r:{},channel:null!==(i=null==o?void 0:o.channel)&&void 0!==i?i:"sms",gotrue_meta_security:{captcha_token:null==o?void 0:o.captchaToken}},xform:tu})}else throw new e9("You must provide either an email or phone number and a password");let{data:s,error:o}=n;if(o||!s)return{data:{user:null,session:null},error:o};let a=s.session,l=s.user;return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",a)),{data:{user:l,session:a},error:null}}catch(e){if(e2(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithPassword(e){try{let t;if("email"in e){let{email:r,password:i,options:n}=e;t=await tc(this.fetch,"POST","".concat(this.url,"/token?grant_type=password"),{headers:this.headers,body:{email:r,password:i,gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken}},xform:td})}else if("phone"in e){let{phone:r,password:i,options:n}=e;t=await tc(this.fetch,"POST","".concat(this.url,"/token?grant_type=password"),{headers:this.headers,body:{phone:r,password:i,gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken}},xform:td})}else throw new e9("You must provide either an email or phone number and a password");let{data:r,error:i}=t;if(i)return{data:{user:null,session:null},error:i};if(!r||!r.session||!r.user)return{data:{user:null,session:null},error:new e4};return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),{data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:i}}catch(e){if(e2(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithOAuth(e){var t,r,i,n;return await this._handleProviderSignIn(e.provider,{redirectTo:null===(t=e.options)||void 0===t?void 0:t.redirectTo,scopes:null===(r=e.options)||void 0===r?void 0:r.scopes,queryParams:null===(i=e.options)||void 0===i?void 0:i.queryParams,skipBrowserRedirect:null===(n=e.options)||void 0===n?void 0:n.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async _exchangeCodeForSession(e){let t=await eH(this.storage,"".concat(this.storageKey,"-code-verifier")),[r,i]=(null!=t?t:"").split("/");try{let{data:t,error:n}=await tc(this.fetch,"POST","".concat(this.url,"/token?grant_type=pkce"),{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:tu});if(await eG(this.storage,"".concat(this.storageKey,"-code-verifier")),n)throw n;if(!t||!t.session||!t.user)return{data:{user:null,session:null,redirectType:null},error:new e4};return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),{data:Object.assign(Object.assign({},t),{redirectType:null!=i?i:null}),error:n}}catch(e){if(e2(e))return{data:{user:null,session:null,redirectType:null},error:e};throw e}}async signInWithIdToken(e){try{let{options:t,provider:r,token:i,access_token:n,nonce:s}=e,{data:o,error:a}=await tc(this.fetch,"POST","".concat(this.url,"/token?grant_type=id_token"),{headers:this.headers,body:{provider:r,id_token:i,access_token:n,nonce:s,gotrue_meta_security:{captcha_token:null==t?void 0:t.captchaToken}},xform:tu});if(a)return{data:{user:null,session:null},error:a};if(!o||!o.session||!o.user)return{data:{user:null,session:null},error:new e4};return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",o.session)),{data:o,error:a}}catch(e){if(e2(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithOtp(e){var t,r,i,n,s;try{if("email"in e){let{email:i,options:n}=e,s=null,o=null;"pkce"===this.flowType&&([s,o]=await eZ(this.storage,this.storageKey));let{error:a}=await tc(this.fetch,"POST","".concat(this.url,"/otp"),{headers:this.headers,body:{email:i,data:null!==(t=null==n?void 0:n.data)&&void 0!==t?t:{}
1,create_user:null===(r=null==n?void 0:n.shouldCreateUser)||void 0===r||r,gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken},code_challenge:s,code_challenge_method:o},redirectTo:null==n?void 0:n.emailRedirectTo});return{data:{user:null,session:null},error:a}}if("phone"in e){let{phone:t,options:r}=e,{data:o,error:a}=await tc(this.fetch,"POST","".concat(this.url,"/otp"),{headers:this.headers,body:{phone:t,data:null!==(i=null==r?void 0:r.data)&&void 0!==i?i:{},create_user:null===(n=null==r?void 0:r.shouldCreateUser)||void 0===n||n,gotrue_meta_security:{captcha_token:null==r?void 0:r.captchaToken},channel:null!==(s=null==r?void 0:r.channel)&&void 0!==s?s:"sms"}});return{data:{user:null,session:null,messageId:null==o?void 0:o.message_id},error:a}}throw new e9("You must provide either an email or phone number.")}catch(e){if(e2(e))return{data:{user:null,session:null},error:e};throw e}}async verifyOtp(e){var t,r;try{let i,n;"options"in e&&(i=null===(t=e.options)||void 0===t?void 0:t.redirectTo,n=null===(r=e.options)||void 0===r?void 0:r.captchaToken);let{data:s,error:o}=await tc(this.fetch,"POST","".concat(this.url,"/verify"),{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:n}}),redirectTo:i,xform:tu});if(o)throw o;if(!s)throw Error("An error occurred on token verification.");let a=s.session,l=s.user;return(null==a?void 0:a.access_token)&&(await this._saveSession(a),await this._notifyAllSubscribers("recovery"==e.type?"PASSWORD_RECOVERY":"SIGNED_IN",a)),{data:{user:l,session:a},error:null}}catch(e){if(e2(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithSSO(e){var t,r,i;try{let n=null,s=null;return"pkce"===this.flowType&&([n,s]=await eZ(this.storage,this.storageKey)),await tc(this.fetch,"POST","".concat(this.url,"/sso"),{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:null!==(r=null===(t=e.options)||void 0===t?void 0:t.redirectTo)&&void 0!==r?r:void 0}),(null===(i=null==e?void 0:e.options)||void 0===i?void 0:i.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:n,code_challenge_method:s}),headers:this.headers,xform:tp})}catch(e){if(e2(e))return{data:null,error:e};throw e}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{let{data:{session:t},error:r}=e;if(r)throw r;if(!t)throw new e8;let{error:i}=await tc(this.fetch,"GET","".concat(this.url,"/reauthenticate"),{headers:this.headers,jwt:t.access_token});return{data:{user:null,session:null},error:i}})}catch(e){if(e2(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{let t="".concat(this.url,"/resend");if("email"in e){let{email:r,type:i,options:n}=e,{error:s}=await tc(this.fetch,"POST",t,{headers:this.headers,body:{email:r,type:i,gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken}},redirectTo:null==n?void 0:n.emailRedirectTo});return{data:{user:null,session:null},error:s}}if("phone"in e){let{phone:r,type:i,options:n}=e,{data:s,error:o}=await tc(this.fetch,"POST",t,{headers:this.headers,body:{phone:r,type:i,gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken}}});return{data:{user:null,session:null,messageId:null==s?void 0:s.message_id},error:o}}throw new e9("You must provide either an email or phone number and a type")}catch(e){if(e2(e))return{data:{user:null,session:null},error:e};throw e}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async e=>e))}async _acquireLock(e,t){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){let e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),r=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await r}catch(e){}})()),r}return await this.lock("lock:".concat(this.storageKey),e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;let e=t();for(this.pendingInLock.push((async()=>{try{await e}catch(e){}})()),await e;this.pendingInLock.length;){let e=[...this.pendingInLock];await Promise.all(e),this.pendingInLock.splice(0,e.length)}return await e}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{let t=await this.__loadSession();return await e(t)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",Error().stack);try{let e=null,t=await eH(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",t),null!==t&&(this._isValidSession(t)?e=t:(this._debug("#getSession()","session from storage is not val
1id"),await this._removeSession())),!e)return{data:{session:null},error:null};let r=!!e.expires_at&&e.expires_at<=Date.now()/1e3;if(this._debug("#__loadSession()","session has".concat(r?"":" not"," expired"),"expires_at",e.expires_at),!r){if(this.storage.isServer){let t=this.suppressGetSessionWarning;e=new Proxy(e,{get:(e,r,i)=>(t||"user"!==r||(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and many not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),t=!0,this.suppressGetSessionWarning=!0),Reflect.get(e,r,i))})}return{data:{session:e},error:null}}let{session:i,error:n}=await this._callRefreshToken(e.refresh_token);if(n)return{data:{session:null},error:n};return{data:{session:i},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(e){try{if(e)return await tc(this.fetch,"GET","".concat(this.url,"/user"),{headers:this.headers,jwt:e,xform:tf});return await this._useSession(async e=>{var t,r,i;let{data:n,error:s}=e;if(s)throw s;return(null===(t=n.session)||void 0===t?void 0:t.access_token)||this.hasCustomAuthorizationHeader?await tc(this.fetch,"GET","".concat(this.url,"/user"),{headers:this.headers,jwt:null!==(i=null===(r=n.session)||void 0===r?void 0:r.access_token)&&void 0!==i?i:void 0,xform:tf}):{data:{user:null},error:new e8}})}catch(e){if(e2(e))return e2(e)&&"AuthSessionMissingError"===e.name&&(await this._removeSession(),await eG(this.storage,"".concat(this.storageKey,"-code-verifier")),await this._notifyAllSubscribers("SIGNED_OUT",null)),{data:{user:null},error:e};throw e}}async updateUser(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,t))}async _updateUser(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{return await this._useSession(async r=>{let{data:i,error:n}=r;if(n)throw n;if(!i.session)throw new e8;let s=i.session,o=null,a=null;"pkce"===this.flowType&&null!=e.email&&([o,a]=await eZ(this.storage,this.storageKey));let{data:l,error:c}=await tc(this.fetch,"PUT","".concat(this.url,"/user"),{headers:this.headers,redirectTo:null==t?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:o,code_challenge_method:a}),jwt:s.access_token,xform:tf});if(c)throw c;return s.user=l.user,await this._saveSession(s),await this._notifyAllSubscribers("USER_UPDATED",s),{data:{user:s.user},error:null}})}catch(e){if(e2(e))return{data:{user:null},error:e};throw e}}_decodeJWT(e){return eV(e)}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new e8;let t=Date.now()/1e3,r=t,i=!0,n=null,s=eV(e.access_token);if(s.exp&&(i=(r=s.exp)<=t),i){let{session:t,error:r}=await this._callRefreshToken(e.refresh_token);if(r)return{data:{user:null,session:null},error:r};if(!t)return{data:{user:null,session:null},error:null};n=t}else{let{data:i,error:s}=await this._getUser(e.access_token);if(s)throw s;n={access_token:e.access_token,refresh_token:e.refresh_token,user:i.user,token_type:"bearer",expires_in:r-t,expires_at:r},await this._saveSession(n),await this._notifyAllSubscribers("SIGNED_IN",n)}return{data:{user:n.user,session:n},error:null}}catch(e){if(e2(e))return{data:{session:null,user:null},error:e};throw e}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async t=>{var r;if(!e){let{data:i,error:n}=t;if(n)throw n;e=null!==(r=i.session)&&void 0!==r?r:void 0}if(!(null==e?void 0:e.refresh_token))throw new e8;let{session:i,error:n}=await this._callRefreshToken(e.refresh_token);return n?{data:{user:null,session:null},error:n}:i?{data:{user:i.user,session:i},error:null}:{data:{user:null,session:null},error:null}})}catch(e){if(e2(e))return{data:{user:null,session:null},error:e};throw e}}async _getSessionFromURL(e){try{if(!eD())throw new e7("No browser detected.");
1if("implicit"!==this.flowType||this._isImplicitGrantFlow()){if("pkce"==this.flowType&&!e)throw new te("Not a valid PKCE flow url.")}else throw new e7("Not a valid implicit grant flow url.");let t=eF(window.location.href);if(e){if(!t.code)throw new te("No code detected.");let{data:e,error:r}=await this._exchangeCodeForSession(t.code);if(r)throw r;let i=new URL(window.location.href);return i.searchParams.delete("code"),window.history.replaceState(window.history.state,"",i.toString()),{data:{session:e.session,redirectType:null},error:null}}if(t.error||t.error_description||t.error_code)throw new e7(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});let{provider_token:r,provider_refresh_token:i,access_token:n,refresh_token:s,expires_in:o,expires_at:a,token_type:l}=t;if(!n||!o||!s||!l)throw new e7("No session defined in URL");let c=Math.round(Date.now()/1e3),h=parseInt(o),u=c+h;a&&(u=parseInt(a));let d=u-c;1e3*d<=3e4&&console.warn("@supabase/gotrue-js: Session as retrieved from URL expires in ".concat(d,"s, should have been closer to ").concat(h,"s"));let f=u-h;c-f>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",f,u,c):c-f<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",f,u,c);let{data:p,error:g}=await this._getUser(n);if(g)throw g;let y={provider_token:r,provider_refresh_token:i,access_token:n,expires_in:h,expires_at:u,refresh_token:s,token_type:l,user:p.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:y,redirectType:t.type},error:null}}catch(e){if(e2(e))return{data:{session:null,redirectType:null},error:e};throw e}}_isImplicitGrantFlow(){let e=eF(window.location.href);return!!(eD()&&(e.access_token||e.error_description))}async _isPKCEFlow(){let e=eF(window.location.href),t=await eH(this.storage,"".concat(this.storageKey,"-code-verifier"));return!!(e.code&&t)}async signOut(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{scope:"global"};return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut(){let{scope:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{scope:"global"};return await this._useSession(async t=>{var r;let{data:i,error:n}=t;if(n)return{error:n};let s=null===(r=i.session)||void 0===r?void 0:r.access_token;if(s){let{error:t}=await this.admin.signOut(s,e);if(t&&!(e2(t)&&"AuthApiError"===t.name&&(404===t.status||401===t.status||403===t.status)))return{error:t}}return"others"!==e&&(await this._removeSession(),await eG(this.storage,"".concat(this.storageKey,"-code-verifier")),await this._notifyAllSubscribers("SIGNED_OUT",null)),{error:null}})}onAuthStateChange(e){let t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}),r={id:t,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",t),this.stateChangeEmitters.delete(t)}};return this._debug("#onAuthStateChange()","registered callback with id",t),this.stateChangeEmitters.set(t,r),(async()=>{await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(t)})})(),{data:{subscription:r}}}async _emitInitialSession(e){return await this._useSession(async t=>{var r,i;try{let{data:{session:i},error:n}=t;if(n)throw n;await (null===(r=this.stateChangeEmitters.get(e))||void 0===r?void 0:r.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",e,"session",i)}catch(t){await (null===(i=this.stateChangeEmitters.get(e))||void 0===i?void 0:i.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",t),console.error(t)}})}async resetPasswordForEmail(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,i=null;"pkce"===this.flowType&&([r,i]=await eZ(this.storage,this.storageKey,!0));try{return await tc(this.fetch,"POST","".concat(this.url,"/recover"),{body:{email:e,code_challenge:r,code_challenge_method:i,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(e){if(e2(e))return{data:null,error:e};throw e}}async getUserIdentities(){var e;try{let{data:t,error:r}=await this.getUser();if(r)throw r;return{data:{identities:null!==(e=t.user.identities)&&void 0!==e?e:[]},error:null}}catch(e){if(e2(e))return{data:null,error:e};throw e}}async linkIdentity(e){var t;try{let{data:r,error:i}=await this._useSession(async t=>{var r,i,n,s,o;let{data:a,error:l}=t;if(l)throw l;let c=await this._getUrlForProvider("".concat(this.url,"/user/identities/authorize"),e.provider,{redirectTo:null===(r=e.options)||void 0===r?void 0:r.redirectTo,scopes:null===(i=e.options)||void 0===i?void 0:i.scopes,queryParams:null===(n=e.options)||void 0===n?void 0:n.queryParams,skipBrowserRedirect:!0});return await tc(this.fetch,"GET",c,{headers:this.headers,jwt:null!==(o=null===(s=a.session)||void 0===s?void 0:s.access_token)&&void 0!==o?o:void 0})});if(i)throw i;return!eD()||(null===(t=e.options)||void 0===t?void 0:t.skipBrowserRedirect)||window.location.assign(null==r?void 0:r.url),{data:{provider:e.provider,url:null==r?void 0:r.url},error:null}}catch(t){if(e2(t))return{data:{provider:e.provider,url:null},error:t};throw t}}async unlinkIdentity(e){try{return await this._useSession(async t=>{var r,i;let{data:n,error:s}=t;if(s)throw s;
1return await tc(this.fetch,"DELETE","".concat(this.url,"/user/identities/").concat(e.identity_id),{headers:this.headers,jwt:null!==(i=null===(r=n.session)||void 0===r?void 0:r.access_token)&&void 0!==i?i:void 0})})}catch(e){if(e2(e))return{data:null,error:e};throw e}}async _refreshAccessToken(e){let t="#_refreshAccessToken(".concat(e.substring(0,5),"...)");this._debug(t,"begin");try{var r,i;let n=Date.now();return await (r=async r=>(r>0&&await eY(200*Math.pow(2,r-1)),this._debug(t,"refreshing attempt",r),await tc(this.fetch,"POST","".concat(this.url,"/token?grant_type=refresh_token"),{body:{refresh_token:e},headers:this.headers,xform:tu})),i=(e,t)=>t&&tr(t)&&Date.now()+200*Math.pow(2,e)-n<3e4,new Promise((e,t)=>{(async()=>{for(let n=0;n<1/0;n++)try{let t=await r(n);if(!i(n,null,t)){e(t);return}}catch(e){if(!i(n,e)){t(e);return}}})()}))}catch(e){if(this._debug(t,"error",e),e2(e))return{data:{session:null,user:null},error:e};throw e}finally{this._debug(t,"end")}}_isValidSession(e){return"object"==typeof e&&null!==e&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,t){let r=await this._getUrlForProvider("".concat(this.url,"/authorize"),e,{redirectTo:t.redirectTo,scopes:t.scopes,queryParams:t.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",t,"url",r),eD()&&!t.skipBrowserRedirect&&window.location.assign(r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e;let t="#_recoverAndRefresh()";this._debug(t,"begin");try{let r=await eH(this.storage,this.storageKey);if(this._debug(t,"session from storage",r),!this._isValidSession(r)){this._debug(t,"session is not valid"),null!==r&&await this._removeSession();return}let i=Math.round(Date.now()/1e3),n=(null!==(e=r.expires_at)&&void 0!==e?e:1/0)<i+10;if(this._debug(t,"session has".concat(n?"":" not"," expired with margin of ").concat(10,"s")),n){if(this.autoRefreshToken&&r.refresh_token){let{error:e}=await this._callRefreshToken(r.refresh_token);e&&(console.error(e),tr(e)||(this._debug(t,"refresh failed with a non-retryable error, removing the session",e),await this._removeSession()))}}else await this._notifyAllSubscribers("SIGNED_IN",r)}catch(e){this._debug(t,"error",e),console.error(e);return}finally{this._debug(t,"end")}}async _callRefreshToken(e){var t,r;if(!e)throw new e8;if(this.refreshingDeferred)return this.refreshingDeferred.promise;let i="#_callRefreshToken(".concat(e.substring(0,5),"...)");this._debug(i,"begin");try{this.refreshingDeferred=new eW;let{data:t,error:r}=await this._refreshAccessToken(e);if(r)throw r;if(!t.session)throw new e8;await this._saveSession(t.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",t.session);let i={session:t.session,error:null};return this.refreshingDeferred.resolve(i),i}catch(e){if(this._debug(i,"error",e),e2(e)){let r={session:null,error:e};return tr(e)||(await this._removeSession(),await this._notifyAllSubscribers("SIGNED_OUT",null)),null===(t=this.refreshingDeferred)||void 0===t||t.resolve(r),r}throw null===(r=this.refreshingDeferred)||void 0===r||r.reject(e),e}finally{this.refreshingDeferred=null,this._debug(i,"end")}}async _notifyAllSubscribers(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],i="#_notifyAllSubscribers(".concat(e,")");this._debug(i,"begin",t,"broadcast = ".concat(r));try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:t});let i=[],n=Array.from(this.stateChangeEmitters.values()).map(async r=>{try{await r.callback(e,t)}catch(e){i.push(e)}});if(await Promise.all(n),i.length>0){for(let e=0;e<i.length;e+=1)console.error(i[e]);throw i[0]}}finally{this._debug(i,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await eK(this.storage,this.storageKey,e)}async _removeSession(){this._debug("#_removeSession()"),await eG(this.storage,this.storageKey)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");let e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&eD()&&(null==window?void 0:window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}
1catch(e){console.error("removing visibilitychange callback failed",e)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");let e=setInterval(()=>this._autoRefreshTokenTick(),3e4);this.autoRefreshTicker=e,e&&"object"==typeof e&&"function"==typeof e.unref?e.unref():"undefined"!=typeof Deno&&"function"==typeof Deno.unrefTimer&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");let e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{let e=Date.now();try{return await this._useSession(async t=>{let{data:{session:r}}=t;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}let i=Math.floor((1e3*r.expires_at-e)/3e4);this._debug("#_autoRefreshTokenTick()","access token expires in ".concat(i," ticks, a tick lasts ").concat(3e4,"ms, refresh threshold is ").concat(3," ticks")),i<=3&&await this._callRefreshToken(r.refresh_token)})}catch(e){console.error("Auto refresh tick failed with error. This is likely a transient error.",e)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof tk)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!eD()||!(null==window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),null==window||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){let t="#_onVisibilityChanged(".concat(e,")");this._debug(t,"visibilityState",document.visibilityState),"visible"===document.visibilityState?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{if("visible"!==document.visibilityState){this._debug(t,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):"hidden"===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,r){let i=["provider=".concat(encodeURIComponent(t))];if((null==r?void 0:r.redirectTo)&&i.push("redirect_to=".concat(encodeURIComponent(r.redirectTo))),(null==r?void 0:r.scopes)&&i.push("scopes=".concat(encodeURIComponent(r.scopes))),"pkce"===this.flowType){let[e,t]=await eZ(this.storage,this.storageKey),r=new URLSearchParams({code_challenge:"".concat(encodeURIComponent(e)),code_challenge_method:"".concat(encodeURIComponent(t))});i.push(r.toString())}if(null==r?void 0:r.queryParams){let e=new URLSearchParams(r.queryParams);i.push(e.toString())}return(null==r?void 0:r.skipBrowserRedirect)&&i.push("skip_http_redirect=".concat(r.skipBrowserRedirect)),"".concat(e,"?").concat(i.join("&"))}async _unenroll(e){try{return await this._useSession(async t=>{var r;let{data:i,error:n}=t;return n?{data:null,error:n}:await tc(this.fetch,"DELETE","".concat(this.url,"/factors/").concat(e.factorId),{headers:this.headers,jwt:null===(r=null==i?void 0:i.session)||void 0===r?void 0:r.access_token})})}catch(e){if(e2(e))return{data:null,error:e};throw e}}async _enroll(e){try{return await this._useSession(async t=>{var r,i;let{data:n,error:s}=t;if(s)return{data:null,error:s};let o=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},"phone"===e.factorType?{phone:e.phone}:{issuer:e.issuer}),{data:a,error:l}=await tc(this.fetch,"POST","".concat(this.url,"/factors"),{body:o,headers:this.headers,jwt:null===(r=null==n?void 0:n.session)||void 0===r?void 0:r.access_token});return l?{data:null,error:l}:("phone"===e.factorType&&delete a.totp,"totp"===e.factorType&&(null===(i=null==a?void 0:a.totp)||void 0===i?void 0:i.qr_code)&&(a.totp.qr_code="data:image/svg+xml;utf-8,".concat(a.totp.qr_code)),{data:a,error:null})})}catch(e){if(e2(e))return{data:null,error:e};throw e}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var r;let{data:i,error:n}=t;if(n)return{data:null,error:n};let{data:s,error:o}=await tc(this.fetch,"POST","".concat(this.url,"/factors/").concat(e.factorId,"/verify"),{body:{code:e.code,challenge_id:e.challengeId},headers:this.headers,jwt:null===(r=null==i?void 0:i.session)||void 0===r?void 0:r.access_token});return o?{data:null,error:o}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+s.expires_in},s)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",s),{data:s,error:o})})}catch(e){if(e2(e))return{data:null,error:e};throw e}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var r;let{data:i,error:n}=t;return n?{data:null,error:n}:await tc(this.fetch,"POST","".concat(this.url,"/factors/").concat(e.factorId,"/challenge"),{body:{channel:e.channel},headers:this.headers,jwt:null===(r=null==i?void 0:i.session)||void 0===r?void 0:r.access_token})})}catch(e){if(e2(e))return{data:null,error:e};throw e}})}async _challengeAndVerify(e){let{data:t,error:r}=await this._challenge({factorId:e.factorId});return r?{data:null,error:r}:await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){let{data:{user:e},error:t}=await this.getUser();if(t)return{data:null,error:t};let r=(null==e?void 0:e.factors)||[],i=r.filter(e=>"totp"===e.factor_type&&"verified"===e.status),n=r.filter(e=>"phone"===e.factor_type&&"verified"===e.status);return{data:{all:r,totp:i,phone:n},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async e=>{var t,r;let{data:{session:i},error:n}=e;if(n)return{data:null,error:n};if(!i)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let s=this._decodeJWT(i.access_token),o=null;s.aal&&(o=s.aal);let a=o;return(null!==(r=null===(t=i.user.factors)||void 0===t?void 0:t.filter(e=>"verified"===e.status))&&void 0!==r?r:[]).length>0&&(a="aal2"),{data:{currentLevel:o,nextLevel:a,currentAuthenticationMethods:s.amr||[]},error:null}}))}constructor(e){var t,r;this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=tO.nextInstanceID,tO.nextInstanceID+=1,this.instanceID>0&&eD()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");let i=Object.assign(Object.assign({},tE),e);if(this.logDebugMessages=!!i.debug,"function"==typeof i.debug&&(this.logger=i.debug),this.persistSession=i.persistSession,this.storageKey=i.storageKey,this.autoRefreshToken=i.autoRefreshToken,this.admin=new tm({url:i.url,headers:i.headers,fetch:i.fetch}),this.url=i.url,this.headers=i.headers,this.fetch=ez(i.fetch),this.lock=i.lock||tA,this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,i.lock?this.lock=i.lock:eD()&&(null===(t=null==globalThis?void 0:globalThis.navigator)||void 0===t?void 0:t.locks)?this.lock=tT:this.lock=tA,this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this)},this.persistSession?i.storage?this.storage=i.storage:eq()?this.storage=tw:(this.memoryStorage={},this.storage=tb(this.memoryStorage)):(this.memoryStorage={},this.storage=tb(this.memoryStorage)),eD()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(e){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",e)}null===(r=this.broadcastChannel)||void 0===r||r.addEventListener("message",async e=>{this._debug("received broadcast notification from other tab or client",e),await this._notifyAllSubscribers(e.data.event,e.data.session,!1)})}this.initialize()}}tO.nextInstanceID=0;var tj=tO;class tP extends tj{constructor(e){super(e)}}class tC{get functions(){return new c(this.functionsUrl,{headers:this.headers,customFetch:this.fetch})}get storage(){return new eE(this.storageUrl,this.headers,this.fetch)}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.rest.rpc(e,t,r)}channel(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{config:{}};return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){var e,t,r,i,n,s;return r=this,i=void 0,n=void 0,s=function*(){if(this.accessToken)return yield this.accessToken();let{data:r}=yield this.auth.getSession();return null!==(t=null===(e=r.session)||void 0===e?void 0:e.access_token)&&void 0!==t?t:null}
1,new(n||(n=Promise))(function(e,t){function o(e){try{l(s.next(e))}catch(e){t(e)}}function a(e){try{l(s.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):((r=t.value)instanceof n?r:new n(function(e){e(r)})).then(o,a)}l((s=s.apply(r,i||[])).next())})}_initSupabaseAuthClient(e,t,r){var i;let{autoRefreshToken:n,persistSession:s,detectSessionInUrl:o,storage:a,storageKey:l,flowType:c,lock:h,debug:u}=e,d={Authorization:"Bearer ".concat(this.supabaseKey),apikey:"".concat(this.supabaseKey)};return new tP({url:this.authUrl,headers:Object.assign(Object.assign({},d),t),storageKey:l,autoRefreshToken:n,persistSession:s,detectSessionInUrl:o,storage:a,flowType:c,lock:h,debug:u,fetch:r,hasCustomAuthorizationHeader:"Authorization"in this.headers})}_initRealtimeClient(e){return new I(this.realtimeUrl,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},null==e?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",null==t?void 0:t.access_token)})}_handleTokenChanged(e,t,r){("TOKEN_REFRESHED"===e||"SIGNED_IN"===e)&&this.changedAccessToken!==r?(this.realtime.setAuth(null!=r?r:null),this.changedAccessToken=r):"SIGNED_OUT"===e&&(this.realtime.setAuth(this.supabaseKey),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void 0)}constructor(e,t,r){var i,n,s;if(this.supabaseUrl=e,this.supabaseKey=t,!e)throw Error("supabaseUrl is required.");if(!t)throw Error("supabaseKey is required.");let o=e.replace(/\/$/,"");this.realtimeUrl="".concat(o,"/realtime/v1").replace(/^http/i,"ws"),this.authUrl="".concat(o,"/auth/v1"),this.storageUrl="".concat(o,"/storage/v1"),this.functionsUrl="".concat(o,"/functions/v1");let a="sb-".concat(new URL(this.authUrl).hostname.split(".")[0],"-auth-token"),l=function(e,t){let{db:r,auth:i,realtime:n,global:s}=e,{db:o,auth:a,realtime:l,global:c}=t,h={db:Object.assign(Object.assign({},o),r),auth:Object.assign(Object.assign({},a),i),realtime:Object.assign(Object.assign({},l),n),global:Object.assign(Object.assign({},c),s),accessToken:()=>{var e,t,r,i;return e=this,t=void 0,i=function*(){return""},new(r=void 0,r=Promise)(function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})}};return e.accessToken?h.accessToken=e.accessToken:delete h.accessToken,h}(null!=r?r:{},{db:ej,realtime:eC,auth:Object.assign(Object.assign({},eP),{storageKey:a}),global:eO});this.storageKey=null!==(i=l.auth.storageKey)&&void 0!==i?i:"",this.headers=null!==(n=l.global.headers)&&void 0!==n?n:{},l.accessToken?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(e,t)=>{throw Error("@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.".concat(String(t)," is not possible"))}})):this.auth=this._initSupabaseAuthClient(null!==(s=l.auth)&&void 0!==s?s:{},this.headers,l.global.fetch),this.fetch=eU(t,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers},l.realtime)),this.rest=new h("".concat(o,"/rest/v1"),{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),l.accessToken||this._listenForAuthEvents()}}let tx=(e,t,r)=>new tC(e,t,r);var tR=r(43175);function tI(){return void 0!==window.document}let tU={path:"/",sameSite:"lax",httpOnly:!1,maxAge:3456e4},tL=/^(.*)[.](0|[1-9][0-9]*)$/;function tB(e,t){if(e===t)return!0;let r=e.match(tL);return!!r&&r[1]===t}function tN(e,t,r){let i=null!=r?r:3180,n=encodeURIComponent(t);if(n.length<=i)return[{name:e,value:t}];let s=[];for(;n.length>0;){let e=n.slice(0,i),t=e.lastIndexOf("%");t>i-3&&(e=e.slice(0,t));let r="";for(;e.length>0;)try{r=decodeURIComponent(e);break}catch(t){if(t instanceof URIError&&"%"===e.at(-3)&&e.length>3)e=e.slice(0,e.length-3);else throw t}s.push(r),n=n.slice(e.length)}return s.map((t,r)=>({name:"".concat(e,".").concat(r),value:t}))}async function tD(e,t){let r=await t(e);if(r)return r;let i=[];for(let r=0;;r++){let n="".concat(e,".").concat(r),s=await t(n);if(!s)break;i.push(s)}return i.length>0?i.join(""):null}let tM="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),tq=" 	\n\r=".split(""),tF=(()=>{let e=Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<tq.length;t+=1)e[tq[t].charCodeAt(0)]=-2;for(let t=0;t<tM.length;t+=1)e[tM[t].charCodeAt(0)]=t;return e})();function tz(e){let t=[],r=0,i=0;if(function(e,t){for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r);if(i>55295&&i<=56319){let t=(i-55296)*1024&65535;i=(e.charCodeAt(r+1)-56320&65535|t)+65536,r+=1}!function(e,t){if(e<=127){t(e);return}if(e<=2047){t(192|e>>6),t(128|63&e);return}if(e<=65535){t(224|e>>12),t(128|e>>
16&63),t(128|63&e);return}if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|63&e);return}throw Error("Unrecognized Unicode codepoint: ".concat(e.toString(16)))}(i,t)}}(e,e=>{for(r=r<<8|e,i+=8;i>=6;){let e=r>>i-6&63;t.push(tM[e]),i-=6}}),i>0)for(r<<=6-i,i=6;i>=6;){let e=r>>i-6&63;t.push(tM[e]),i-=6}return t.join("")}function tJ(e){let t=[],r=e=>{t.push(String.fromCodePoint(e))},i={utf8seq:0,codepoint:0},n=0,s=0;for(let t=0;t<e.length;t+=1){let o=tF[e.charCodeAt(t)];if(o>-1)for(n=n<<6|o,s+=6;s>=8;)(function(e,t,r){if(0===t.utf8seq){if(e<=127){r(e);return}for(let r=1;r<6;r+=1)if((e>>7-r&1)==0){t.utf8seq=r;break}if(2===t.utf8seq)t.codepoint=31&e;else if(3===t.utf8seq)t.codepoint=15&e;else if(4===t.utf8seq)t.codepoint=7&e;else throw Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|63&e,t.utf8seq-=1,0===t.utf8seq&&r(t.codepoint)}})(n>>s-8&255,i,r),s-=8;else if(-2===o)continue;else throw Error('Invalid Base64-URL character "'.concat(e.at(t),'" at position ').concat(t))}return t.join("")}let tK="base64-";async function tH(e,t){var r;let{getAll:i,setAll:n,setItems:s,removedItems:o}=e,a=t.cookieEncoding,l=null!==(r=t.cookieOptions)&&void 0!==r?r:null,c=await i([...s?Object.keys(s):[],...o?Object.keys(o):[]]),h=(null==c?void 0:c.map(e=>{let{name:t}=e;return t}))||[],u=Object.keys(o).flatMap(e=>h.filter(t=>tB(t,e))),d=Object.keys(s).flatMap(e=>{let t=new Set(h.filter(t=>tB(t,e))),r=s[e];"base64url"===a&&(r=tK+tz(r));let i=tN(e,r);return i.forEach(e=>{t.delete(e.name)}),u.push(...t),i}),f={...tU,...l,maxAge:0},p={...tU,...l,maxAge:tU.maxAge};delete f.name,delete p.name,await n([...u.map(e=>({name:e,value:"",options:f})),...d.map(e=>{let{name:t,value:r}=e;return{name:t,value:r,options:p}})])}function tG(e,t,r){var n,s,o;let a=(null==r?void 0:r.isSingleton)===!0||(!r||!("isSingleton"in r))&&tI();if(a&&i)return i;if(!e||!t)throw Error("@supabase/ssr: Your project's URL and API key are required to create a Supabase client!\n\nCheck your Supabase project's API settings to find these values\n\nhttps://supabase.com/dashboard/project/_/settings/api");let{storage:l}=function(e,t){var r;let i,n;let s=null!==(r=e.cookies)&&void 0!==r?r:null,o=e.cookieEncoding,a={},l={};if(s){if("get"in s){let e=async e=>{let t=e.flatMap(e=>[e,...Array.from({length:5}).map((t,r)=>"".concat(e,".").concat(r))]),r=[];for(let e=0;e<t.length;e+=1){let i=await s.get(t[e]);(i||"string"==typeof i)&&r.push({name:t[e],value:i})}return r};if(i=async t=>await e(t),"set"in s&&"remove"in s)n=async e=>{for(let t=0;t<e.length;t+=1){let{name:r,value:i,options:n}=e[t];i?await s.set(r,i,n):await s.remove(r,n)}};else if(t)n=async()=>{console.warn("@supabase/ssr: createServerClient was configured without set and remove cookie methods, but the client needs to set cookies. This can lead to issues such as random logouts, early session termination or increased token refresh requests. If in NextJS, check your middleware.ts file, route handlers and server actions for correctness. Consider switching to the getAll and setAll cookie methods instead of get, set and remove which are deprecated and can be difficult to use correctly.")};else throw Error("@supabase/ssr: createBrowserClient requires configuring a getAll and setAll cookie method (deprecated: alternatively both get, set and remove can be used)")}else if("getAll"in s){if(i=async()=>await s.getAll(),"setAll"in s)n=s.setAll;else if(t)n=async()=>{console.warn("@supabase/ssr: createServerClient was configured without the setAll cookie method, but the client needs to set cookies. This can lead to issues such as random logouts, early session termination or increased token refresh requests. If in NextJS, check your middleware.ts file, route handlers and server actions for correctness.")};else throw Error("@supabase/ssr: createBrowserClient requires configuring both getAll and setAll cookie methods (deprecated: alternatively both get, set and remove can be used)")}else throw Error("@supabase/ssr: ".concat(t?"createServerClient":"createBrowserClient"," requires configuring getAll and setAll cookie methods (deprecated: alternatively use get, set and remove).").concat(tI()?" As this is called 
1in a browser runtime, consider removing the cookies option object to use the document.cookie API automatically.":""))}else if(!t&&tI()){let e=()=>{let e=(0,tR.Q)(document.cookie);return Object.keys(e).map(t=>({name:t,value:e[t]}))};i=()=>e(),n=e=>{e.forEach(e=>{let{name:t,value:r,options:i}=e;document.cookie=(0,tR.q)(t,r,i)})}}else if(t)throw Error("@supabase/ssr: createServerClient must be initialized with cookie options that specify getAll and setAll functions (deprecated, not recommended: alternatively use get, set and remove)");else i=()=>[],n=()=>{throw Error("@supabase/ssr: createBrowserClient in non-browser runtimes (including Next.js pre-rendering mode) was not initialized cookie options that specify getAll and setAll functions (deprecated: alternatively use get, set and remove), but they were needed")};return t?{getAll:i,setAll:n,setItems:a,removedItems:l,storage:{isServer:!0,getItem:async e=>{if("string"==typeof a[e])return a[e];if(l[e])return null;let t=await i([e]),r=await tD(e,async e=>{let r=(null==t?void 0:t.find(t=>{let{name:r}=t;return r===e}))||null;return r?r.value:null});if(!r)return null;let n=r;return r.startsWith(tK)&&(n=tJ(r.substring(tK.length))),n},setItem:async(t,r)=>{if(t.endsWith("-code-verifier")){var s;await tH({getAll:i,setAll:n,setItems:{[t]:r},removedItems:{}},{cookieOptions:null!==(s=null==e?void 0:e.cookieOptions)&&void 0!==s?s:null,cookieEncoding:o})}a[t]=r,delete l[t]},removeItem:async e=>{delete a[e],l[e]=!0}}}:{getAll:i,setAll:n,setItems:a,removedItems:l,storage:{isServer:!1,getItem:async e=>{let t=await i([e]),r=await tD(e,async e=>{let r=(null==t?void 0:t.find(t=>{let{name:r}=t;return r===e}))||null;return r?r.value:null});if(!r)return null;let n=r;return r.startsWith(tK)&&(n=tJ(r.substring(tK.length))),n},setItem:async(t,r)=>{let s=await i([t]),a=(null==s?void 0:s.map(e=>{let{name:t}=e;return t}))||[],l=new Set(a.filter(e=>tB(e,t))),c=r;"base64url"===o&&(c=tK+tz(r));let h=tN(t,c);h.forEach(e=>{let{name:t}=e;l.delete(t)});let u={...tU,...null==e?void 0:e.cookieOptions,maxAge:0},d={...tU,...null==e?void 0:e.cookieOptions,maxAge:tU.maxAge};delete u.name,delete d.name;let f=[...[...l].map(e=>({name:e,value:"",options:u})),...h.map(e=>{let{name:t,value:r}=e;return{name:t,value:r,options:d}})];f.length>0&&await n(f)},removeItem:async t=>{let r=await i([t]),s=((null==r?void 0:r.map(e=>{let{name:t}=e;return t}))||[]).filter(e=>tB(e,t)),o={...tU,...null==e?void 0:e.cookieOptions,maxAge:0};delete o.name,s.length>0&&await n(s.map(e=>({name:e,value:"",options:o})))}}}}({...r,cookieEncoding:null!==(o=null==r?void 0:r.cookieEncoding)&&void 0!==o?o:"base64url"},!1),c=tx(e,t,{...r,global:{...null==r?void 0:r.global,headers:{...null==r?void 0:null===(n=r.global)||void 0===n?void 0:n.headers,"X-Client-Info":"supabase-ssr/".concat("0.5.1")}},auth:{...null==r?void 0:r.auth,...(null==r?void 0:null===(s=r.cookieOptions)||void 0===s?void 0:s.name)?{storageKey:r.cookieOptions.name}:null,flowType:"pkce",autoRefreshToken:tI(),detectSessionInUrl:tI(),persistSession:!0,storage:l}});return a&&(i=c),c}},43175:function(e,t){/*!
2 * cookie
3 * Copyright(c) 2012-2014 Roman Shtylman
4 * Copyright(c) 2015 Douglas Christopher Wilson
5 * MIT Licensed
6 */t.Q=function(e,t){if("string"!=typeof e)throw TypeError("argument str must be a string");for(var r={},i=(t||{}).decode||n,s=0;s<e.length;){var o=e.indexOf("=",s);if(-1===o)break;var a=e.indexOf(";",s);if(-1===a)a=e.length;else if(a<o){s=e.lastIndexOf(";",o-1)+1;continue}var l=e.slice(s,o).trim();if(void 0===r[l]){var c=e.slice(o+1,a).trim();34===c.charCodeAt(0)&&(c=c.slice(1,-1)),r[l]=function(e,t){try{return t(e)}catch(t){return e}}(c,i)}s=a+1}return r},t.q=function(e,t,n){var o=n||{},a=o.encode||s;if("function"!=typeof a)throw TypeError("option encode is invalid");if(!i.test(e))throw TypeError("argument name is invalid");var l=a(t);if(l&&!i.test(l))throw TypeError("argument val is invalid");var c=e+"="+l;if(null!=o.maxAge){var h=o.maxAge-0;if(isNaN(h)||!isFinite(h))throw TypeError("option maxAge is invalid");c+="; Max-Age="+Math.floor(h)}if(o.domain){if(!i.test(o.domain))throw TypeError("option domain is invali
6d");c+="; Domain="+o.domain}if(o.path){if(!i.test(o.path))throw TypeError("option path is invalid");c+="; Path="+o.path}if(o.expires){var u=o.expires;if("[object Date]"!==r.call(u)&&!(u instanceof Date)||isNaN(u.valueOf()))throw TypeError("option expires is invalid");c+="; Expires="+u.toUTCString()}if(o.httpOnly&&(c+="; HttpOnly"),o.secure&&(c+="; Secure"),o.partitioned&&(c+="; Partitioned"),o.priority)switch("string"==typeof o.priority?o.priority.toLowerCase():o.priority){case"low":c+="; Priority=Low";break;case"medium":c+="; Priority=Medium";break;case"high":c+="; Priority=High";break;default:throw TypeError("option priority is invalid")}if(o.sameSite)switch("string"==typeof o.sameSite?o.sameSite.toLowerCase():o.sameSite){case!0:case"strict":c+="; SameSite=Strict";break;case"lax":c+="; SameSite=Lax";break;case"none":c+="; SameSite=None";break;default:throw TypeError("option sameSite is invalid")}return c};var r=Object.prototype.toString,i=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function n(e){return -1!==e.indexOf("%")?decode
6URIComponent(e):e}function s(e){return encodeURIComponent(e)}},8620:function(e){!function(){var t={675:function(e,t){t.byteLength=function(e){var t=l(e),r=t[0],i=t[1];return(r+i)*3/4-i},t.toByteArray=function(e){var t,r,s=l(e),o=s[0],a=s[1],c=new n((o+a)*3/4-a),h=0,u=a>0?o-4:o;for(r=0;r<u;r+=4)t=i[e.charCodeAt(r)]<<18|i[e.charCodeAt(r+1)]<<12|i[e.charCodeAt(r+2)]<<6|i[e.charCodeAt(r+3)],c[h++]=t>>16&255,c[h++]=t>>8&255,c[h++]=255&t;return 2===a&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,c[h++]=255&t),1===a&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,c[h++]=t>>8&255,c[h++]=255&t),c},t.fromByteArray=function(e){for(var t,i=e.length,n=i%3,s=[],o=0,a=i-n;o<a;o+=16383)s.push(function(e,t,i){for(var n,s=[],o=t;o<i;o+=3)s.push(r[(n=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]))>>18&63]+r[n>>12&63]+r[n>>6&63]+r[63&n]);return s.join("")}(e,o,o+16383>a?a:o+16383));return 1===n?s.push(r[(t=e[i-1])>>2]+r[t<<4&63]+"=="):2===n&&s.push(r[(t=(e[i-2]<<8)+e[i-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),s.join("")};for(var r=[],i=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,a=s.length;o<a;++o)r[o]=s[o],i[s.charCodeAt(o)]=o;function l(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var i=r===t?0:4-r%4;return[r,i]}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},72:function(e,t,r){/*!
7 * The buffer module from node.js, for the browser.
8 *
9 * @author   Feross Aboukhadijeh <https://feross.org>
10 * @license  MIT
11 */var i=r(675),n=r(783),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function o(e){if(e>2147483647)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return h(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e)return function(e,t){if(("string"!=typeof t||""===t)&&(t="utf8"),!a.isEncoding(t))throw TypeError("Unknown encoding: "+t);var r=0|f(e,t),i=o(r),n=i.write(e,t);return n!==r&&(i=i.slice(0,n)),i}(e,t);if(ArrayBuffer.isView(e))return u(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(P(e,ArrayBuffer)||e&&P(e.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(P(e,SharedArrayBuffer)||e&&P(e.buffer,SharedArrayBuffer)))return function(e,t,r){var i;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(i=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),a.prototype),i}(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var i=e.valueOf&&e.valueOf();if(null!=i&&i!==e)return a.from(i,t,r);var n=function(e){if(a.isBuffer(e)){var t,r=0|d(e.length),i=o(r);return 0===i.length||e.copy(i,0,0,r),i}return void 0!==e.length?"number"!=typeof e.length||(t=e.length)!=t?o(0):u(e):"Buffer"===e.type&&Array.isArray(e.data)?u(e.data):void 0}(e);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function h(e){return c(e),o(e<0?0:0|d(e))}function u(e){for(var t=e.length<0?0:0|d(e.length),r=o(t),i=0;i<t;i+=1)r[i]=255&e[i];return r}function d(e){if(e>=2147483647)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function f(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||P(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return E(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return O(e).length;default:if(n)return i?-1:E(e).length;t=(""+t).toLowerCase(),n=!0}}function p(e,t,r){var n,s,o=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var i=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);for(var n="",s=t;s<r;++s)n+=C[e[s]];return n}(this,t,r);case"utf8":case"utf-8":return m(this,t,r);case"ascii":return function(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;n<r;++n)i+=String.fromCharCode(127&e[n]);return i}(this,t,r);case"latin1":case"binary":return function(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;n<r;++n)i+=String.fromCharCode(e[n]);return i}(this,t,r);case"base64":return n=t,s=r,0===n&&s===this.length?i.fromByteArray(this):i.fromByteArray(this.slice(n,s));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var i=e.slice(t,r),n="",s=0;s<i.length;s+=2)n+=String.fromCharCode(i[s]+256*i[s+1]);return n}(this,t,r);default:if(o)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}function g(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}function y(e,t,r,i,n){var s;if(0===e.length)return -1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),(s=r=+r)!=s&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return -1;r=e.length-1}
11else if(r<0){if(!n)return -1;r=0}if("string"==typeof t&&(t=a.from(t,i)),a.isBuffer(t))return 0===t.length?-1:v(e,t,r,i,n);if("number"==typeof t)return(t&=255,"function"==typeof Uint8Array.prototype.indexOf)?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,i,n);throw TypeError("val must be string, number or Buffer")}function v(e,t,r,i,n){var s,o=1,a=e.length,l=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return -1;o=2,a/=2,l/=2,r/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(n){var h=-1;for(s=r;s<a;s++)if(c(e,s)===c(t,-1===h?0:s-h)){if(-1===h&&(h=s),s-h+1===l)return h*o}else -1!==h&&(s-=s-h),h=-1}else for(r+l>a&&(r=a-l),s=r;s>=0;s--){for(var u=!0,d=0;d<l;d++)if(c(e,s+d)!==c(t,d)){u=!1;break}if(u)return s}return -1}function m(e,t,r){r=Math.min(e.length,r);for(var i=[],n=t;n<r;){var s,o,a,l,c=e[n],h=null,u=c>239?4:c>223?3:c>191?2:1;if(n+u<=r)switch(u){case 1:c<128&&(h=c);break;case 2:(192&(s=e[n+1]))==128&&(l=(31&c)<<6|63&s)>127&&(h=l);break;case 3:s=e[n+1],o=e[n+2],(192&s)==128&&(192&o)==128&&(l=(15&c)<<12|(63&s)<<6|63&o)>2047&&(l<55296||l>57343)&&(h=l);break;case 4:s=e[n+1],o=e[n+2],a=e[n+3],(192&s)==128&&(192&o)==128&&(192&a)==128&&(l=(15&c)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&l<1114112&&(h=l)}null===h?(h=65533,u=1):h>65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|1023&h),i.push(h),n+=u}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var r="",i=0;i<t;)r+=String.fromCharCode.apply(String,e.slice(i,i+=4096));return r}(i)}function w(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function b(e,t,r,i,n,s){if(!a.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<s)throw RangeError('"value" argument is out of bounds');if(r+i>e.length)throw RangeError("Index out of range")}function _(e,t,r,i,n,s){if(r+i>e.length||r<0)throw RangeError("Index out of range")}function k(e,t,r,i,s){return t=+t,r>>>=0,s||_(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,i,23,4),r+4}function S(e,t,r,i,s){return t=+t,r>>>=0,s||_(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,i,52,8),r+8}t.Buffer=a,t.SlowBuffer=function(e){return+e!=e&&(e=0),a.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=2147483647,a.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),a.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(e,t,r){return(c(e),e<=0)?o(e):void 0!==t?"string"==typeof r?o(e).fill(t,r):o(e).fill(t):o(e)},a.allocUnsafe=function(e){return h(e)},a.allocUnsafeSlow=function(e){return h(e)},a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(P(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),P(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,i=t.length,n=0,s=Math.min(r,i);n<s;++n)if(e[n]!==t[n]){r=e[n],i=t[n];break}return r<i?-1:i<r?1:0},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,i=a.allocUnsafe(t),n=0;for(r=0;r<e.length;++r){var s=e[r];
vendor: 9,728 bytes, line 11
11if(P(s,Uint8Array)&&(s=a.from(s)),!a.isBuffer(s))throw TypeError('"list" argument must be an Array of Buffers');s.copy(i,n),n+=s.length}return i},a.byteLength=f,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},a.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},a.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},a.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?m(this,0,e):p.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},s&&(a.prototype[s]=a.prototype.inspect),a.prototype.compare=function(e,t,r,i,n){if(P(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||r>e.length||i<0||n>this.length)throw RangeError("out of range index");if(i>=n&&t>=r)return 0;if(i>=n)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,i>>>=0,n>>>=0,this===e)return 0;for(var s=n-i,o=r-t,l=Math.min(s,o),c=this.slice(i,n),h=e.slice(t,r),u=0;u<l;++u)if(c[u]!==h[u]){s=c[u],o=h[u];break}return s<o?-1:o<s?1:0},a.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},a.prototype.indexOf=function(e,t,r){return y(this,e,t,r,!0)},a.prototype.lastIndexOf=function(e,t,r){return y(this,e,t,r,!1)},a.prototype.write=function(e,t,r,i){if(void 0===t)i="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)i=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var n,s,o,a,l,c,h,u,d,f,p,g,y=this.length-t;if((void 0===r||r>y)&&(r=y),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var v=!1;;)switch(i){case"hex":return function(e,t,r,i){r=Number(r)||0;var n=e.length-r;i?(i=Number(i))>n&&(i=n):i=n;var s=t.length;i>s/2&&(i=s/2);for(var o=0;o<i;++o){var a=parseInt(t.substr(2*o,2),16);if(a!=a)break;e[r+o]=a}return o}(this,e,t,r);case"utf8":case"utf-8":return l=t,c=r,j(E(e,this.length-l),this,l,c);case"ascii":return h=t,u=r,j(A(e),this,h,u);case"latin1":case"binary":return n=this,s=e,o=t,a=r,j(A(s),n,o,a);case"base64":return d=t,f=r,j(O(e),this,d,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return p=t,g=r,j(function(e,t){for(var r,i,n=[],s=0;s<e.length&&!((t-=2)<0);++s)i=(r=e.charCodeAt(s))>>8,n.push(r%256),n.push(i);return n}(e,this.length-p),this,p,g);default:if(v)throw TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),v=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},a.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var i=this.subarray(e,t);return Object.setPrototypeOf(i,a.prototype),i},a.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);for(var i=this[e],n=1,s=0;++s<t&&(n*=256);)i+=this[e+s]*n;return i},a.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);for(var i=this[e+--t],n=1;t>0&&(n*=256);)i+=this[e+--t]*n;return i},a.prototype.readUInt8=function(e,t){return e>>>=0,t||w(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||w(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||w(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||w(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||w(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);for(var i=this[e],n=1,s=0;++s<t&&(n*=256);)i+=this[e+s]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*t)),i},a.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);for(var i=t,n=1,s=this[e+--i];i>0&&(n*=256);)s+=this[e+--i]*n;return s>=(n*=128)&&(s-=Math.pow(2,8*t)),s},a.prototype.readInt8=function(e,t){return(e>>>=0,t||w(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||w(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(e,t){e>>>=0,t||w(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||w(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||w(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return e>>>=0,t||w(e,4,this.length),n.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||w(e,4,this.length),n.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||w(e,8,this.length),n.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||w(e,8,this.length),n.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,r,i){if(e=+e,t>>>=0,r>>>=0,!i){var n=Math.pow(2,8*r)-1;b(this,e,t,r,n,0)}var s=1,o=0;for(this[t]=255&e;++o<r&&(s*=256);)this[t+o]=e/s&255;return t+r},a.prototype.writeUIntBE=function(e,t,r,i){if(e=+e,t>>>=0,r>>>=0,!i){var n=Math.pow(2,8*r)-1;b(this,e,t,r,n,0)}var s=r-1,o=1;for(this[t+s]=255&e;--s>=0&&(o*=256);)this[t+s]=e/o&255;return t+r},a.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t>>>=0,!i){var n=Math.pow(2,8*r-1);b(this,e,t,r,n-1,-n)}var s=0,o=1,a=0;for(this[t]=255&e;++s<r&&(o*=256);)e<0&&0===a&&0!==this[t+s-1]&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+r},a.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t>>>=0,!i){var n=Math.pow(2,8*r-1);b(this,e,t,r,n-1,-n)}var s=r-1,o=1,a=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeFloatLE=function(e,t,r){return k(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return k(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return S(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return S(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,i){if(!a.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<r&&(i=r),i===r||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(i<0)throw RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-r&&(i=e.length-t+r);var n=i-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,i);else if(this===e&&r<t&&t<i)for(var s=n-1;s>=0;--s)e[s+t]=this[s+r];else Uint8Array.prototype.set.call(e,this.subarray(r,i),t);return n},a.prototype.fill=function(e,t,r,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),void 0!==i&&"string"!=typeof i)throw TypeError("encoding must be a string");if("string"==typeof i&&!a.isEncoding(i))throw TypeError("Unknown encoding: "+i);if(1===e.length){var n,s=e.charCodeAt(0);("utf8"===i&&s<128||"latin1"===i)&&(e=s)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(n=t;n<r;++n)this[n]=e;
11else{var o=a.isBuffer(e)?e:a.from(e,i),l=o.length;if(0===l)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(n=0;n<r-t;++n)this[n+t]=o[n%l]}return this};var T=/[^+/0-9A-Za-z-_]/g;function E(e,t){t=t||1/0;for(var r,i=e.length,n=null,s=[],o=0;o<i;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!n){if(r>56319||o+1===i){(t-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(t-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return s}function A(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function O(e){return i.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(T,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function j(e,t,r,i){for(var n=0;n<i&&!(n+r>=t.length)&&!(n>=e.length);++n)t[n+r]=e[n];return n}function P(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var C=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var i=16*r,n=0;n<16;++n)t[i+n]=e[r]+e[n];return t}()},783:function(e,t){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */t.read=function(e,t,r,i,n){var s,o,a=8*n-i-1,l=(1<<a)-1,c=l>>1,h=-7,u=r?n-1:0,d=r?-1:1,f=e[t+u];for(u+=d,s=f&(1<<-h)-1,f>>=-h,h+=a;h>0;s=256*s+e[t+u],u+=d,h-=8);for(o=s&(1<<-h)-1,s>>=-h,h+=i;h>0;o=256*o+e[t+u],u+=d,h-=8);if(0===s)s=1-c;else{if(s===l)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,i),s-=c}return(f?-1:1)*o*Math.pow(2,s-i)},t.write=function(e,t,r,i,n,s){var o,a,l,c=8*s-n-1,h=(1<<c)-1,u=h>>1,d=23===n?5960464477539062e-23:0,f=i?0:s-1,p=i?1:-1,g=t<0||0===t&&1/t<0?1:0;for(isNaN(t=Math.abs(t))||t===1/0?(a=isNaN(t)?1:0,o=h):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+u>=1?t+=d/l:t+=d*Math.pow(2,1-u),t*l>=2&&(o++,l/=2),o+u>=h?(a=0,o=h):o+u>=1?(a=(t*l-1)*Math.pow(2,n),o+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,n),o=0));n>=8;e[r+f]=255&a,f+=p,a/=256,n-=8);for(o=o<<n|a,c+=n;c>0;e[r+f]=255&o,f+=p,o/=256,c-=8);e[r+f-p]|=128*g}}},r={};function i(e){var n=r[e];if(void 0!==n)return n.exports;var s=r[e]={exports:{}},o=!0;try{t[e](s,s.exports,i),o=!1}finally{o&&delete r[e]}return s.exports}i.ab="//";var n=i(72);e.exports=n}()}}]);

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